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
30
31// Forwards
32class DicomMessageCollector;
33class ZTUFileNameSet;
34
35namespace DICOMTagTools{
36 struct DicomPaletteInfo;
37}
38//----------------------------------------------------------------------------------
41//----------------------------------------------------------------------------------
42namespace DicomToMLTools {
43
44 // Forward(s) to internally used classes.
45 class DCMTreeInfo;
46
56
101 const std::string &firstFileName,
105 double defaultFillValue,
107 const std::string &versionString,
108 bool anonymize,
112 DicomMessageCollector &dcmMsgCollector);
113
149 double &voxSizeX,
150 double &voxSizeY,
151 double &voxSizeZ,
153 bool *isPrecise,
154 std::vector<DCMTree::RawTagId> *usedTags,
155 DicomMessageCollector &dcmMsgCollector);
156
170 const bool adjustToLUTType=false);
171
187 SubImage &outSubImg);
188
208
236 const SubImage &inSubImg,
237 const double minVoxelValue,
238 const double maxVoxelValue,
239 SubImage &outSubImg);
240
278 const std::string &fileNameUTF8,
281 Vector3 &ipp,
287 DicomMessageCollector &dcmMsgCollector);
288
297 size_t spectDataSizeInBytes);
298
304
314 DicomMessageCollector &dcmMsgCollector);
315
322 DicomMessageCollector &dcmMsgCollector);
323
339 DicomMessageCollector &dcmMsgCollector);
340
358 std::vector<std::string> *cDimInfos,
360 DicomMessageCollector &dcmMsgCollector);
361
381 DicomMessageCollector &dcmMsgCollector);
382
397 size_t extent[3],
398 double voxelSize[3],
400 DicomMessageCollector &dcmMsgCollector);
401
425 ImageVector &extent,
426 Vector3 &voxelSize,
429 DicomMessageCollector &dcmMsgCollector);
430
441
455
458
460 extern MLDICOM_TO_ML_TOOLS_EXPORT const char * const OutputDataTypeSelectorsStrings[NumOutputDataTypeSelectors];
461
493 const SubImageBox &volumeBox,
494 const double inDataRangeMin,
495 const double inDataRangeMax,
500 const double defaultOperationDouble,
501 double &resultRangeMin,
502 double &resultRangeMax);
503
507
511};
512
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:596
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
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.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
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...
CalculateMinMaxFromDicomModes
Available selectable DPL configurations.
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 convertToImageProperties(DCMTree::StructuredMFPtr &baseSMFPtr, const std::string &firstFileName, PagedImage &resultImgProps, FillPageMethods *fillPageMethod, const ZTUFileNameSet *setOfFileHandles, double defaultFillValue, CalculateMinMaxFromDicomModes minMaxCalcMode, const std::string &versionString, bool anonymize, bool removePrivateMultiFrameSQTag, bool forceOrthogonalWorldMatrix, bool copyPrivateTopLevelSrcTags, DicomMessageCollector &dcmMsgCollector)
Determines as much PagedImage information from baseSMFPtr as possible and.
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.