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

Method ExecuteInformation

IO/Image/vtkTIFFReader.cxx:378–543  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

376
377//------------------------------------------------------------------------------
378void vtkTIFFReader::ExecuteInformation()
379{
380 this->Initialize();
381 this->ComputeInternalFileName(this->DataExtent[4]);
382 if (this->InternalFileName == nullptr)
383 {
384 vtkErrorMacro("Need to specify a filename");
385 this->SetErrorCode(vtkErrorCode::NoFileNameError);
386 return;
387 }
388
389 if (!this->InternalImage->Open(this->InternalFileName))
390 {
391 vtkErrorMacro("Unable to open file "
392 << this->InternalFileName << " Reason: " << vtksys::SystemTools::GetLastSystemError());
393 this->SetErrorCode(vtkErrorCode::CannotOpenFileError);
394 this->DataExtent[0] = 0;
395 this->DataExtent[1] = 0;
396 this->DataExtent[2] = 0;
397 this->DataExtent[3] = 0;
398 this->DataExtent[4] = 0;
399 this->DataExtent[5] = 0;
400 this->SetNumberOfScalarComponents(1);
401 this->vtkImageReader2::ExecuteInformation();
402 return;
403 }
404
405 // If orientation information is provided, overwrite the value
406 // read from the tiff image
407 if (this->OrientationTypeSpecifiedFlag)
408 {
409 this->InternalImage->Orientation = OrientationType;
410 }
411
412 if (!SpacingSpecifiedFlag)
413 {
414 this->DataSpacing[0] = 1.0;
415 this->DataSpacing[1] = 1.0;
416
417 // If we have some spacing information we use it
418 if (this->InternalImage->ResolutionUnit > 0 && this->InternalImage->XResolution > 0 &&
419 this->InternalImage->YResolution > 0)
420 {
421 if (this->InternalImage->ResolutionUnit == 2) // inches
422 {
423 this->DataSpacing[0] = 25.4 / this->InternalImage->XResolution;
424 this->DataSpacing[1] = 25.4 / this->InternalImage->YResolution;
425 }
426 else if (this->InternalImage->ResolutionUnit == 3) // cm
427 {
428 this->DataSpacing[0] = 10.0 / this->InternalImage->XResolution;
429 this->DataSpacing[1] = 10.0 / this->InternalImage->YResolution;
430 }
431 // Somewhat arbitrary choice of using the X spacing as also the
432 // Z spacing. Used only with image stacks.
433 this->DataSpacing[2] = this->DataSpacing[0];
434 }
435 }

Callers

nothing calls this directly

Calls 7

GetFormatMethod · 0.95
SetDataScalarTypeMethod · 0.80
InitializeMethod · 0.45
OpenMethod · 0.45
CanReadMethod · 0.45

Tested by

no test coverage detected