7 #include "fwGdcmIO/writer/ie/Series.hpp" 9 #include "fwGdcmIO/helper/DicomDataWriter.hxx" 11 #include <fwMedData/Series.hpp> 12 #include <fwMedData/types.hpp> 14 #include <boost/date_time/posix_time/posix_time.hpp> 16 #include <gdcmUIDGenerator.h> 31 const ::fwMedData::Series::csptr& series,
32 const ::fwLog::Logger::sptr& logger,
33 ProgressCallback progress,
34 CancelRequestedCallback cancel) :
36 logger, progress, cancel)
51 ::gdcm::DataSet& dataset =
m_writer->GetFile().GetDataSet();
55 ::gdcm::UIDGenerator uidGenerator;
56 const std::string instanceUID = uidGenerator.Generate();
58 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0020, 0x000e >(instanceUID, dataset);
61 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0060 >(
m_object->getModality(), dataset);
63 ::boost::posix_time::ptime ptime = ::boost::posix_time::second_clock::local_time();
65 const std::string fulldate = ::boost::posix_time::to_iso_string(ptime);
68 ::boost::char_separator<char> sep(
"T");
69 ::boost::tokenizer< ::boost::char_separator<char> > tokens(fulldate, sep);
71 ::boost::tokenizer< ::boost::char_separator<char> >::iterator tok_iter = tokens.begin();
72 const std::string date = *tok_iter;
74 const std::string time = *tok_iter;
77 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0021 >(date, dataset);
80 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0031 >(time, dataset);
83 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x103e >(
m_object->getDescription(), dataset);
86 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< int, 0x0020, 0x0011 >(0, dataset);
89 ::fwMedData::DicomValuesType performingPhysicians =
m_object->getPerformingPhysiciansName();
90 if (!performingPhysicians.empty())
92 ::gdcm::String< >* physicians = new ::gdcm::String< >[performingPhysicians.size()];
93 unsigned int count = 0;
94 for(std::string physician: performingPhysicians)
96 physicians[count++] = ::gdcm::String<>(physician);
98 ::fwGdcmIO::helper::DicomDataWriter::setTagValues< ::gdcm::String< >, 0x0008, 0x1050 >(physicians, count,
104 ::gdcm::MediaStorage::GetMSString(::gdcm::MediaStorage::SurfaceSegmentationStorage))
106 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0020, 0x0060 >(
"R", dataset);
110 ::gdcm::Attribute< 0x0018, 0x5100 > patientPositionAttribute;
111 dataset.Insert(patientPositionAttribute.GetAsDataElement());
119 ::gdcm::DataSet& dataset =
m_writer->GetFile().GetDataSet();
122 dataset.Remove(::gdcm::Tag(0x0008, 0x0060));
123 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0060 >(
"SEG", dataset);
131 ::gdcm::DataSet& dataset =
m_writer->GetFile().GetDataSet();
134 ::gdcm::UIDGenerator uidGenerator;
137 dataset.Remove(::gdcm::Tag(0x0008, 0x0060));
138 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0060 >(
"SR", dataset);
141 dataset.Remove(::gdcm::Tag(0x0020, 0x000e));
142 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0020, 0x000e >(uidGenerator.Generate(), dataset);
145 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< int, 0x0020, 0x0011 >(0, dataset);
148 ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0008, 0x1111 >(dataset);
156 ::gdcm::DataSet& dataset =
m_writer->GetFile().GetDataSet();
159 ::gdcm::UIDGenerator uidGenerator;
162 dataset.Remove(::gdcm::Tag(0x0020, 0x000e));
163 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0020, 0x000e >(uidGenerator.Generate(), dataset);
166 dataset.Remove(::gdcm::Tag(0x0008, 0x0060));
167 ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0060 >(
"FID", dataset);
Namespace containing medical data.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
Series Information Entity class.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
virtual FWGDCMIO_API void writeGeneralSeriesModule()
Write General Series Module tags.
virtual FWGDCMIO_API void writeSegmentationSeriesModule()
Write Segmentation Series Module tags.
virtual FWGDCMIO_API void writeSpatialFiducialsSeriesModule()
Write Spatial Fiducials Series Module tags.
virtual FWGDCMIO_API void writeSRDocumentSeriesModule()
Write SR Document Series Module tags.
FWGDCMIO_API Series(const std::shared_ptr< ::gdcm::Writer > &writer, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwMedData::Series::csptr &series, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
virtual FWGDCMIO_API ~Series()
Destructor.