comparison Core/DicomParsing/DicomDirWriter.cpp @ 2422:b340f0a9022c

New argument "/.../media?extended" to include additional type-3 tags in DICOMDIR
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 08 Oct 2017 11:46:56 +0200
parents d0fe5ec7eb05
children 878b59270859
comparison
equal deleted inserted replaced
2421:d0fe5ec7eb05 2422:b340f0a9022c
126 namespace Orthanc 126 namespace Orthanc
127 { 127 {
128 class DicomDirWriter::PImpl 128 class DicomDirWriter::PImpl
129 { 129 {
130 private: 130 private:
131 std::string fileSetId_; 131 std::string fileSetId_;
132 TemporaryFile file_; 132 bool extendedSopClass_;
133 TemporaryFile file_;
133 std::auto_ptr<DcmDicomDir> dir_; 134 std::auto_ptr<DcmDicomDir> dir_;
134 135
135 typedef std::pair<ResourceType, std::string> IndexKey; 136 typedef std::pair<ResourceType, std::string> IndexKey;
136 typedef std::map<IndexKey, DcmDirectoryRecord* > Index; 137 typedef std::map<IndexKey, DcmDirectoryRecord* > Index;
137 Index index_; 138 Index index_;
255 CopyString(target, source, encoding, key, true, true); 256 CopyString(target, source, encoding, key, true, true);
256 } 257 }
257 258
258 259
259 public: 260 public:
260 PImpl() : fileSetId_("ORTHANC_MEDIA") 261 PImpl() :
261 { 262 fileSetId_("ORTHANC_MEDIA"),
263 extendedSopClass_(false)
264 {
265 }
266
267 void EnableExtendedSopClass(bool enable)
268 {
269 if (enable)
270 {
271 LOG(WARNING) << "Generating a DICOMDIR with type 3 attributes, "
272 << "which leads to an Extended SOP Class";
273 }
274
275 extendedSopClass_ = enable;
276 }
277
278 bool IsExtendedSopClass() const
279 {
280 return extendedSopClass_;
262 } 281 }
263 282
264 void FillPatient(DcmDirectoryRecord& record, 283 void FillPatient(DcmDirectoryRecord& record,
265 DcmDataset& dicom, 284 DcmDataset& dicom,
266 Encoding encoding) 285 Encoding encoding)
317 /* copy attribute values from dataset to series record */ 336 /* copy attribute values from dataset to series record */
318 CopyStringType1(record, dicom, encoding, DCM_Modality); 337 CopyStringType1(record, dicom, encoding, DCM_Modality);
319 CopyStringType1(record, dicom, encoding, DCM_SeriesInstanceUID); 338 CopyStringType1(record, dicom, encoding, DCM_SeriesInstanceUID);
320 /* use type 1C instead of 1 in order to avoid unwanted overwriting */ 339 /* use type 1C instead of 1 in order to avoid unwanted overwriting */
321 CopyStringType1C(record, dicom, encoding, DCM_SeriesNumber); 340 CopyStringType1C(record, dicom, encoding, DCM_SeriesNumber);
341
342 // Add extended (non-standard) type 3 tags, those are not generated by DCMTK
343 // http://dicom.nema.org/medical/Dicom/2016a/output/chtml/part02/sect_7.3.html
344 // https://groups.google.com/d/msg/orthanc-users/Y7LOvZMDeoc/9cp3kDgxAwAJ
345 if (extendedSopClass_)
346 {
347 CopyStringType3(record, dicom, encoding, DCM_SeriesDescription);
348 }
322 } 349 }
323 350
324 void FillInstance(DcmDirectoryRecord& record, 351 void FillInstance(DcmDirectoryRecord& record,
325 DcmDataset& dicom, 352 DcmDataset& dicom,
326 Encoding encoding, 353 Encoding encoding,
520 547
521 void DicomDirWriter::Encode(std::string& target) 548 void DicomDirWriter::Encode(std::string& target)
522 { 549 {
523 pimpl_->Read(target); 550 pimpl_->Read(target);
524 } 551 }
552
553
554 void DicomDirWriter::EnableExtendedSopClass(bool enable)
555 {
556 pimpl_->EnableExtendedSopClass(enable);
557 }
558
559
560 bool DicomDirWriter::IsExtendedSopClass() const
561 {
562 return pimpl_->IsExtendedSopClass();
563 }
525 } 564 }