7 #include "fwGdcmIO/writer/Series.hpp" 9 #include "fwGdcmIO/writer/iod/ComprehensiveSRIOD.hpp" 10 #include "fwGdcmIO/writer/iod/CTMRImageIOD.hpp" 11 #include "fwGdcmIO/writer/iod/SpatialFiducialsIOD.hpp" 12 #include "fwGdcmIO/writer/iod/SurfaceSegmentationIOD.hpp" 14 #include <fwData/Image.hpp> 15 #include <fwData/PointList.hpp> 16 #include <fwData/Vector.hpp> 18 #include <fwDataIO/writer/registry/macros.hpp> 20 #include <fwDataTools/fieldHelper/Image.hpp> 22 #include <fwMedData/ImageSeries.hpp> 23 #include <fwMedData/ModelSeries.hpp> 24 #include <fwMedData/Series.hpp> 26 #include <boost/make_shared.hpp> 38 ::
fwData::location::enableFolder< ::
fwDataIO::writer::IObjectWriter >(this),
39 m_fiducialsExportMode(SPATIAL_FIDUCIALS)
54 SLM_ASSERT(
"::fwMedData::Series not instanced", series);
57 bool multiFiles =
true;
61 std::make_shared< ::fwGdcmIO::container::DicomInstance >(series,
nullptr, multiFiles);
64 const std::string& sopClassUID = instance->getSOPClassUID();
66 if(sopClassUID == ::gdcm::MediaStorage::GetMSString(::gdcm::MediaStorage::CTImageStorage) ||
67 sopClassUID == ::gdcm::MediaStorage::GetMSString(::gdcm::MediaStorage::MRImageStorage))
69 ::fwMedData::ImageSeries::csptr imageSeries = ::fwMedData::ImageSeries::dynamicCast(series);
70 SLM_ASSERT(
"::fwMedData::ImageSeries not instanced", imageSeries);
71 ::fwData::Image::sptr image = imageSeries->getImage();
72 SLM_ASSERT(
"::fwData::Image not instanced", image);
76 imageIOD.
write(series);
78 ::fwData::PointList::sptr landmarks =
80 ::fwData::Vector::sptr distances =
82 if((landmarks && !landmarks->getPoints().empty()) || (distances && !distances->empty()))
85 if(m_fiducialsExportMode == SPATIAL_FIDUCIALS)
88 spatialFiducialsIOD.
write(series);
94 documentIOD.
write(series);
98 else if(sopClassUID == ::gdcm::MediaStorage::GetMSString(::gdcm::MediaStorage::SurfaceSegmentationStorage))
106 SLM_WARN(
"Series type not supported.");
110 m_dicomInstanceMap[series->getInstanceUID()] = instance;
116 bool Series::hasDocumentSR(const ::fwMedData::ImageSeries::csptr& imageSeries)
const 118 ::fwData::Image::csptr image = imageSeries->getImage();
121 ::fwData::PointList::sptr pl;
124 return ((pl && pl->getPoints().size() > 0) ||
132 SLM_ASSERT(
"You must have created an image instance before trying to access it.", !m_dicomInstanceMap.empty());
133 return m_dicomInstanceMap.begin()->second;
140 return std::string(
"");
ILocation::PathType getFolder()
Get folder filesystem path.
virtual FWGDCMIO_API void write(const ::fwMedData::Series::csptr &series) override
Write DICOM file.
FWGDCMIO_API void write() override
Load and start appropriate writing tools. In addition, it creates an adapted folder tree where DICOM ...
This namespace fwDataIO contains reader and writer for several framework's data.
virtual std::shared_ptr< const DataType > getConcreteObject() const
m_object getter.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
This class handles DICOM files writing. It defines needs of data storage and delegates writing to app...
virtual FWGDCMIO_API void write(const ::fwMedData::Series::csptr &series) override
Write DICOM file.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
virtual FWGDCMIO_API void write(const ::fwMedData::Series::csptr &series) override
Write DICOM file.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
#define SLM_WARN(message)
FWDATA_API::fwData::Object::sptr getField(const FieldNameType &name,::fwData::Object::sptr defaultValue=::fwData::Object::sptr()) const
Returns a pointer of corresponding field (null if non exist).
CTMRImageIOD class used to write CTImage and MRImage DICOM files.
This class defines a vector of objects.
SpatialFiducialsIOD class used to write Spacial Fiducials DICOM files.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
SurfaceSegmentationIOD class used to write Surface Segmentation DICOM files.
This class defines a list of points.
virtual FWGDCMIO_API void write(const ::fwMedData::Series::csptr &series) override
Write DICOM file.
FWGDCMIO_API std::string extension() override
Do nothing.
Contains the representation of the data objects used in the framework.
FWGDCMIO_API Series(::fwDataIO::writer::IObjectWriter::Key key)
Constructor.
FWGDCMIO_API ~Series()
Destructor.
ComprehensiveSRIOD class used to write Enhanced Structured Report DICOM files.