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
102 const std::string &firstFileName,
106 double defaultFillValue,
108 const std::string &versionString,
109 bool anonymize,
113 DicomMessageCollector &dcmMsgCollector);
114
150 double &voxSizeX,
151 double &voxSizeY,
152 double &voxSizeZ,
154 bool *isPrecise,
155 std::vector<DCMTree::RawTagId> *usedTags,
156 DicomMessageCollector &dcmMsgCollector);
157
171 const bool adjustToLUTType=false);
172
188 SubImage &outSubImg);
189
209
237 const SubImage &inSubImg,
238 const double minVoxelValue,
239 const double maxVoxelValue,
240 SubImage &outSubImg);
241
279 const std::string &fileNameUTF8,
282 Vector3 &ipp,
288 DicomMessageCollector &dcmMsgCollector);
289
298 size_t spectDataSizeInBytes);
299
305
315 DicomMessageCollector &dcmMsgCollector);
316
323 DicomMessageCollector &dcmMsgCollector);
324
340 DicomMessageCollector &dcmMsgCollector);
341
359 std::vector<std::string> *cDimInfos,
361 DicomMessageCollector &dcmMsgCollector);
362
382 DicomMessageCollector &dcmMsgCollector);
383
398 size_t extent[3],
399 double voxelSize[3],
401 DicomMessageCollector &dcmMsgCollector);
402
426 ImageVector &extent,
427 Vector3 &voxelSize,
430 DicomMessageCollector &dcmMsgCollector);
431
442
456
459
461 extern MLDICOM_TO_ML_TOOLS_EXPORT const char * const OutputDataTypeSelectorsStrings[NumOutputDataTypeSelectors];
462
494 const SubImageBox &volumeBox,
495 const double inDataRangeMin,
496 const double inDataRangeMax,
501 const double defaultOperationDouble,
502 double &resultRangeMin,
503 double &resultRangeMax);
504
508
512};
513
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.
Class which represents an image, which manages properties of an image and image data which is located...
This class manages/represents a rectangular 6d image region which 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:73
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.