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 
21 ML_START_NAMESPACE
22 
23 // Forward to internally used classes.
24 class MultiFileVolume;
25 
26 //----------------------------------------------------------------------------------
29 //----------------------------------------------------------------------------------
31 {
32 public:
33 
43  int numOutputs=2,
44  bool autoInstallTagDumpFieldAddOn=true,
45  bool installInputAccessConnector=true,
46  bool installInputMessageFilterPlugin=true,
47  bool installOutputAccessConnector=true);
48 
50 
51 public:
52 
56  void updateToVolume(MultiFileVolume *outVolToUse) override;
57 
58 protected:
59 
61  void calculateOutputImageProperties (int outIndex, PagedImage* outImg) override;
62 
66 
72  void calculateOutputSubImage (SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override;
73 
78  void _updateVolumeInformation(MultiFileVolume *currVol) override;
79 
80 protected:
84  IntField *extFld[6] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
85 
87  IntField *numVolVoxelsFld = nullptr;
88 
90  StringField *dataTypeFld = nullptr;
91 
93  DoubleField *minVoxelValueFld = nullptr;
94 
96  DoubleField *maxVoxelValueFld = nullptr;
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  }
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 
144 private:
145 
147  void _initializeFieldsAndMembers();
148 
151 
153  OutputImageProperties _imageOutput0Properties;
154 
157  NotifyField *_updateImageOutputInformationDoneFld;
159 
162 
165 
166 };
167 
168 ML_END_NAMESPACE
#define MLDIRECTDICOMIMPORTOUTPUTS_EXPORT
DLL export macro definition.
Field to encapsulate a double value.
Definition: mlFields.h:806
void setDoubleValue(double doubleValue)
Set field value to doubleValue. By default the entire double type range can be set.
DoubleField * addDouble(const char *name)
Creates a DoubleField with name and adds it to the container. Default value is 0.
IntField * addInt(const char *name)
Creates an IntField 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.
Field to encapsulate an integer value.
Definition: mlFields.h:161
void setIntValue(MLint intValue)
Sets field value to intValue.
Base class for an image processing module of the ML.
Definition: mlModule.h:156
The ML module base class MultiFileVolumeListBaseOutput used to implement further output modules for t...
The ML module class MultiFileVolumeListImageOutput for extending the number of image outputs of Multi...
void calculateOutputImageProperties(int outIndex, PagedImage *outImg) override
Sets properties of the output image at output outIndex.
void updateToVolume(MultiFileVolume *outVolToUse) override
Updates image outputs and internal pointer to the passed MultiFileVolume.
void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs) override
Calculates page outSubImg of output image with index outIndex by using inSubimgs.
virtual void fillOutSubImageFromMultiFileVolume(SubImage outSubImg)
Fill outSubImg with data from MultiFileVolumeListBaseOutput::getCurrentlySetVolume() which is expecte...
MultiFileVolumeListImageOutput(int numInputs=0, int numOutputs=2, bool autoInstallTagDumpFieldAddOn=true, bool installInputAccessConnector=true, bool installInputMessageFilterPlugin=true, bool installOutputAccessConnector=true)
Constructor.
void _updateVolumeInformation(MultiFileVolume *currVol) override
This is called by the super class if the volume has changed.
Management class used by DirectDicomImport to create, represent and describe volumes composed of mult...
Field without value for notifications.
Definition: mlFields.h:1049
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
Field to encapsulate a string value.
Definition: mlFields.h:1000
void setStringValue(const std::string &stringValue) override
Sets value of the field to stringValue.
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition: mlSubImage.h:75
ComponentType c
Color component of the vector.
Definition: mlImageVector.h:65
ComponentType t
Time component of the vector.
Definition: mlImageVector.h:67
ComponentType u
Unit/Modality/User component of the vector.
Definition: mlImageVector.h:69
ComponentType z
Z component of the vector.
Definition: mlImageVector.h:63
ComponentType x
X component of the vector.
Definition: mlImageVector.h:59
ComponentType y
Y component of the vector.
Definition: mlImageVector.h:61
ComponentType compMul() const
Returns the product of all components. There is no check for integer overflow.
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
MLEXPORT const char *const * MLDataTypeNames()
Function which returns the table of c-strings of all scalar and registered data types.
Tool class with many tool functions for the conversion of DICOM information and tag values to compara...
Provides the base class for an additional output for a MultiFileVolumeList module.
double MLdouble
Definition: mlTypeDefs.h:223
std::vector< FrameSpecificTags > FrameSpecificTagsVector
Often used std::vector type of FrameSpecificTag elements.
Helper container to manage fields related to an image output.
void readAndSetFromPagedImage(const PagedImage *pagedImage)
Reads field contents from pagedImage if that one is not nullptr, otherwise the field values are reset...
void addFields(Module &mod, const std::string suffix="")
Create fields and add their pointers for field container of mod; suffix is appended to all field name...