MeVisLab Toolbox Reference
mlMultiFileVolumeListImageOutput.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
12*/
13//----------------------------------------------------------------------------------
14#pragma once
15
17
18// Overlay handling stuff.
19#include <mlDicomToMLTools.h>
20
21ML_START_NAMESPACE
22
23// Forward to internally used classes.
24class MultiFileVolume;
25
26//----------------------------------------------------------------------------------
29//----------------------------------------------------------------------------------
31{
32public:
33
43 int numOutputs=2,
44 bool autoInstallTagDumpFieldAddOn=true,
45 bool installInputAccessConnector=true,
46 bool installInputMessageFilterPlugin=true,
47 bool installOutputAccessConnector=true);
48
50
51public:
52
56 void updateToVolume(MultiFileVolume *outVolToUse) override;
57
58protected:
59
61 void calculateOutputImageProperties (int outIndex, PagedImage* outImg) override;
62
66
72 void calculateOutputSubImage (SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override;
73
79
80protected:
84 IntField *extFld[6] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
85
88
91
94
97
100 void addFields(Module &mod, const std::string suffix = "")
101 {
102 extFld[0] = mod.addInt( (std::string("extX" )+suffix).c_str(), 0);
103 extFld[1] = mod.addInt( (std::string("extY" )+suffix).c_str(), 0);
104 extFld[2] = mod.addInt( (std::string("extZ" )+suffix).c_str(), 0);
105 extFld[3] = mod.addInt( (std::string("extC" )+suffix).c_str(), 0);
106 extFld[4] = mod.addInt( (std::string("extT" )+suffix).c_str(), 0);
107 extFld[5] = mod.addInt( (std::string("extU" )+suffix).c_str(), 0);
108 numVolVoxelsFld = mod.addInt( (std::string("numVolVoxels")+suffix).c_str(), 0);
109 dataTypeFld = mod.addString((std::string("dataType" )+suffix).c_str(), "");
110 minVoxelValueFld = mod.addDouble((std::string("minVoxVal" )+suffix).c_str(), 0);
111 maxVoxelValueFld = mod.addDouble((std::string("maxVoxVal" )+suffix).c_str(), 0);
112 }
113
114 void readAndSetFromPagedImage(const PagedImage *pagedImage)
115 {
116 // Extract data from volume.
117 ImageVector ext(0);
118 std::string dtString;
119 MLdouble minVoxVal = 0;
120 MLdouble maxVoxVal = 0;
121
122 if (pagedImage){
123 // Get image information if there is any.
124 ext = pagedImage->getImageExtent();
125 dtString = MLDataTypeNames()[pagedImage->getDataType()];
126 minVoxVal = pagedImage->getMinVoxelValue();
127 maxVoxVal = pagedImage->getMaxVoxelValue();
128 }
129
130 // Update fields to information about current volume.
131 extFld[0] ->setIntValue(ext.x);
132 extFld[1] ->setIntValue(ext.y);
133 extFld[2] ->setIntValue(ext.z);
134 extFld[3] ->setIntValue(ext.c);
135 extFld[4] ->setIntValue(ext.t);
136 extFld[5] ->setIntValue(ext.u);
137 numVolVoxelsFld ->setIntValue(ext.compMul());
138 dataTypeFld ->setStringValue(dtString);
139 minVoxelValueFld ->setDoubleValue(minVoxVal);
140 maxVoxelValueFld ->setDoubleValue(maxVoxVal);
141 }
142 };
143
144private:
145
147 void _initializeFieldsAndMembers();
148
151
153 OutputImageProperties _imageOutput0Properties;
154
157 NotifyField *_updateImageOutputInformationDoneFld;
159
162
165
166};
167
168ML_END_NAMESPACE
#define MLDIRECTDICOMIMPORTOUTPUTS_EXPORT
DLL export macro definition.
IntField * addInt(const char *name)
Creates an IntField with name and adds it to the container. Default value is 0.
DoubleField * addDouble(const char *name)
Creates a DoubleField with name and adds it to the container. Default value is 0.
StringField * addString(const char *name)
Creates a StringField with name and adds it to the container. Default value is empty string.
MLdouble getMaxVoxelValue() const
Returns the assumed maximum value in data.
MLDataType getDataType() const
Returns the data type of the image.
ImageVector getImageExtent() const
Returns the extent of the (sub)image.
MLdouble getMinVoxelValue() const
Returns the assumed minimum value in data.
MultiFileVolumeListBaseOutput(int numInputs=0, int numOutputs=0, bool autoInstallTagDumpFieldAddOn=true, bool installInputAccessConnector=true, bool installInputMessageFilterPlugin=true, bool installOutputAccessConnector=true)
void calculateOutputImageProperties(int outIndex, PagedImage *outImg) override
Sets properties of the output image at output outIndex.
void updateToVolume(MultiFileVolume *outVolToUse) override
void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override
virtual void fillOutSubImageFromMultiFileVolume(SubImage outSubImg)
MultiFileVolumeListImageOutput(int numInputs=0, int numOutputs=2, bool autoInstallTagDumpFieldAddOn=true, bool installInputAccessConnector=true, bool installInputMessageFilterPlugin=true, bool installOutputAccessConnector=true)
void _updateVolumeInformation(MultiFileVolume *currVol) override
ComponentType c
Color component of the vector.
ComponentType t
Time component of the vector.
ComponentType u
Unit/Modality/User component of the vector.
ComponentType z
Z component of the vector.
ComponentType x
X component of the vector.
ComponentType y
Y component of the vector.
ComponentType compMul() const
Returns the product of all components. There is no check for integer overflow.
#define ML_MODULE_CLASS_HEADER(className)
MLEXPORT const char *const * MLDataTypeNames()
Provides the base class for an additional output for a MultiFileVolumeList module.
double MLdouble
Definition mlTypeDefs.h:216
std::vector< FrameSpecificTags > FrameSpecificTagsVector
Often used std::vector type of FrameSpecificTag elements.
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.
Helper container to manage fields related to an image output.
IntField * numVolVoxelsFld
Shows the number of voxels of the current volume, default is 0.
StringField * dataTypeFld
String field containing the voxel data type of the currently selected volume, default is "".
IntField * extFld[6]
Image extent of the currently selected volume, defaults are 0.
DoubleField * maxVoxelValueFld
This read-only field shows the maximum voxel value in the currently selected volume,...
void readAndSetFromPagedImage(const PagedImage *pagedImage)
Reads field contents from pagedImage if that one is not nullptr, otherwise the field values are reset...
DoubleField * minVoxelValueFld
This read-only field shows the minimum voxel value in the currently selected volume,...