I would like to render the image with maximum zoom to the full viewport. I am using [
vtkImageResliceViewer which has the same problem as vtkimageViewer2. For the axial image obtained by default i use the following code and i get the image correctly rendered in the center with maximum size. The problem comes when this image is obtained from vtkimagereslice. When i render the image i get a very small image, i only get it in the full viewport if i change the spacing to 1 and i render it twice setting the camera with the following code. I wonder what’s wrong. The spacing, the extent was correct, it is the same i set in the vtkimagereslice.
Someone knows what´s wrong?
The code i use to get the whole viewport is the following: For the axial it works, i only have problems with the resliced images i get with my customized orientation which they have a correct spacing and extent.
//To enlarge the image the whole viewport double origin; image_data->GetOrigin(origin); int extent; image_data->GetExtent(extent); double spacing; image_data->GetSpacing(spacing); camera->ParallelProjectionOn(); double xc = origin + 0.5*(extent + extent)*spacing; double yc = origin + 0.5*(extent + extent)*spacing; double yd = (extent - extent + 1)*spacing; double d = camera->GetDistance(); //degreesToRadians //double viewAngleRadians = 3.1416*(camera->GetViewAngle())/180; //double d = yd / viewAngleRadians; camera->SetParallelScale(0.5f*static_cast<float>(yd)); camera->SetFocalPoint(xc, yc, 0.0); camera->SetPosition(xc, yc, +d);
Thanks in advance