7 #include "fwGdcmIO/reader/ie/SpatialFiducials.hpp" 9 #include "fwGdcmIO/helper/DicomDataReader.hxx" 10 #include "fwGdcmIO/helper/DicomDataTools.hpp" 12 #include <fwData/Image.hpp> 13 #include <fwData/PointList.hpp> 14 #include <fwData/String.hpp> 16 #include <fwDataTools/fieldHelper/Image.hpp> 18 #include <fwMedData/DicomSeries.hpp> 30 const SPTR(::gdcm::Reader)& reader,
31 const ::fwGdcmIO::container::DicomInstance::sptr& instance,
32 const ::fwData::Image::sptr& image,
33 const ::fwLog::Logger::sptr& logger,
34 ProgressCallback progress,
35 CancelRequestedCallback cancel) :
36 ::
fwGdcmIO::reader::ie::InformationEntity< ::
fwData::Image >(dicomSeries, reader, instance, image,
37 logger, progress, cancel)
43 SpatialFiducials::~SpatialFiducials()
49 void SpatialFiducials::readLandmark(const ::gdcm::DataSet& fiducialDataset)
51 ::fwData::PointList::sptr pointList =
55 pointList = ::fwData::PointList::New();
59 const ::gdcm::DataElement& graphicCoordinatesDataElement =
60 fiducialDataset.GetDataElement( ::gdcm::Tag(0x0070, 0x0318) );
61 const ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > graphicCoordinatesDataSequence =
62 graphicCoordinatesDataElement.GetValueAsSQ();
64 const std::string label =
65 ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0070, 0x030F >(fiducialDataset);
67 for(
unsigned int i = 1; i <= graphicCoordinatesDataSequence->GetNumberOfItems(); ++i)
69 ::gdcm::Item graphicCoordinatesItem = graphicCoordinatesDataSequence->GetItem(i);
70 const ::gdcm::DataSet& graphicCoordinatesDataset = graphicCoordinatesItem.GetNestedDataSet();
73 ::gdcm::Attribute< 0x0070, 0x0022 > coordinatesAttribute;
74 coordinatesAttribute.SetFromDataElement(graphicCoordinatesDataset.GetDataElement(::gdcm::Tag(0x0070, 0x0022)));
75 const float* pointValues = coordinatesAttribute.GetValues();
78 const ::gdcm::DataElement& referencedImageDataElement =
79 graphicCoordinatesDataset.GetDataElement( ::gdcm::Tag(0x0008, 0x1140) );
80 const ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > referencedImageDataSequence =
81 referencedImageDataElement.GetValueAsSQ();
82 ::gdcm::Item referencedImageItem = referencedImageDataSequence->GetItem(1);
83 ::gdcm::DataSet& referencedImageDataset = referencedImageItem.GetNestedDataSet();
86 ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x1160, int >(referencedImageDataset);
90 ::fwData::Point::sptr
point = ::fwData::Point::New(static_cast<double>(pointValues[0]),
91 static_cast<double>(pointValues[1]), zCoordinate);
93 pointList->getPoints().push_back(point);
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
This class defines a list of points.
FWGDCMIO_API SpatialFiducials(const std::shared_ptr< const ::fwMedData::DicomSeries > &dicomSeries, const std::shared_ptr< ::gdcm::Reader > &reader, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwData::Image::sptr &series, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
Contains the representation of the data objects used in the framework.