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

Method ComputeTransformedBounds

IO/Image/vtkVolume16Reader.cxx:503–548  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

501
502//------------------------------------------------------------------------------
503void vtkVolume16Reader::ComputeTransformedBounds(int bounds[6])
504{
505 double transformedBounds[4];
506
507 if (!this->Transform)
508 {
509 bounds[0] = 0;
510 bounds[1] = this->DataDimensions[0] - 1;
511 bounds[2] = 0;
512 bounds[3] = this->DataDimensions[1] - 1;
513 bounds[4] = 0;
514 bounds[5] = this->ImageRange[1] - this->ImageRange[0];
515 }
516 else
517 {
518 transformedBounds[0] = 0;
519 transformedBounds[1] = 0;
520 transformedBounds[2] = 0;
521 transformedBounds[3] = 1.0;
522 this->Transform->MultiplyPoint(transformedBounds, transformedBounds);
523 bounds[0] = (int)transformedBounds[0];
524 bounds[2] = (int)transformedBounds[1];
525 bounds[4] = (int)transformedBounds[2];
526 transformedBounds[0] = this->DataDimensions[0] - 1;
527 transformedBounds[1] = this->DataDimensions[1] - 1;
528 transformedBounds[2] = this->ImageRange[1] - this->ImageRange[0];
529 transformedBounds[3] = 1.0;
530 this->Transform->MultiplyPoint(transformedBounds, transformedBounds);
531 bounds[1] = (int)transformedBounds[0];
532 bounds[3] = (int)transformedBounds[1];
533 bounds[5] = (int)transformedBounds[2];
534 // put bounds in correct order
535 int tmp;
536 for (int i = 0; i < 6; i += 2)
537 {
538 if (bounds[i + 1] < bounds[i])
539 {
540 tmp = bounds[i];
541 bounds[i] = bounds[i + 1];
542 bounds[i + 1] = tmp;
543 }
544 }
545 vtkDebugMacro(<< "Transformed bounds are: " << bounds[0] << ", " << bounds[1] << ", "
546 << bounds[2] << ", " << bounds[3] << ", " << bounds[4] << ", " << bounds[5]);
547 }
548}
549
550//------------------------------------------------------------------------------
551void vtkVolume16Reader::AdjustSpacingAndOrigin(

Callers 1

Calls 1

MultiplyPointMethod · 0.45

Tested by

no test coverage detected