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

Method UpdateDisplayExtent

Interaction/Image/vtkImageViewer2.cxx:329–394  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

327
328//------------------------------------------------------------------------------
329void vtkImageViewer2::UpdateDisplayExtent()
330{
331 vtkAlgorithm* input = this->GetInputAlgorithm();
332 if (!input || !this->ImageActor)
333 {
334 return;
335 }
336
337 input->UpdateInformation();
338 vtkInformation* outInfo = input->GetOutputInformation(0);
339 int* w_ext = outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
340
341 // Is the slice in range ? If not, fix it
342
343 int slice_min = w_ext[this->SliceOrientation * 2];
344 int slice_max = w_ext[this->SliceOrientation * 2 + 1];
345 if (this->Slice < slice_min || this->Slice > slice_max)
346 {
347 this->Slice = static_cast<int>((slice_min + slice_max) * 0.5);
348 }
349
350 // Set the image actor
351
352 switch (this->SliceOrientation)
353 {
354 case vtkImageViewer2::SLICE_ORIENTATION_XY:
355 this->ImageActor->SetDisplayExtent(
356 w_ext[0], w_ext[1], w_ext[2], w_ext[3], this->Slice, this->Slice);
357 break;
358
359 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
360 this->ImageActor->SetDisplayExtent(
361 w_ext[0], w_ext[1], this->Slice, this->Slice, w_ext[4], w_ext[5]);
362 break;
363
364 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
365 this->ImageActor->SetDisplayExtent(
366 this->Slice, this->Slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5]);
367 break;
368 }
369
370 // Figure out the correct clipping range
371
372 if (this->Renderer)
373 {
374 if (this->InteractorStyle && this->InteractorStyle->GetAutoAdjustCameraClippingRange())
375 {
376 this->Renderer->ResetCameraClippingRange();
377 }
378 else
379 {
380 vtkCamera* cam = this->Renderer->GetActiveCamera();
381 if (cam)
382 {
383 double bounds[6];
384 this->ImageActor->GetBounds(bounds);
385 double spos = bounds[this->SliceOrientation * 2];
386 double cpos = cam->GetPosition()[this->SliceOrientation];

Callers 4

SetSliceMethod · 0.95
SetSliceOrientationMethod · 0.95
SetInputDataMethod · 0.95
SetInputConnectionMethod · 0.95

Calls 10

GetInputAlgorithmMethod · 0.95
SetDisplayExtentMethod · 0.80
GetActiveCameraMethod · 0.80
UpdateInformationMethod · 0.45
GetOutputInformationMethod · 0.45
GetMethod · 0.45
GetBoundsMethod · 0.45
GetPositionMethod · 0.45
SetClippingRangeMethod · 0.45

Tested by

no test coverage detected