[vtkusers] How ensure the size of an obj vtkImagereSlice?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[vtkusers] How ensure the size of an obj vtkImagereSlice?

Jose Barreto
This post was updated on .
Hello users,

I have a vtkImagereSlice representing a panoramic (with vtkImageResliceMapper-> SetSlabThickness (max_x) active).

At the moment I do object measures with one ruler that implemented (basically the distance of two points transformed into MM).

To fit the vtkImagereSlice within my panel (I use c ++ cli), I I moved the camera doing the calculation to focus on SetParallelScale.



As you can see, the image is the size of the User Monitor (very large), and when I save with vtkRenderLargeImage have to put my surrender to size the image.

How do I figure out the original size of vtkImagereSlice?
Reply | Threaded
Open this post in threaded view
|

Re: [vtkusers] How ensure the size of an obj vtkImagereSlice?

Jose Barreto
This post was updated on .
I could do!
If someone needs done as follows.

this->SuspendLayout();
// save old values of size
int dimensaoNova[2], dimensaoAntiga[2];
dimensaoAntiga[0] = plPanoramica->Size.Width;
dimensaoAntiga[1] = plPanoramica->Size.Height;
// to capture the values of the current monitor DPI
float dpiX, dpiY;
Graphics^ graphics = this->CreateGraphics();
dpiX = graphics->DpiX;d
piY = graphics->DpiY;
delete graphics;

// the value in MM for X
double mmX = abs(GetImageSlice()->GetXRange()[1]);
// the value in MM to Y
double mmY = abs(GetImageSlice()->GetYRange()[1] * GetConnectorItkVtk()->GetOutput()->GetSpacing()[1]);
//MM * dpi / polegada
dimensaoNova[0] = (mmX * dpiX) / 25.4;
dimensaoNova[1] = (mmY * dpiY) / 25.4;

// changes the renderWindow to the new value, remembering that my camera this has focused on the image using ParallelProjectionOn
GetRenderWindow()->SetSize(dimensaoNova);
// Convert a renderWindow to an image
vtkSmartPointer<vtkRenderLargeImage> renderLarge = vtkSmartPointer<vtkRenderLargeImage>::New();
renderLarge->SetInput(GetRenderer2D());
renderLarge->SetMagnification(1);
renderLarge->Update();
// write the image
vtkSmartPointer< vtkBMPWriter>jw = vtkSmartPointer<vtkBMPWriter>::New();
jw->SetInputData(renderLarge->GetOutput());
jw->SetFileName("d:/panoramica.bmp");
jw->Write();
// returns the size values for renderwindow
GetRenderWindow()->SetSize(dimensaoAntiga);

this->ResumeLayout();
Reply | Threaded
Open this post in threaded view
|

Re: [vtkusers] How ensure the size of an obj vtkImagereSlice?

AlphaUniform
Hi there,
could you share your code creating the panoramic view?
I was working for month on this and didn't ever received such a good result.
Did you used the vtkSplineDrivenImageReslicer?

Thank you very much in advance.