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

Method GetImage

IO/Image/vtkVolume16Reader.cxx:211–254  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

209
210//------------------------------------------------------------------------------
211vtkImageData* vtkVolume16Reader::GetImage(int ImageNumber)
212{
213 vtkUnsignedShortArray* newScalars;
214 int* dim;
215 int dimensions[3];
216 vtkImageData* result;
217
218 // Validate instance variables
219 if (this->FilePrefix == nullptr)
220 {
221 vtkErrorMacro(<< "FilePrefix is nullptr");
222 return nullptr;
223 }
224
225 if (this->HeaderSize < 0)
226 {
227 vtkErrorMacro(<< "HeaderSize " << this->HeaderSize << " must be >= 0");
228 return nullptr;
229 }
230
231 dim = this->DataDimensions;
232
233 if (dim[0] <= 0 || dim[1] <= 0)
234 {
235 vtkErrorMacro(<< "x, y dimensions " << dim[0] << ", " << dim[1] << "must be greater than 0.");
236 return nullptr;
237 }
238
239 result = vtkImageData::New();
240 newScalars = vtkUnsignedShortArray::New();
241 this->ReadImage(ImageNumber, newScalars);
242 dimensions[0] = dim[0];
243 dimensions[1] = dim[1];
244 dimensions[2] = 1;
245 result->SetDimensions(dimensions);
246 result->SetSpacing(this->DataSpacing);
247 result->SetOrigin(this->DataOrigin);
248 if (newScalars)
249 {
250 result->GetPointData()->SetScalars(newScalars);
251 newScalars->Delete();
252 }
253 return result;
254}
255
256//------------------------------------------------------------------------------
257// Read a slice of volume data.

Callers 15

BuildRepresentationMethod · 0.45
UpdateReslicePlaneMethod · 0.45
SetResliceParametersMethod · 0.45
CutAndClipMethod · 0.45
GetBoundsMethod · 0.45
ResetMethod · 0.45
InstallPipelineMethod · 0.45
IncrementSliceMethod · 0.45
RenderTextureMethod · 0.45

Calls 7

SetScalarsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
SetDimensionsMethod · 0.45
SetSpacingMethod · 0.45
SetOriginMethod · 0.45
GetPointDataMethod · 0.45

Tested by

no test coverage detected