7 #include "fwGdcmIO/writer/SurfaceSegmentation.hpp" 9 #include "fwGdcmIO/writer/iod/SurfaceSegmentationIOD.hpp" 11 #include <fwData/Image.hpp> 12 #include <fwData/PointList.hpp> 13 #include <fwData/Vector.hpp> 15 #include <fwDataIO/writer/registry/macros.hpp> 17 #include <fwJobs/Aggregator.hpp> 18 #include <fwJobs/Job.hpp> 19 #include <fwJobs/Observer.hpp> 21 #include <fwMedData/DicomSeries.hpp> 22 #include <fwMedData/ImageSeries.hpp> 23 #include <fwMedData/ModelSeries.hpp> 24 #include <fwMedData/Patient.hpp> 25 #include <fwMedData/Series.hpp> 26 #include <fwMedData/Study.hpp> 38 ::
fwData::location::enableSingleFile< ::
fwDataIO::writer::IObjectWriter >(this),
39 m_logger(::
fwLog::Logger::New()),
40 m_writerJob(::
fwJobs::Observer::New(
"Writing DICOM file"))
55 const ::fwMedData::DicomSeries::csptr associatedDicomSeries = srcModelSeries->getDicomReference();
57 SLM_ASSERT(
"::fwMedData::ModelSeries not instanced", srcModelSeries);
59 if(!associatedDicomSeries)
61 m_logger->critical(
"Unable to retrieve information from the associated image series.");
63 m_writerJob->finish();
68 const std::string& modelPatientName = srcModelSeries->getPatient()->getName();
69 const std::string& imagePatientName = associatedDicomSeries->getPatient()->getName();
70 if(modelPatientName != imagePatientName)
72 m_logger->warning(
"The patient's name of the model (\"" + modelPatientName +
"\") " 73 "does not match the patient's name of the image (\"" + imagePatientName +
"\").");
77 const std::string& modelPatientID = srcModelSeries->getPatient()->getPatientId();
78 const std::string& imagePatientID = associatedDicomSeries->getPatient()->getPatientId();
79 if(modelPatientID != imagePatientID)
81 m_logger->warning(
"The patient ID of the model (\"" + modelPatientID +
"\") " 82 "does not match the patient ID of the image (\"" + imagePatientID +
"\").");
86 const std::string& modelStudyInstanceUID = srcModelSeries->getStudy()->getInstanceUID();
87 const std::string& imageStudyInstanceUID = associatedDicomSeries->getStudy()->getInstanceUID();
88 if(modelStudyInstanceUID != imageStudyInstanceUID)
90 m_logger->warning(
"The study instance UID of the model (\"" + modelStudyInstanceUID +
"\") " 91 "does not match the study instance UID of the image (\"" + imageStudyInstanceUID +
"\").");
95 const ::fwMedData::ModelSeries::sptr modelSeries = ::fwMedData::ModelSeries::New();
96 modelSeries->shallowCopy(srcModelSeries);
97 modelSeries->setPatient(associatedDicomSeries->getPatient());
98 modelSeries->setStudy(associatedDicomSeries->getStudy());
101 std::make_shared< ::fwGdcmIO::container::DicomInstance >(associatedDicomSeries, m_logger);
104 std::make_shared< ::fwGdcmIO::container::DicomInstance >(modelSeries, m_logger,
false);
106 m_writerJob->doneWork(0);
107 m_writerJob->setTotalWorkUnits(modelSeries->getReconstructionDB().size());
110 associatedDicomInstance,
113 m_writerJob->progressCallback(),
114 m_writerJob->cancelRequestedCallback());
117 iod.
write(modelSeries);
119 catch (const ::fwGdcmIO::exception::Failed& e)
121 m_logger->critical(e.what());
125 m_writerJob->finish();
132 return std::string(
"");
This class is an interface for class managing job.
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 handles DICOM Surface Segmentation files writing.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
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.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
fwLog contains classes used to manage logs.
FWGDCMIO_API ~SurfaceSegmentation()
Destructor.
Logger class used to store logs.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGDCMIO_API std::shared_ptr< ::fwJobs::IJob > getJob() const override
Getter for writer's job.
SurfaceSegmentationIOD class used to write Surface Segmentation DICOM files.
ILocation::PathType getFile()
Get file system path.
Contains the representation of the data objects used in the framework.
FWGDCMIO_API std::string extension() override
Does nothing.
FWGDCMIO_API void write() override
Load and start appropriate writing tools.
FWGDCMIO_API std::shared_ptr< ::fwLog::Logger > getLogger() const
Returns logger.
FWGDCMIO_API SurfaceSegmentation(::fwDataIO::writer::IObjectWriter::Key key)
Constructor.
This namespace fwJobs provides jobs management.