MeVisLab Toolbox Reference
mlEnhancedMultiFrameTools.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 
12 #pragma once
13 
14 #include "MLMLToDicomToolsSystem.h"
15 
16 #include <mlModuleIncludes.h>
17 #include <DCMTree_Tree.h>
18 #include <DCMTree_DicomTags.h>
19 #include <DICOMPart16Tables.h>
20 
21 #include <list>
22 
23 ML_START_NAMESPACE
24 
28  std::string sopClassUID;
30  std::string sopInstanceUID;
32  std::string referencedFrameNumber;
36  std::string frameCounter;
38  std::string zCoord;
40  std::string tCoord;
42  std::string uCoord;
43 };
44 
46 typedef std::list< SourceFrameReference > SourceFrameReferenceVector;
47 
57  const Vector2 &pixelSpacing,
58  double sliceThickness,
59  bool addSpacingBetweenSlices=false,
60  double spacingBetweenSlices=1.0);
61 
67  const Vector3 &imagePositionPatient);
68 
74  const Vector6 &imageOrientationPatient);
75 
76 //----------------------------------------------------------------------------------
83 //----------------------------------------------------------------------------------
84 ML_MLToDicomTools_EXPORT void addCIDEntry(const char * const CIDGroupTable[][CIDGroups::NUM_CID_COLUMNS],
85  size_t CIDGroupTableSize,
86  const std::string &entryToAdd,
87  DCMTree::TreePtr itemTree);
88 
106  const std::vector<std::string> &derivationCodeSequence,
107  bool createEmpty=false,
108  const SourceFrameReferenceVector &sourceFrameReferences=SourceFrameReferenceVector(),
109  const size_t entriesToAddZ=std::string::npos,
110  const size_t entriesToAddT=std::string::npos,
111  const size_t entriesToAddU=std::string::npos,
112  const std::string &purposeOfReferenceCodeSequenceEntry="");
113 
129  const MedicalImageProperties &medImgProps,
130  bool setTemporalPositionIndex,
131  bool setFrameAcquisitionDateTime,
132  const unsigned int ztuPos[3],
133  const unsigned int ztuNumFrames[3]);
134 
138 
149  DCMTree::TreePtr dcmTree,
150  bool removeReferencedImageSequence,
151  bool suppressWritingUnassignedContent);
152 
154 typedef std::set<std::pair<std::string, std::string>> StringPairSet;
155 
167  DCMTree::RawTagId sequenceTagId,
168  DCMTree::RawTagId tagId1,
169  DCMTree::RawTagId tagId2,
170  StringPairSet &pairSet);
171 
195  DCMTree::RawTagId inputSequenceTagId,
196  DCMTree::TreePtr dcmTree,
197  DCMTree::RawTagId evidenceSequenceTagId,
198  MLint insertionIndex,
199  bool scanFrames);
200 
204 };
205 
209 
211 struct SegmentInfos {
218 };
219 
226  std::vector<unsigned int> referencedSegmentNumbers;
227 
229  std::vector<SubImageBox> frameBoxes;
230 
232  std::vector<SegmentInfos> segmentInfos;
233 
235  std::vector<std::string> purposeOfReferenceCodeSequence;
236 
247 
249  inline bool empty() const {
250  return referencedSegmentNumbers.empty() && frameBoxes.empty() && segmentInfos.empty();
251  }
252 };
253 
282  const ImageVector &frameHeapImageExtent,
283  const MedicalImageProperties &medicalImageProps,
284  const std::vector<std::string> &derivationCodeSequence=std::vector<std::string>(),
285  const EnhancedMFObjectInfosBase &enhancedMFObjectInfos=EnhancedMFObjectInfosBase(),
287  std::vector<DCMTree::TagPtr> *dicomImageTypeTags=nullptr,
288  std::vector<DCMTree::TagPtr> *dicomImageDescriptionTags=nullptr,
289  bool suppressWritingUnassignedContent=false);
290 
298  const ImageVector &frameHeapImageExtent,
299  const MedicalImageProperties &medicalImageProps);
300 
301 // Forward internally used classes.
302 class DicomSegmentItem;
303 
321  PagedImage &inputPagedImage,
322  ImageVector &imageExtentToAdapt,
323  const std::vector<DicomSegmentItem> &segmentItems,
324  EnhancedMFSEGObjectInfos &enhancedMFSegmentInfos,
325  bool savePaddedPixelData);
326 
331  const ImageVector &inputImageExtent,
332  SourceFrameReferenceVector &sourceFrameReferences);
333 
334 
335 ML_END_NAMESPACE
Tables containing DICOM tables from Part 16.
Project global and OS specific declarations.
#define ML_MLToDicomTools_EXPORT
Only for diagnostic purposes.
Class implementing a segmentation item according to the DICOM Segmentation Image Modul as described i...
This class encapsulates basic medical image properties:
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
boost::shared_ptr< const Tree > Const_TreePtr
Definition: DCMTree_Lib.h:73
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70
unsigned int RawTagId
Definition: DCMTree_Lib.h:147
std::set< std::pair< std::string, std::string > > StringPairSet
Set of string pairs; typically to store unique pairs of DICOM UIDs.
ML_MLToDicomTools_EXPORT void addMultiFrameFunctionalGroups(DCMTree::TreePtr dcmTree, const ImageVector &frameHeapImageExtent, const MedicalImageProperties &medicalImageProps, const std::vector< std::string > &derivationCodeSequence=std::vector< std::string >(), const EnhancedMFObjectInfosBase &enhancedMFObjectInfos=EnhancedMFObjectInfosBase(), DCMTree::Const_TreePtr inputDcmTree=DCMTree::Const_TreePtr(), std::vector< DCMTree::TagPtr > *dicomImageTypeTags=nullptr, std::vector< DCMTree::TagPtr > *dicomImageDescriptionTags=nullptr, bool suppressWritingUnassignedContent=false)
Adds the perFrameFunctionalGroupsSequence and the SharedFunctionalGroupsSequence for.
ML_MLToDicomTools_EXPORT void getUniqueValuePairSetFromSequence(DCMTree::Const_TreePtr dcmTree, DCMTree::RawTagId sequenceTagId, DCMTree::RawTagId tagId1, DCMTree::RawTagId tagId2, StringPairSet &pairSet)
Looks for sequence with sequenceTagId in dcmTree and if found then all items of the sequence are pars...
ML_MLToDicomTools_EXPORT void addUnassignedSharedConvertedAttributes(DCMTree::Const_TreePtr inputDcmTree, DCMTree::TreePtr dcmTree, bool removeReferencedImageSequence, bool suppressWritingUnassignedContent)
Adds the UnassignedSharedFunctionaGroupsSequence and a first entry to dcmTree if they still do not ex...
ML_MLToDicomTools_EXPORT void addMultiFrameDimensionTags(DCMTree::TreePtr dcmTree, const ImageVector &frameHeapImageExtent, const MedicalImageProperties &medicalImageProps)
Adds the perFrameFunctionalGroupsSequence and the SharedFunctionalGroupƶsSequence for the Segmentatio...
ML_MLToDicomTools_EXPORT void setPlaneOrientationFunctionalGroupTags(DCMTree::TreePtr dcmTree, const Vector6 &imageOrientationPatient)
Set DCMTree_PlaneOrientationSequence sequence with tags belonging to Plane Orientation Functional Gro...
std::list< SourceFrameReference > SourceFrameReferenceVector
A Vector of entries which should have at least two entries:
ML_MLToDicomTools_EXPORT void setFrameContentFunctionalGroupTags(DCMTree::TreePtr dcmTree, const MedicalImageProperties &medImgProps, bool setTemporalPositionIndex, bool setFrameAcquisitionDateTime, const unsigned int ztuPos[3], const unsigned int ztuNumFrames[3])
Set DCMTree_FrameContentSequence sequence with tags belonging to Frame Content Functional Group C....
ML_MLToDicomTools_EXPORT std::string addAndSetMultiBinarySEGPixelDataTag(DCMTree::TreePtr resultTree, PagedImage &inputPagedImage, ImageVector &imageExtentToAdapt, const std::vector< DicomSegmentItem > &segmentItems, EnhancedMFSEGObjectInfos &enhancedMFSegmentInfos, bool savePaddedPixelData)
In case of multiple binary segmentations this routine extracts binary segments from the segment list ...
ML_MLToDicomTools_EXPORT void setDerivationImageFunctionalGroupTags(DCMTree::TreePtr seqItemTreePtr, const std::vector< std::string > &derivationCodeSequence, bool createEmpty=false, const SourceFrameReferenceVector &sourceFrameReferences=SourceFrameReferenceVector(), const size_t entriesToAddZ=std::string::npos, const size_t entriesToAddT=std::string::npos, const size_t entriesToAddU=std::string::npos, const std::string &purposeOfReferenceCodeSequenceEntry="")
Set DCMTree_DerivationImageSequence sequence with tags belonging to Derivation Image Functional Group...
ML_MLToDicomTools_EXPORT void setPixelMeasuresFunctionalGroupTags(DCMTree::TreePtr dcmTree, const Vector2 &pixelSpacing, double sliceThickness, bool addSpacingBetweenSlices=false, double spacingBetweenSlices=1.0)
Set DCMTree_PixelMeasuresSequence sequence with tags belonging to Pixel Measures Functional Group C....
ML_MLToDicomTools_EXPORT void removedDuplicatedUnassignedSharedConvertedAttributes(DCMTree::TreePtr dcmTree)
Removes all tags from SharedFunctionalGroupSequence/UnassignedSharedConvertedAttributes which already...
ML_MLToDicomTools_EXPORT void addCIDEntry(const char *const CIDGroupTable[][CIDGroups::NUM_CID_COLUMNS], size_t CIDGroupTableSize, const std::string &entryToAdd, DCMTree::TreePtr itemTree)
Adds the code sequence entry entryToAdd.
ML_MLToDicomTools_EXPORT void buildImageEvidenceSequence(DCMTree::Const_TreePtr inputDcmTree, DCMTree::RawTagId inputSequenceTagId, DCMTree::TreePtr dcmTree, DCMTree::RawTagId evidenceSequenceTagId, MLint insertionIndex, bool scanFrames)
Creates and adds and ImageEvidenceSequence with Tag Id evidenceSequenceTagId to dcmTree and fills it ...
ML_MLToDicomTools_EXPORT void setPlanePositionFunctionalGroupTags(DCMTree::TreePtr dcmTree, const Vector3 &imagePositionPatient)
Set DCMTree_PlanePositionSequence sequence with tags belonging to Segmentation Functional Group C....
ML_MLToDicomTools_EXPORT void getSourceImageSequenceInformation(DCMTree::Const_TreePtr inputDcmTree, const ImageVector &inputImageExtent, SourceFrameReferenceVector &sourceFrameReferences)
Analyzes the inputDcmTree and extracts a SourceFrameReference entry for each input frame given by inp...
Currently empty class used as base for all classes carrying additional IOD object information.
Structure providing SEG IOD specific information for and about composed BitImage Frame heap to be sav...
std::vector< SubImageBox > frameBoxes
A vector of SubImageBoxes for all frames.
bool empty() const
Returns true if all vectors are empty which indicates that its shall not be used at all.
SourceFrameReferenceVector sourceFrameReferenceVector
A vector of vectors of (SOPClassUIDs, SOPInstanceUID, ReferencedFrameNumber, ReferencedSegmentNumber)...
std::vector< SegmentInfos > segmentInfos
A vector of SegmentInfos; one info for each segment.
std::vector< unsigned int > referencedSegmentNumbers
Vector of referenced Segment number to indicate which segment number is related to a given frame of a...
std::vector< std::string > purposeOfReferenceCodeSequence
Code sequence to be used in Source Image Sequence if that sequence is filled.
Structure providing additional (IOD specific) information for Legacy Converted Enhanced MR; still not...
Structure providing SEG IOD specific information for and about composed BitImage Frame heap to be sav...
SubImageBox box
The subimage box of the segment in voxel position related to the inputPagedImage.
MLint segmentFrames
The number of frames in the Enhanced multi-frame Heap of frames unrolled in the z-dimension.
MLint startFrame
The index of the first frame in the Enhanced multi-frame Heap of frames unrolled in the z-dimension.
Structure to collect important information of input frames.
std::string referencedFrameNumber
ReferencedFrameNumber.
std::string referencedSegmentNumber
ReferencedSegmentNumber.
std::string sopInstanceUID
SOPInstanceClassUID of an input frame or image.
std::string sopClassUID
SOPClassUID of an input frame or image.
std::string frameCounter
Frame Counter.