MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkImageThresholdExecute

Function vtkImageThresholdExecute

Imaging/Core/vtkImageThreshold.cxx:118–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116// This templated function executes the filter for any type of data.
117template <class IT, class OT>
118void vtkImageThresholdExecute(vtkImageThreshold* self, vtkImageData* inData, vtkImageData* outData,
119 int outExt[6], int id, IT*, OT*)
120{
121 vtkImageIterator<IT> inIt(inData, outExt);
122 vtkImageProgressIterator<OT> outIt(outData, outExt, self, id);
123 IT lowerThreshold;
124 IT upperThreshold;
125 int replaceIn = self->GetReplaceIn();
126 OT inValue;
127 int replaceOut = self->GetReplaceOut();
128 OT outValue;
129 IT temp;
130
131 // Make sure the thresholds are valid for the input scalar range
132 if (self->GetLowerThreshold() < inData->GetScalarTypeMin())
133 {
134 lowerThreshold = static_cast<IT>(inData->GetScalarTypeMin());
135 }
136 else
137 {
138 if (self->GetLowerThreshold() > inData->GetScalarTypeMax())
139 {
140 lowerThreshold = static_cast<IT>(inData->GetScalarTypeMax());
141 }
142 else
143 {
144 lowerThreshold = static_cast<IT>(self->GetLowerThreshold());
145 }
146 }
147 if (self->GetUpperThreshold() > inData->GetScalarTypeMax())
148 {
149 upperThreshold = static_cast<IT>(inData->GetScalarTypeMax());
150 }
151 else
152 {
153 if (self->GetUpperThreshold() < inData->GetScalarTypeMin())
154 {
155 upperThreshold = static_cast<IT>(inData->GetScalarTypeMin());
156 }
157 else
158 {
159 upperThreshold = static_cast<IT>(self->GetUpperThreshold());
160 }
161 }
162
163 // Make sure the replacement values are within the output scalar range
164 if (self->GetInValue() < outData->GetScalarTypeMin())
165 {
166 inValue = static_cast<OT>(outData->GetScalarTypeMin());
167 }
168 else
169 {
170 if (self->GetInValue() > outData->GetScalarTypeMax())
171 {
172 inValue = static_cast<OT>(outData->GetScalarTypeMax());
173 }
174 else
175 {

Callers 1

Calls 4

GetScalarTypeMinMethod · 0.80
NextSpanMethod · 0.80
GetScalarTypeMaxMethod · 0.45
IsAtEndMethod · 0.45

Tested by

no test coverage detected