7 #include "fwGdcmIO/reader/iod/SurfaceSegmentationIOD.hpp" 9 #include "fwGdcmIO/reader/ie/Equipment.hpp" 10 #include "fwGdcmIO/reader/ie/Patient.hpp" 11 #include "fwGdcmIO/reader/ie/Series.hpp" 12 #include "fwGdcmIO/reader/ie/Study.hpp" 13 #include "fwGdcmIO/reader/ie/Surface.hpp" 15 #include <fwData/Boolean.hpp> 16 #include <fwData/Mesh.hpp> 17 #include <fwData/Reconstruction.hpp> 19 #include <fwMedData/ModelSeries.hpp> 21 #include <fwRuntime/operations.hpp> 23 #include <gdcmSegmentReader.h> 24 #include <gdcmSurfaceHelper.h> 25 #include <gdcmSurfaceReader.h> 38 const ::fwLog::Logger::sptr& logger,
39 ProgressCallback progress,
40 CancelRequestedCallback cancel) :
56 ::fwMedData::ModelSeries::sptr modelSeries = ::fwMedData::ModelSeries::dynamicCast(series);
57 SLM_ASSERT(
"ModelSeries should not be null.", modelSeries);
60 SPTR(::gdcm::SurfaceReader) reader = std::shared_ptr< ::gdcm::SurfaceReader >( new ::gdcm::SurfaceReader );
63 ::fwMedData::DicomSeries::DicomContainerType dicomContainer =
m_dicomSeries->getDicomContainer();
64 if(dicomContainer.size() > 1)
66 m_logger->warning(
"More than one surface segmentation storage have been found in the series. " 67 "Only the first one will be read.");
71 const ::fwMemory::BufferObject::sptr bufferObj = dicomContainer.begin()->second;
72 const ::fwMemory::BufferManager::StreamInfo streamInfo = bufferObj->getStreamInfo();
73 SPTR(std::istream) is = streamInfo.stream;
74 reader->SetStream(*is);
76 const bool success = reader->Read();
78 bufferObj->getStreamInfo().fsFile.string()+
79 "\" using the GDCM Reader."), !success);
95 const ::boost::filesystem::path filepath = ::fwRuntime::getLibraryResourceFilePath(
96 "fwGdcmIO-" FWGDCMIO_VER
"/SegmentedPropertyRegistry.csv");
97 if(!surfaceIE.loadSegmentedPropertyRegistry(filepath))
99 throw ::fwGdcmIO::exception::Failed(
"Unable to load segmented property registry: '" +
100 filepath.string() +
"'. File does not exist.");
104 patientIE.readPatientModule();
107 studyIE.readGeneralStudyModule();
110 studyIE.readPatientStudyModule();
113 seriesIE.readGeneralSeriesModule();
122 equipmentIE.readGeneralEquipmentModule();
129 surfaceIE.readSurfaceSegmentationAndSurfaceMeshModules();
132 series->setField(
"ShowReconstructions", ::fwData::Boolean::New(
true));
Study Information Entity class.
Series Information Entity class.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
virtual FWGDCMIO_API ~SurfaceSegmentationIOD()
Destructor.
Implements a failed exception class for fwGdcmIO.
Equipment Information Entity class.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWGDCMIO_API SurfaceSegmentationIOD(const ::fwMedData::DicomSeries::csptr &dicomSeries, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
Surface Information Entity class.
FWGDCMIO_API void read(::fwMedData::Series::sptr series)
Read a DICOM File.
Patient Information Entity class.