MeVisLab Toolbox Reference
mlDicomToMLTools.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
11//----------------------------------------------------------------------------------
12#pragma once
13
14// Local includes
19#include "mlDicomOverlayTools.h"
22
23// ML includes
24#include <mlModuleIncludes.h>
25
26// DICOM tree prototypes.
27#include <DCMTree_Lib.h>
28
29ML_START_NAMESPACE
30
31// Forwards
32class DicomMessageCollector;
33class ZTUFileNameSet;
34
35namespace DICOMTagTools{
36 struct DicomPaletteInfo;
37}
38
39struct ImageToMultiFileVolumeConversionParameters;
40
41//----------------------------------------------------------------------------------
44//----------------------------------------------------------------------------------
45namespace DicomToMLTools {
46
47 // Forward(s) to internally used classes.
48 class DCMTreeInfo;
49
59
91 const std::string &firstFileName,
92 PagedImage &resultImgProps,
93 FillPageMethods *fillPageMethod,
94 const ZTUFileNameSet *setOfFileHandles,
95 double defaultFillValue,
96 const ImageToMultiFileVolumeConversionParameters &conversionParameters,
97 const std::string &versionString,
98 DicomMessageCollector &dcmMsgCollector);
99
135 double &voxSizeX,
136 double &voxSizeY,
137 double &voxSizeZ,
138 bool replaceOnlyIfFound,
139 bool *isPrecise,
140 std::vector<DCMTree::RawTagId> *usedTags,
141 DicomMessageCollector &dcmMsgCollector);
142
155 PagedImage &pagedImage,
156 const bool adjustToLUTType=false);
157
172 const DICOMTagTools::DicomPaletteInfo &paletteInfo,
173 SubImage &outSubImg);
174
193 PagedImage &pagedImage);
194
222 const SubImage &inSubImg,
223 const double minVoxelValue,
224 const double maxVoxelValue,
225 SubImage &outSubImg);
226
264 const std::string &fileNameUTF8,
265 PagedImage &outInfos,
266 Vector4 &rotAxisAndRadians,
267 Vector3 &ipp,
268 Vector3 &relMRSPositionVector,
269 Vector3 &mrsPositionVector,
270 Vector3 &voiVector,
271 Vector3 &fovVector,
272 bool useOldWorldMatrixCalculation,
273 DicomMessageCollector &dcmMsgCollector);
274
281 const ImageVector &outImgExtent,
282 const DICOMTagTools::SpectComplex *mrsData,
283 size_t spectDataSizeInBytes);
284
290
299 PagedImage &outInfos,
300 DicomMessageCollector &dcmMsgCollector);
301
308 DicomMessageCollector &dcmMsgCollector);
309
323 size_t pixelDataSizeInBytes,
324 ImageVector &imgExt,
325 DicomMessageCollector &dcmMsgCollector);
326
343 ImageVector &imgExt,
344 std::vector<std::string> *cDimInfos,
345 bool overrideBadTagInfos,
346 DicomMessageCollector &dcmMsgCollector);
347
365 PagedImage &outInfos,
366 bool overrideBadTagInfos,
367 DicomMessageCollector &dcmMsgCollector);
368
383 size_t extent[3],
384 double voxelSize[3],
385 MLErrorCode &errCode,
386 DicomMessageCollector &dcmMsgCollector);
387
411 ImageVector &extent,
412 Vector3 &voxelSize,
413 SubImage *subImage,
414 MLErrorCode *errCode,
415 DicomMessageCollector &dcmMsgCollector);
416
427
441
444
446 extern MLDICOM_TO_ML_TOOLS_EXPORT const char * const OutputDataTypeSelectorsStrings[NumOutputDataTypeSelectors];
447
478 const MLDataType inVoxDataType,
479 const SubImageBox &volumeBox,
480 const double inDataRangeMin,
481 const double inDataRangeMax,
482 const OutputDataTypeSelector voxelTypeSelector,
483 const VoxelDoubleOperations operationMode,
484 const PositionSpecificDoubleVector &posDbls,
485 const VoxelDoubleOperations defaultOperationMode,
486 const double defaultOperationDouble,
487 double &resultRangeMin,
488 double &resultRangeMax);
489
492 DCMTreeInfo &dcmTreeInfo);
493
497};
498
499ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDICOM_TO_ML_TOOLS_EXPORT
DLL export macro definition.
Class to collect messages and errors related to a given frame handle.
Small container for statistical information about a DCMTree.
The class PagedImage, representing a fragmented image that manages properties and data of an image lo...
This class manages/represents a rectangular 6D image region that is organized linearly in memory.
Definition mlSubImage.h:75
Class to manage a 3D set of handles describing frames or volumes to be composed to a higher dimension...
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:595
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
Header of FileHandle class which should be used in DICOM importing modules to resolve the filename fo...
A collection of tools related to spectroscopy DICOM tags.
Header file of tool functions for the extraction and handling of information of specific DICOM frames...
Tool class for the min/max value handling from and in DICOM frame sets.
Tool functions for the conversion of DICOM information to ML overlay images.
Collection of tool functions for copy operations from DICOM pixel data to ML SubImages.
boost::shared_ptr< const StructuredMF > Const_StructuredMFPtr
boost::shared_ptr< StructuredMF > StructuredMFPtr
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
std::complex< float > SpectComplex
Define a complex data type to be used for spectroscopy data.
std::vector< PositionSpecificDouble > PositionSpecificDoubleVector
Often used std::vector type of PositionSpecificDouble elements.
FillPageMethods
Methods how to fill a page with data from the DICOM file or tree.
@ FILL_WITH_SPECTROSCOPY_DATA_TAG_DATA
Content of Spectroscopy data tag is copied.
@ FILL_DO_NOT_FILL
Do not fill at all.
@ FILL_WITH_DEFAULT_FILL_VAL
Page is filled with default value.
@ FILL_WITH_IMG_FILE_READER_WO_DICOM
Uses ImgFileReader to read and copy the file, suppress direct DICOM read.
@ FILL_WITH_PIXEL_DATA_TAG_DATA
Content of PixelData tag is copied.
@ FILL_WITH_IMG_FILE_READER
Uses only MFL ImgFileReader to read and copy files, allowing optimized DICOM read.
MLDICOM_TO_ML_TOOLS_EXPORT size_t getVoxelSize(DCMTree::Const_TreePtr treePtr, double &voxSizeX, double &voxSizeY, double &voxSizeZ, bool replaceOnlyIfFound, bool *isPrecise, std::vector< DCMTree::RawTagId > *usedTags, DicomMessageCollector &dcmMsgCollector)
Determine the voxel size from the DICOM tags and returns the number of found extents.
MLDICOM_TO_ML_TOOLS_EXPORT bool isImageFrameNotOfBits(DCMTree::Const_TreePtr treePtr)
Returns true if the DICOM tree seems to describe a sensible image with column and row extents > 1 as ...
VoxelDoubleOperations
Defines some modes how a (voxel) value can be manipulated with a double value.
MLDICOM_TO_ML_TOOLS_EXPORT bool determineImageExtentsFromDCMTree(DCMTree::Const_TreePtr treePtr, ImageVector &imgExt, std::vector< std::string > *cDimInfos, bool overrideBadTagInfos, DicomMessageCollector &dcmMsgCollector)
Update imgExt and - if non nullptr - cDimInfos from treePtr if possible, otherwise they are left unch...
MLDICOM_TO_ML_TOOLS_EXPORT void determineDCMTreeInfo(DCMTree::Const_TreePtr dcmTree, DCMTreeInfo &dcmTreeInfo)
Stores some statistical information from dcmTree in dcmTreeInfo.
MLDICOM_TO_ML_TOOLS_EXPORT MLDataType determineOutputVoxelType(DCMTree::StructuredMFPtr &srcVolumeSMFTree, const MLDataType inVoxDataType, const SubImageBox &volumeBox, const double inDataRangeMin, const double inDataRangeMax, const OutputDataTypeSelector voxelTypeSelector, const VoxelDoubleOperations operationMode, const PositionSpecificDoubleVector &posDbls, const VoxelDoubleOperations defaultOperationMode, const double defaultOperationDouble, double &resultRangeMin, double &resultRangeMax)
Determines a voxel type for an ML output image from some properties of an input image and a set of do...
MLDICOM_TO_ML_TOOLS_EXPORT MLDataType getMLDataTypeFromDCMTree(DCMTree::Const_TreePtr treePtr, DicomMessageCollector &dcmMsgCollector)
Determines the ML data type of pixel data in the given DICOM tree treePtr.
MLDICOM_TO_ML_TOOLS_EXPORT bool applySubImageColorLookUp(const SubImage &inSubImg, const DICOMTagTools::DicomPaletteInfo &paletteInfo, SubImage &outSubImg)
Applies an intensity to color look up from valid region of inSubImg and paletteInfo to outSubImg.
MLDICOM_TO_ML_TOOLS_EXPORT bool hasValidNonImageModality(DCMTree::Const_TreePtr treePtr)
Returns true only if the passed string is a known, non-empty and valid modality string which is a non...
MLDICOM_TO_ML_TOOLS_EXPORT bool applyPhotometricInterpretationToSubImg(DCMTree::Const_TreePtr dcmTree, const SubImage &inSubImg, const double minVoxelValue, const double maxVoxelValue, SubImage &outSubImg)
Applies a color format conversion from input subimage to output subimage according to the photometric...
MLDICOM_TO_ML_TOOLS_EXPORT void convertToImageProperties(DCMTree::StructuredMFPtr &baseSMFPtr, const std::string &firstFileName, PagedImage &resultImgProps, FillPageMethods *fillPageMethod, const ZTUFileNameSet *setOfFileHandles, double defaultFillValue, const ImageToMultiFileVolumeConversionParameters &conversionParameters, const std::string &versionString, DicomMessageCollector &dcmMsgCollector)
Determines as much PagedImage information from baseSMFPtr as possible and.
MLDICOM_TO_ML_TOOLS_EXPORT void getAnyDICOMImageProperties(DCMTree::Const_TreePtr treePtr, PagedImage &outInfos, bool overrideBadTagInfos, DicomMessageCollector &dcmMsgCollector)
Extract as many PagedImage properties from the passed DICOM treePtr as possible.
MLDICOM_TO_ML_TOOLS_EXPORT void getSpectDICOMImageProperties(DCMTree::Const_TreePtr treePtr, const std::string &fileNameUTF8, PagedImage &outInfos, Vector4 &rotAxisAndRadians, Vector3 &ipp, Vector3 &relMRSPositionVector, Vector3 &mrsPositionVector, Vector3 &voiVector, Vector3 &fovVector, bool useOldWorldMatrixCalculation, DicomMessageCollector &dcmMsgCollector)
Extract spectroscopy image properties and some other infos from the passed DICOM tree.
MLDICOM_TO_ML_TOOLS_EXPORT DCMTree::Const_StructuredMFPtr getSMFTreeFromPagedImage(const PagedImage &pImg)
Tries to get the first DICOM image property extension and returns its DCMTree wrapped as Structured M...
MLDICOM_TO_ML_TOOLS_EXPORT bool applyPaletteInfosToPagedImage(const DICOMTagTools::DicomPaletteInfo &paletteInfos, PagedImage &pagedImage, const bool adjustToLUTType=false)
If possible then this function modifies pagedImage according to the settings paletteInfos.
MLDICOM_TO_ML_TOOLS_EXPORT std::string determineREGProperties(DCMTree::Const_TreePtr treePtr, ImageVector &extent, Vector3 &voxelSize, SubImage *subImage, MLErrorCode *errCode, DicomMessageCollector &dcmMsgCollector)
Extract image properties and deformable vector field from a DICOM tree of REG modality and SOP Class ...
OutputDataTypeSelector
Specifies whether the output voxel type shall be adopted when the data is scaled.
@ UseMLuint16
Always use MLuint16 as output type.
@ UseMLint8
Always use MLint8 as output type.
@ UseMLint16
Always use MLint16 as output type.
@ UseMLDouble
Always use double as output type.
@ UseMLuint32
Always use MLuint32 as output type.
@ UseMLint32
Always use MLint32 as output type.
@ Automatic
Adopts the data type such that range and precision is always maintained.
@ NoChange
Do not change the voxel type.
@ UseMLuint8
Always use MLuint8 as output type.
@ UseMLFloat
Always use float as output type.
MLDICOM_TO_ML_TOOLS_EXPORT bool applyPhotometricInterpretationChangesToPagedImage(const DCMTree::Const_TreePtr &dcmTree, PagedImage &pagedImage)
If possible then this function modifies pagedImage according to the photometric interpretation such t...
MLDICOM_TO_ML_TOOLS_EXPORT void checkAndCorrectImageExtentAccordingToPixelData(DCMTree::Const_TreePtr treePtr, size_t pixelDataSizeInBytes, ImageVector &imgExt, DicomMessageCollector &dcmMsgCollector)
Check especially whether the extent of the image given in imgExt is larger by a multiple than the pix...
MLDICOM_TO_ML_TOOLS_EXPORT bool copySpectData(SubImage &outSubImg, const ImageVector &outImgExtent, const DICOMTagTools::SpectComplex *mrsData, size_t spectDataSizeInBytes)
Copies the complex spectroscopy data from mrsData to the output subimage assuming appropriate sizes o...
MLDICOM_TO_ML_TOOLS_EXPORT std::string determineBasicREGProperties(DCMTree::Const_TreePtr treePtr, size_t extent[3], double voxelSize[3], MLErrorCode &errCode, DicomMessageCollector &dcmMsgCollector)
Extract basic image properties from a DICOM tree of REG modality and SOP Class UID "1....
MLDICOM_TO_ML_TOOLS_EXPORT void setWorldMatrixFromDcmTree(DCMTree::Const_TreePtr treePtr, PagedImage &outInfos, DicomMessageCollector &dcmMsgCollector)
If possible all image properties from the DcmTree needed to set up the world matrix are searched and ...
DICOM palette container which is to be used for ML index image to RGB image voxel translation.
Container for all parameters needed to convert a DPL::Image to MultiFileVolume(s).