fw4spl
writer/ie/Surface.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "fwGdcmIO/container/DicomSurface.hpp"
8 #include "fwGdcmIO/writer/ie/Surface.hpp"
9 
10 #include "fwGdcmIO/helper/DicomCodedAttribute.hpp"
11 #include "fwGdcmIO/helper/DicomDataTools.hpp"
12 #include "fwGdcmIO/helper/DicomDataWriter.hxx"
13 
14 #include <fwData/Reconstruction.hpp>
15 
16 #include <fwDataIO/reader/DictionaryReader.hpp>
17 
18 #include <fwDataTools/helper/Mesh.hpp>
19 
20 #include <fwMedData/Series.hpp>
21 #include <fwMedData/types.hpp>
22 
23 #include <fwRuntime/operations.hpp>
24 #include <fwRuntime/profile/Profile.hpp>
25 
26 #include <fwTools/dateAndTime.hpp>
27 
28 #include <boost/date_time/posix_time/posix_time.hpp>
29 
30 #include <gdcmSurfaceHelper.h>
31 #include <gdcmSurfaceWriter.h>
32 #include <gdcmUIDGenerator.h>
33 
34 #include <sstream>
35 
36 namespace fwGdcmIO
37 {
38 namespace writer
39 {
40 namespace ie
41 {
42 
43 //------------------------------------------------------------------------------
44 
45 Surface::Surface(const SPTR(::gdcm::Writer)& writer,
46  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
47  const SPTR(::fwGdcmIO::container::DicomInstance)& imageInstance,
48  const ::fwMedData::ModelSeries::csptr& series,
49  const ::fwLog::Logger::sptr& logger,
50  ProgressCallback progress,
51  CancelRequestedCallback cancel) :
52  ::fwGdcmIO::writer::ie::InformationEntity< ::fwMedData::ModelSeries >(writer, instance, series,
53  logger, progress, cancel),
54  m_imageInstance(imageInstance)
55 {
56  SLM_ASSERT("Image instance should not be null.", imageInstance);
57 }
58 
59 //------------------------------------------------------------------------------
60 
62 {
63 }
64 
65 //------------------------------------------------------------------------------
66 
67 bool Surface::loadSegmentedPropertyRegistry(const ::boost::filesystem::path& filepath)
68 {
70 }
71 
72 //------------------------------------------------------------------------------
73 
75 {
76  // Retrieve dataset
77  ::gdcm::DataSet& dataset = m_writer->GetFile().GetDataSet();
78 
79  // SOP Class UID
80  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0016 >(m_instance->getSOPClassUID(), dataset);
81  SLM_TRACE("SOP Class UID : " + m_instance->getSOPClassUID());
82 
83  // SOP Instance UID
84  ::gdcm::UIDGenerator uidGenerator;
85  std::string sopInstanceUID = uidGenerator.Generate();
86  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0018 >(sopInstanceUID, dataset);
87 }
88 
89 //------------------------------------------------------------------------------
90 
92 {
93  // Retrieve Surface Writer
94  SPTR(::gdcm::SurfaceWriter) surfaceWriter = std::static_pointer_cast< ::gdcm::SurfaceWriter >(m_writer);
95 
96  // Retrieve dataset
97  ::gdcm::DataSet& dataset = m_writer->GetFile().GetDataSet();
98 
99  //=======================================================
100  // Table C.8.23-1. Surface Segmentation Module Attributes
101  //=======================================================
102  {
103  //======================================================
104  // Table 10-12. Content Identification Macro Attributes
105  //======================================================
106  {
107  // Instance Number - Type 1 - Only one instance per series
108  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< int, 0x0020, 0x0013 >(1, dataset);
109 
110  // Content Label - Type 1
111  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0070, 0x0080 >("SURFACE", dataset);
112 
113  // Content Description - Type 2
114  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0070, 0x0081 >("Surface Segmentation", dataset);
115 
116  // Content Creator's Name - Type 2 - TODO: Set surface creator name ?
117  ::fwGdcmIO::helper::DicomDataWriter::setEmptyTagValue< 0x0070, 0x0084 >(dataset);
118  }
119 
120  // Content Date - Type 1
121  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0023 >(m_object->getDate(), dataset);
122 
123  // Content Time - Type 1
124  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0033 >(m_object->getTime(), dataset);
125 
126  }
127 
128  //=============================================
129  // Table C.27-1. Surface Mesh Module Attributes
130  //=============================================
131  {
132  // Number of Surfaces - Type 1
133  auto nbSurfaces = static_cast<unsigned int>(m_object->getReconstructionDB().size());
134  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< unsigned int, 0x0066, 0x0001 >(nbSurfaces, dataset);
135  }
136 
137  // Segment Sequence (0x0062,0x0002) - Type 1
138  // Segments will be added to this sequence thanks to the gdcm SegmentWriter
139  auto segmentSequence = ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0062, 0x0002 >(dataset);
140 
141  // Surface Sequence
142  auto surfaceSequence = ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x0002 >(dataset);
143 
144  //====================
145  // Write segmentations
146  //====================
147  unsigned short segmentNumber = 1;
148  const auto& reconstuctionDB = m_object->getReconstructionDB();
149  for(const auto& reconstruction : reconstuctionDB)
150  {
151  // Add segmentation to GDCM Surface Writer
152  ::gdcm::SmartPointer< ::gdcm::Segment > segment = new ::gdcm::Segment();
153  surfaceWriter->AddSegment(segment);
154 
155  // Create Segment Sequence item
156  ::gdcm::Item segmentItem;
157  segmentItem.SetVLToUndefined();
158  // Surface Segmentation Module - SegmentSequence
159  writeSegmentSequence(reconstruction, segmentItem, segment, segmentNumber);
160  segmentSequence->AddItem(segmentItem);
161 
162  // Add a surface to the segmentation
163  ::gdcm::SmartPointer< ::gdcm::Surface > surface = new ::gdcm::Surface();
164  segment->AddSurface(surface);
165 
166  // Create Surface Sequence item
167  ::gdcm::Item surfaceItem;
168  surfaceItem.SetVLToUndefined();
169  // Surface Mesh Module - Surface Sequence
170  writeSurfaceSequence(reconstruction, surfaceItem, surface, segmentNumber);
171  surfaceSequence->AddItem(surfaceItem);
172 
173  // Next segment
174  ++segmentNumber;
175 
176  if(m_logger)
177  {
178  m_logger->information("Surface '" + reconstruction->getOrganName() + "' has been exported");
179  }
180  }
181 
182 }
183 
184 //------------------------------------------------------------------------------
185 
186 void writeSegmentIdentification(const std::string& structureType,
187  const ::gdcm::SmartPointer< ::gdcm::Segment >& segment,
188  const ::fwGdcmIO::helper::SegmentedPropertyRegistry& registry,
189  ::fwLog::Logger::sptr logger)
190 {
191  // Check that the structure name has an entry in the registry
192  if(!registry.hasEntry(structureType))
193  {
194  const std::string msg = "No match in segmented property registry for structure '" + structureType + "'";
195  SLM_WARN_IF(msg, !logger);
196  if(logger)
197  {
198  logger->warning(msg);
199  }
200  }
201 
202  // Note: No error or warning is emitted from this function regarding
203  // multiplicity of coded attributes as checks are already performed in
204  // registry.
205  const auto entry = registry.getEntry(structureType);
206 
207  //======================================================
208  // Table 10-7. General Anatomy Optional Macro Attributes
209  //======================================================
210  {
211  // Anatomic Region Sequence (0x0008,0x2218) - Type 3
212  const std::string& anatomicRegion = entry[3];
213  if(!anatomicRegion.empty())
214  {
215  const auto codedAttributes =
217  if(!codedAttributes.empty())
218  {
219  // Only a single Item shall be included in this Sequence
220  segment->SetAnatomicRegion(codedAttributes[0]);
221  }
222  }
223 
224  // Anatomic Region Modifier Sequence (0x0008,0x2220) - Type 3
225  const std::string& anatomicRegionModifier = entry[4];
226  if(!anatomicRegionModifier.empty())
227  {
228  const auto codedAttributes =
230  if(!codedAttributes.empty())
231  {
232  // One or more Items are permitted in this Sequence.
233  segment->SetAnatomicRegionModifiers(codedAttributes);
234  }
235  }
236  }
237 
238  // Segmented Property Category Code Sequence (0x0062,0x0003) - Type 1
239  {
240  const std::string& propertyCategory = entry[1];
241  const auto codedAttributes =
243  if(!codedAttributes.empty())
244  {
245  // Only a single Item shall be included in this Sequence
246  segment->SetPropertyCategory(codedAttributes[0]);
247  }
248  }
249 
250  // Segmented Property Type Code Sequence (0x0062,0x000F) - Type 1
251  {
252  const std::string& propertyType = entry[0];
253  const auto codedAttributes =
255  if(!codedAttributes.empty())
256  {
257  // Only a single Item shall be included in this Sequence
258  segment->SetPropertyType(codedAttributes[0]);
259  }
260 
261  }
262 
263  // Segmented Property Type Modifier Code Sequence (0x0062,0x0011) - Type 3
264  {
265  const std::string& propertyTypeModifier = entry[2];
266  if(!propertyTypeModifier.empty())
267  {
268  const auto codedAttributes =
270  if(!codedAttributes.empty())
271  {
272  // One or more Items are permitted in this Sequence.
273  segment->SetPropertyTypeModifiers(codedAttributes);
274  }
275  }
276  }
277 
278 }
279 
280 //------------------------------------------------------------------------------
281 
282 void writePrivateTags(const ::fwData::Reconstruction::csptr& reconstruction,
283  ::gdcm::DataSet& dataset)
284 {
285  // Private group
286  const auto reservedGroup = 0x5649;
287  const auto reservingElement = 0x0010; // Reserve group (gggg,0x1000-0x10FF)
288  const auto privateCreator = "FW4SPL";
289 
290  // Reserve group
291  {
292  ::gdcm::Attribute< reservedGroup, reservingElement, ::gdcm::VR::LO, ::gdcm::VM::VM1 > attribute;
293  attribute.SetValue(privateCreator);
294  dataset.Insert(attribute.GetAsDataElement());
295  }
296 
297  // Structure type
298  {
299  const auto structureType = reconstruction->getStructureType();
300  ::gdcm::Attribute< reservedGroup, 0x1000, ::gdcm::VR::LO, ::gdcm::VM::VM1 > attribute;
301  attribute.SetValue(structureType);
302  dataset.Insert(attribute.GetAsDataElement());
303  }
304 
305  // Computed mask volume
306  const double volume = reconstruction->getComputedMaskVolume();
307  if(volume > 0)
308  {
309  ::gdcm::Attribute< reservedGroup, 0x1001, ::gdcm::VR::OD, ::gdcm::VM::VM1 > attribute;
310  attribute.SetValue(volume);
311  dataset.Insert(attribute.GetAsDataElement());
312  }
313 
314 }
315 
316 //------------------------------------------------------------------------------
317 
318 void Surface::writeSegmentSequence(const ::fwData::Reconstruction::csptr& reconstruction,
319  ::gdcm::Item& segmentItem,
320  const ::gdcm::SmartPointer< ::gdcm::Segment >& segment,
321  unsigned short segmentNumber)
322 {
323  // Retrieve segment dataset
324  ::gdcm::DataSet& segmentItemDataset = segmentItem.GetNestedDataSet();
325 
326  //=======================================================
327  // Table C.8.20-4. 'Segment Description Macro Attributes'
328  //=======================================================
329  {
330  // Segment Number (0x0062,0x0004) - Type 1 (start at 1)
331  segment->SetSegmentNumber(segmentNumber);
332 
333  // Segment Label (0x0062,0x0005) - Type 1
334  std::string segmentLabel = reconstruction->getOrganName();
335  segment->SetSegmentLabel(segmentLabel.c_str());
336 
337  // Segment Algorithm Type (0x0062,0x0008) - Type 1
338  segment->SetSegmentAlgorithmType(::gdcm::Segment::SEMIAUTOMATIC);
339 
340  // Anatomic Region Sequence (0x0008,0x2218) - Type 2
341  // Anatomic Region Modifier Sequence (0x0008,0x2220) - Type 3
342  // Segmented Property Category Code Sequence (0x0062,0x0003) - Type 1
343  // Segmented Property Type Code Sequence (0x0062,0x000F) - Type 1
344  // Segmented Property Type Code Sequence (0x0062,0x0011) - Type 3
345  const std::string structureType = reconstruction->getStructureType();
346  writeSegmentIdentification(structureType, segment, m_segmentedPropertyRegistry, m_logger);
347  }
348 
349  // Surface Count (0x0066,0x002A) - Type 1 - Reconstruction just contains one surface.
350  segment->SetSurfaceCount(1);
351 
352  // Referenced Surface Sequence - Type 1
353  auto referencedSurfaceSequence =
354  ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x002B >(segmentItemDataset);
355 
356  // Referenced Surface Sequence Item
357  ::gdcm::Item refSurfaceSeqItem;
358  refSurfaceSeqItem.SetVLToUndefined();
359  // TODO
360 
361  ::gdcm::DataSet& refSurfaceSeqItemDataset = refSurfaceSeqItem.GetNestedDataSet();
362  {
363  // Referenced Surface Number - Type 1
364  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< unsigned int, 0x0066, 0x002C >(segmentNumber,
365  refSurfaceSeqItemDataset);
366 
367  //=======================================================
368  // Table 10-19. Algorithm Identification Macro Attributes
369  //=======================================================
370  // This section is handled in the surface section because of the GDCM soup
371 
372  // Segment Surface Source Instance Sequence - Type 2
373  auto surfaceSourceInstanceSequence =
374  ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x002E >(
375  refSurfaceSeqItemDataset);
376 
377  //==========================================================
378  // Table 10-3. Image SOP Instance Reference Macro Attributes
379  //==========================================================
380  {
381  const std::vector< std::string >& referencedSOPInstanceUIDContainer =
382  m_imageInstance->getSOPInstanceUIDContainer();
383  const std::string& referencedSOPClassUID = m_imageInstance->getSOPClassUID();
384 
385  //=====================================================
386  // Table 10-11. SOP Instance Reference Macro Attributes
387  //=====================================================
388  for(const std::string& sopInstanceUID : referencedSOPInstanceUIDContainer)
389  {
390  // Create the item
391  ::gdcm::Item imageSOPItem;
392  imageSOPItem.SetVLToUndefined();
393  ::gdcm::DataSet& imageSOPDataset = imageSOPItem.GetNestedDataSet();
394 
395  // Referenced SOP Class UID - Type 1
396  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x1150 >(referencedSOPClassUID,
397  imageSOPDataset);
398 
399  // Referenced SOP Instance UID - Type 1
400  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x1155 >(sopInstanceUID,
401  imageSOPDataset);
402 
403  surfaceSourceInstanceSequence->AddItem(imageSOPItem);
404  }
405 
406  if(m_logger && referencedSOPInstanceUIDContainer.empty())
407  {
408  m_logger->warning("No DICOM instances have been added as 'Referenced SOP Instance UID'");
409  }
410  }
411  }
412  referencedSurfaceSequence->AddItem(refSurfaceSeqItem);
413 
414  // Private Tags
415  writePrivateTags(reconstruction, segmentItemDataset);
416 
417 }
418 
419 //------------------------------------------------------------------------------
420 
421 void Surface::writeSurfaceSequence(const ::fwData::Reconstruction::csptr& reconstruction,
422  ::gdcm::Item& surfaceItem,
423  const ::gdcm::SmartPointer< ::gdcm::Surface >& surface,
424  unsigned short segmentNumber)
425 {
426  // Retrieve surface dataset
427  ::gdcm::DataSet& surfaceItemDataset = surfaceItem.GetNestedDataSet();
428 
429  // Retrieve material
430  ::fwData::Material::csptr material = reconstruction->getMaterial();
431 
432  // Set DicomSurface data - NOTE: must be called before points and primitives writing
433  ::fwGdcmIO::container::DicomSurface surfaceContainer(reconstruction);
434 
435  // Surface Number (0x0066,0x0003) - Type 1
436  surface->SetSurfaceNumber(segmentNumber);
437 
438  // Surface Processing (0x0066,0x0009) - NO - Type 2
439  surface->SetSurfaceProcessing(false);
440 
441  // Get reconstruction's color
442  const auto rgba = material->diffuse()->getRGBA();
443  std::vector< float > rgb { rgba[0], rgba[1], rgba[2] };
444 
445  // Recommended Display Grayscale Value (0x0062,0x000C) - Type 1
446  const auto grayscale = ::gdcm::SurfaceHelper::RGBToRecommendedDisplayGrayscale(rgb, 1.);
447  surface->SetRecommendedDisplayGrayscaleValue(grayscale);
448 
449  // Recommended Display CIELab Value (0x0062,0x000D) - Type 1
450  const auto CIELab = ::gdcm::SurfaceHelper::RGBToRecommendedDisplayCIELab(rgb, 1.);
451  surface->SetRecommendedDisplayCIELabValue(CIELab);
452 
453  // Recommended Presentation Opacity (0x0066,0x000C) - Type 1
454  surface->SetRecommendedPresentationOpacity(rgba[3]);
455 
456  // Recommended Presentation Type (0x0066,0x000D) - Type 1
457  surface->SetRecommendedPresentationType(
458  ::fwGdcmIO::helper::DicomDataTools::convertToPresentationType(material->getRepresentationMode()));
459 
460  // Finite Volume (0x0066,0x000E) - Type 1
461  ::fwDataTools::helper::Mesh helperMesh(reconstruction->getMesh());
462  surface->SetFiniteVolume(helperMesh.isClosed() ? (::gdcm::Surface::YES): (::gdcm::Surface::NO));
463 
464  // Manifold (0x0066,0x0010) - Type 1
465  surface->SetManifold(::gdcm::Surface::NO);
466 
467  // Surface Points Sequence (0x0066,0x0011) - Type 1
468  auto pointsSequence =
469  ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x0011 >(surfaceItemDataset);
470 
471  // Create one item
472  ::gdcm::Item pointsItem;
473  pointsItem.SetVLToUndefined();
474 
475  //======================================
476  // Table C.27-2. Points Macro Attributes
477  //======================================
478  {
479  // Number Of Surface Points (0x0066,0x0015) - Type 1
480  surface->SetNumberOfSurfacePoints(surfaceContainer.getPointBufferSize() / 3);
481 
482  // Point Coordinates Data (0x0066,0x0016) - Type 1
483  ::gdcm::DataElement& pointCoordData = surface->GetPointCoordinatesData();
484  pointCoordData.SetByteValue(reinterpret_cast<const char*>(surfaceContainer.getPointBuffer().data()),
485  static_cast<uint32_t>(surfaceContainer.getPointBufferSize()) *
486  static_cast<uint32_t>(sizeof(float)));
487  }
488  pointsSequence->AddItem(pointsItem);
489 
490  // Surface Points Normals Sequence (0x0066,0x0012) - Type 2
491  auto normalsSequence =
492  ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x0012 >(surfaceItemDataset);
493 
494  //=======================================
495  // Table C.27-3. Vectors Macro Attributes
496  //=======================================
497  if (surfaceContainer.getNormalBufferSize() > 0)
498  {
499  // Create one item
500  ::gdcm::Item normalsItem;
501  normalsItem.SetVLToUndefined();
502 
503  // Number Of Vectors (0x0066, 0x001e) - Type 1
504  surface->SetNumberOfVectors(surfaceContainer.getNormalBufferSize() / 3);
505 
506  // Vector Dimensionality (0x0066, 0x001f) - Type 1
507  surface->SetVectorDimensionality(1);
508 
509  // Vector Coordinate Data (0x0066,0x0021) - Type 1
510  ::gdcm::DataElement& normalCoordData = surface->GetVectorCoordinateData();
511  normalCoordData.SetByteValue(reinterpret_cast<const char*>(surfaceContainer.getNormalBuffer().data()),
512  static_cast<uint32_t>(surfaceContainer.getNormalBufferSize()) *
513  static_cast<uint32_t>(sizeof(float)));
514 
515  normalsSequence->AddItem(normalsItem);
516  }
517 
518  // Surface Mesh Primitives Sequence (0x0066,0x0013) - Type 1
519  auto primitivesSequence =
520  ::fwGdcmIO::helper::DicomDataWriter::createAndSetSequenceTagValue< 0x0066, 0x0013 >(surfaceItemDataset);
521 
522  //=======================================================
523  // Table C.27-4. Surface Mesh Primitives Macro Attributes
524  //=======================================================
525  {
526  // Mesh primitive type used by surface writer (fixed to TRIANGLE by FW4SPL)
527  ::gdcm::SmartPointer< ::gdcm::MeshPrimitive > primitive = surface->GetMeshPrimitive();
528  primitive->SetPrimitiveType(::gdcm::MeshPrimitive::TRIANGLE);
529 
530  // Long Triangle Point Index List (0x0066,0x0041) - Type 2
531  ::gdcm::DataElement& pointIndexData = primitive->GetPrimitiveData();
532  pointIndexData.SetVL(sizeof(uint32_t));
533  pointIndexData.SetByteValue(reinterpret_cast<const char*>(surfaceContainer.getCellBuffer().data()),
534  static_cast<uint32_t>(surfaceContainer.getCellBufferSize()) *
535  static_cast<uint32_t>(sizeof(uint32_t)));
536  }
537 
538  //=======================================================
539  // Table 10-19. Algorithm Identification Macro Attributes
540  //=======================================================
541  {
542  // Algorithm Family Code Sequence - Type 1
543  surface->SetAlgorithmFamily(::gdcm::SegmentHelper::BasicCodedEntry("123109", "DCM", "Manual Processing"));
544 
545  // Algorithm Name (0x0066,0x0036) - Type 1
546  surface->SetAlgorithmName("FW4SPL");
547 
548  // Algorithm Version (0x0066,0x0031) - Type 1
549  surface->SetAlgorithmVersion("1");
550  }
551 }
552 
553 //------------------------------------------------------------------------------
554 
555 } // namespace ie
556 } // namespace writer
557 } // namespace fwGdcmIO
#define SPTR(_cls_)
This class defines one surface mesh item in order to transform into DICOM/FW4SPL form.
Contains fwAtomsFilter::registry details.
virtual FWGDCMIO_API void writeSurfaceSegmentationAndSurfaceMeshModules()
Write Surface Segmentation Module tags.
Namespace containing medical data.
FWGDCMIO_API std::size_t getCellBufferSize() const
Return cell buffer size.
InformationEntity base class used to write modules.
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.
FWGDCMIO_API const DicomNormalBufferType & getNormalBuffer() const
Return normal buffer.
FWGDCMIO_API const DicomCellBufferType & getCellBuffer() const
Return cell buffer.
virtual FWGDCMIO_API ~Surface()
Destructor.
std::shared_ptr< ::fwGdcmIO::container::DicomInstance > m_instance
DICOM Instance.
virtual FWGDCMIO_API void writeSOPCommonModule()
Write SOP Common Module tags.
FWGDCMIO_API const DicomPointBufferType & getPointBuffer() const
Return point coordinates buffer.
virtual FWGDCMIO_API void writeSegmentSequence(const std::shared_ptr< const ::fwData::Reconstruction > &reconstruction,::gdcm::Item &segmentItem, const ::gdcm::SmartPointer< ::gdcm::Segment > &segment, unsigned short segmentNumber)
Write Segment Item into Segment Sequence.
static FWGDCMIO_API::gdcm::Segment::BasicCodedEntryVector convertEntryToGDCMCodedAttribute(const std::string &entry)
Convert an entry of the form &#39;(AAA;BBB;CCC)&#39; into GDCM&#39;s BasicCodedEntryVector. Several DicomCodedAtt...
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
std::shared_ptr< ::fwGdcmIO::container::DicomInstance > m_imageInstance
DICOM Image Instance.
#define SLM_TRACE(message)
Definition: spyLog.hpp:228
virtual FWGDCMIO_API void writeSurfaceSequence(const std::shared_ptr< const ::fwData::Reconstruction > &reconstruction,::gdcm::Item &surfaceItem, const ::gdcm::SmartPointer< ::gdcm::Surface > &surface, unsigned short segmentNumber)
Write Surface Item into Surface Sequence.
std::shared_ptr< const ::fwMedData::ModelSeries > m_object
FW4SPL Object.
FWGDCMIO_API bool readSegmentedPropertyRegistryFile(const ::boost::filesystem::path &filepath, bool omitFirstLine=false, const std::shared_ptr< ::fwLog::Logger > &logger=0)
Read an extract registry values from a CSV file Each lines shall contain at least 6 elements : ...
::fwGdcmIO::helper::SegmentedPropertyRegistry m_segmentedPropertyRegistry
Structure Dictionary.
FWGDCMIO_API std::size_t getNormalBufferSize() const
Return normal buffer size.
FWGDCMIO_API Surface(const std::shared_ptr< ::gdcm::Writer > &writer, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &imageInstance, const ::fwMedData::ModelSeries::csptr &series, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
FWGDCMIO_API std::size_t getPointBufferSize() const
Return point coordinates buffer size.
FWGDCMIO_API bool loadSegmentedPropertyRegistry(const ::boost::filesystem::path &filepath)
Load Segmented Property Registry.
static FWGDCMIO_API::gdcm::Surface::VIEWType convertToPresentationType(::fwData::Material::RepresentationType representationMode)
Convert a surface representation mode (FW4SPL) into recommended presentation type (DICOM)...
#define SLM_WARN_IF(message, cond)
Definition: spyLog.hpp:265
Helper to manage Mesh. Lock the mesh buffer before to modify it.