fw4spl
io/fwGdcmIO/src/fwGdcmIO/writer/ie/Equipment.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/writer/ie/Equipment.hpp"
8 
9 #include "fwGdcmIO/helper/DicomDataWriter.hxx"
10 
11 #include <fwMedData/Equipment.hpp>
12 
13 #include <fwRuntime/profile/Profile.hpp>
14 
15 namespace fwGdcmIO
16 {
17 namespace writer
18 {
19 namespace ie
20 {
21 
22 //------------------------------------------------------------------------------
23 
24 Equipment::Equipment(const SPTR(::gdcm::Writer)& writer,
25  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
26  const ::fwMedData::Equipment::csptr& equipment,
27  const ::fwLog::Logger::sptr& logger,
28  ProgressCallback progress,
29  CancelRequestedCallback cancel) :
30  ::fwGdcmIO::writer::ie::InformationEntity< ::fwMedData::Equipment >(writer, instance, equipment,
31  logger, progress, cancel)
32 {
33 }
34 
35 //------------------------------------------------------------------------------
36 
38 {
39 }
40 
41 //------------------------------------------------------------------------------
42 
44 {
45  // Retrieve dataset
46  ::gdcm::DataSet& dataset = m_writer->GetFile().GetDataSet();
47 
48  // Manufacturer - Type 2 (Type 1 for EnhancedGeneralEquipmentModule)
49  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0070 >("FW4SPL", dataset);
50 
51  // Institution Name - Type 3
52  const std::string& institutName = m_object->getInstitutionName();
53  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x0080 >(institutName, dataset);
54 
55  // Software Versions - Type 3 (Type 1 for EnhancedGeneralEquipmentModule)
56  const auto profile = ::fwRuntime::profile::getCurrentProfile();
57  const std::string softwareVersion = profile ? profile->getName() + " " + profile->getVersion() : "Unknown";
58 
59  // We do not use the DicomDataWriter helper as VM might be more than one
60  ::gdcm::Attribute< 0x0018, 0x1020 > attribute;
61  attribute.SetNumberOfValues(1);
62  attribute.SetValue(softwareVersion);
63  dataset.Insert(attribute.GetAsDataElement());
64 }
65 
66 //------------------------------------------------------------------------------
67 
69 {
70  // Retrieve dataset
71  ::gdcm::DataSet& dataset = m_writer->GetFile().GetDataSet();
72 
73  // Manufacturer's Model Name - Type 1
74  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0008, 0x1090 >("FW4SPL_FWGDCMIO", dataset);
75 
76  // Device Serial Number - Type 1
77  std::string deviceSerialNumber = std::string(FWGDCMIO_VER);
78  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0018, 0x1000 >(deviceSerialNumber, dataset);
79 }
80 
81 //------------------------------------------------------------------------------
82 
83 } // namespace ie
84 } // namespace writer
85 } // namespace fwGdcmIO
#define SPTR(_cls_)
Namespace containing medical data.
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 Equipment(const std::shared_ptr< ::gdcm::Writer > &writer, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwMedData::Equipment::csptr &equipment, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
virtual FWGDCMIO_API void writeGeneralEquipmentModule()
Write General Equipment Module tags.
std::shared_ptr< const ::fwMedData::Equipment > m_object
FW4SPL Object.
virtual FWGDCMIO_API void writeEnhancedGeneralEquipmentModule()
Write Enhanced General Equipment Module tags.