MeVisLab Toolbox Reference
mlDicomToMLSubImageCopyParameters.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 #pragma once
12 
13 // Local includes
14 #include "MLDicomToMLToolsSystem.h"
15 
16 // Handle to reference DICOM files or URLS.
18 #include "mlDICOMCachedIOProxies.h"
19 
20 // DICOM tree prototypes.
21 #include <DCMTree_Lib.h>
22 
23 // ML includes
24 #include <mlModuleIncludes.h>
25 
26 ML_START_NAMESPACE
27 
28 // Forwards
29 class DicomMessageCollector;
30 
31 namespace DicomToMLTools {
32 
33 //----------------------------------------------------------------------------------
35 //----------------------------------------------------------------------------------
55  size_t dimIdx;
62 };
63 
64 //----------------------------------------------------------------------------------
67 //----------------------------------------------------------------------------------
69 {
70 public:
74  DCMTree::Const_TreePtr alternativeDCMTreeIn,
75  const bool allowMemoryCompatibleColorModelsIn,
76  SubImage &outSubImgIn,
77  DicomMessageCollector &dcmMsgCollectorIn):
78  cacheProxies(),
79  dcmFileHandle(dcmFileHandleIn),
80  alternativeDCMTree(alternativeDCMTreeIn),
81  allowMemoryCompatibleColorModels(allowMemoryCompatibleColorModelsIn),
82  outSubImg(outSubImgIn),
83  dcmMsgCollector(dcmMsgCollectorIn),
84 
85  results(_validateResults())
86  {}
87 
90 
93 
97 
101 
104 
107 
112 
115  std::vector<boost::shared_array<unsigned char> > fileNameFreeFrameDataCache;
116 
117 private:
120 
123 
127  DICOMPixelReadAndCopyParameterResults _validateResults();
128 
146  MLErrorCode _getDCMTreeAndPixelDataFromFileHandle(DCMTree::Const_TreePtr &dcmTree,
147  DCMTree::PixelData &pixelData,
148  bool &isPixelDataFromMFCache,
149  size_t &pixelDataSize,
150  const DCMTree::MFPixelTag *&mfPixelDataTag);
151 };
152 
153 };
154 
155 ML_END_NAMESPACE
Project global and OS specific declarations.
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
Class to collect messages and errors related to a given frame handle.
Small container storing and validating all input and result parameters needed to copy data from a DCM...
DICOMPixelReadAndCopyParameters(const DICOMCachedIOFileHandle &dcmFileHandleIn, DCMTree::Const_TreePtr alternativeDCMTreeIn, const bool allowMemoryCompatibleColorModelsIn, SubImage &outSubImgIn, DicomMessageCollector &dcmMsgCollectorIn)
Checks input parameters and validates results.isValid to true member if multi-frame parameters are us...
const DICOMCachedIOFileHandle & dcmFileHandle
The handle describing the file or URL from which the DICOM information/tree shall be read.
DicomMessageCollector & dcmMsgCollector
Collects error, info and issue messages (typically related to a handle).
std::vector< boost::shared_array< unsigned char > > fileNameFreeFrameDataCache
A multi-frame pixel data cache for cases where we do not have a file handle and therefore we cannot u...
DCMTree::Const_TreePtr alternativeDCMTree
For the case that no DICOMCachedIOFileHandle exists, because the DCMTree is only in memory,...
const bool allowMemoryCompatibleColorModels
If true then some more color models are allowed whose data formats are compatible but which are not c...
const DICOMPixelReadAndCopyParameterResults results
Set of parameters allowing copying from results settings to outSubImg if results.errCode==ML_RESULT_O...
SubImage & outSubImg
Destination SubImage to be filled with data from the multi-frame pixel tag from dcmTree.
MLDICOMCachedIOProxies cacheProxies
Prevents automatic cache removals during life time of this.
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition: mlSubImage.h:75
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684
MLint32 MLErrorCode
Type of an ML Error code.
Definition: mlTypeDefs.h:818
Header of FileHandle class which should be used in DICOM importing modules to resolve the filename fo...
An instance of this class creates singleton proxies for DICOMCachedIO cache classes such that all cac...
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
Contains pixel data which is either shared/ref counted or a direct pointer.
Definition: DCMTree_Lib.h:105
Container storing parameters needed to copy data from DICOM pixel data into a SubImage.
const DCMTree::MFPixelTag * mfPixelDataTag
The multi-frame pixel data tag from dcmTree, if available, which the data shall be copied into outSub...
bool isDICOMBitImg
True if pixel data is of packed bit image data for example in SEG modality data.
MLDataType srcPixelDataType
ML voxel data type of the pixelData or in mfPixelDataTag if available, otherwise ML_INVALID_DATA_TYPE...
MLint timeUnrollSteps
Number of steps to do if frames located after another shall be copied into the ML time dimension.
bool pixelDataIsAFrameFromMFCache
If true then the data in pixelData is read from a multi-frame cache and not from a normal DCMTree; th...
bool isInterleaved
Describes whether color channel data is packed interleaved as RGB RGB RGB or separated RRR ....
size_t dimIdx
Dimension into which the frames are written, for example 2 for Z, 4 for time, 5 for u.
ImageVector frameShift
Shift vector to move readFrameBox between copy of frame n and frame n+1.
MLErrorCode errorCode
ML_RESULT_OK if data copying is possible, otherwise an error code describing the reason why not.
DCMTree::PixelData pixelData
Pointer to normal 2D pixel data in dcmTree, if available, otherwise nullptr.
DCMTree::Const_TreePtr dcmTree
The dcmTree loaded from the file handle and whose pixel tag contents shall be copied to outSubImg.
SubImageBox readFrameBox
The SubImageBox region in outSubImage where the first frame shall be copied to.