[vtkusers] vtkImageReslice
lydia many
vtklydia at hotmail.com
Wed Jan 30 04:11:35 EST 2002
Thank you very much Julio , this is helping me a lot,
>From: "JULIO DANIEL" <judagica at hotmail.com>
>To: vtkusers at public.kitware.com
>Subject: Re: [vtkusers] vtkImageReslice
>Date: Wed, 30 Jan 2002 08:56:50
>
>this a code for vtkimageReslice and vtkImageViewer
>
>good luck.
>
> renAxial = vtkRenderer::New();
> vtkRenderWindow *renWindowAxial = vtkRenderWindow::New();
> renWindowAxial->AddRenderer(renAxial);
> AxialView->SetRenderWindow(renWindowAxial);
>
> renSagittal = vtkRenderer::New();
> vtkRenderWindow *renWindowSagittal = vtkRenderWindow::New();
> renWindowSagittal->AddRenderer(renSagittal);
> SagittalView->SetRenderWindow(renWindowSagittal);
>
> renCoronal = vtkRenderer::New();
> vtkRenderWindow *renWindowCoronal = vtkRenderWindow::New();
> renWindowCoronal->AddRenderer(renCoronal);
> CoronalView->SetRenderWindow(renWindowCoronal);
>
>
>// open volume
> reader = vtkVolume16Reader::New();
> reader->ReleaseDataFlagOff();
>
> reader->SetDataDimensions(x_dimension_volumen,y_dimension_volumen);
>
> reader->SetDataByteOrderToLittleEndian();
>
> reader->SetFilePrefix(path_volume_files);
>
> reader->SetImageRange(z_initial_slice,z_final_slice);
>
> reader->SetDataSpacing
>(x_spacing_volume,y_spacing_volume,z_spacing_volume);
>
> reader->SetDataOrigin(-x_spacing_volume*((x_dimension_volumen-1)/2),
> -y_spacing_volume*((y_dimension_volumen-1)/2),
> -z_spacing_volume*((z_dimension_volumen-1)/2));
>
> reader->SetDataMask(0x7fff);
> reader->UpdateWholeExtent();
>// end of open file
>
>//************************sagittal
>
>// sagittal transform
> sagittal_transform = vtkTransform::New();
> sagittal_transform->RotateX(0);
> sagittal_transform->RotateY(-90);
> sagittal_transform->RotateZ(0);
>// end sagittal transform
>
>// sagittal cut
> sagittal_reslice = vtkImageReslice::New();
> sagittal_reslice->SetInput(reader->GetOutput());
> sagittal_reslice->SetOutputSpacing(1,1,x_spacing_volume);
> sagittal_reslice->SetResliceTransform(sagittal_transform);
> sagittal_reslice->InterpolateOn();
> sagittal_reslice->SetBackgroundLevel(1023);
>//end of sagittal cut
>
>// sagital cut to viewer
> sagittal_viewer = vtkImageViewer::New();
> sagittal_viewer->SetInput(sagittal_reslice->GetOutput());
> sagittal_viewer->SetZSlice(x_dimension_volumen-1);
> sagittal_viewer->SetColorWindow(2000);
> sagittal_viewer->SetColorLevel(1000);
>// end sagital cut to viewer
>
>// assign actor to the sagittal renderer
> renSagittal->AddActor2D(sagittal_viewer->GetActor2D());
>// end assign actor to the sagittal renderer
>
>
>
>
>//*****************************axial
>// axial transform
> axial_transform = vtkTransform::New();
> axial_transform->RotateX(0);
> axial_transform->RotateY(0);
> axial_transform->RotateZ(0);
>// end axial transform
>
>// axial cut
> axial_reslice = vtkImageReslice::New();
> axial_reslice->SetInput(reader->GetOutput());
> axial_reslice->SetOutputSpacing(1,1,z_spacing_volume);
> axial_reslice->SetResliceTransform(axial_transform);
> axial_reslice->InterpolateOn();
> axial_reslice->SetBackgroundLevel(1023);
>// end of axial cut
>
>//axial cut to viewer
> axial_viewer = vtkImageViewer::New();
> axial_viewer->SetInput(axial_reslice->GetOutput());
> axial_viewer->SetZSlice(0);
> axial_viewer->SetColorWindow(2000);
> axial_viewer->SetColorLevel(1000);
>//end of axial cut to viewer
>
>// assign actor to the axial renderer
> renAxial->AddActor2D(axial_viewer->GetActor2D());
>// end assign actor to the axial renderer
>
>
>
>//*****************coronal
>// coronal transform
> coronal_transform = vtkTransform::New();
> coronal_transform->RotateX(-90);
> coronal_transform->RotateY(180);
> coronal_transform->RotateZ(180);
>// end coronal transform
>
>// coronal cut
> coronal_reslice = vtkImageReslice::New();
> coronal_reslice->SetInput(reader->GetOutput());
> coronal_reslice->SetOutputSpacing(1,1,y_spacing_volume);
> coronal_reslice->SetResliceTransform(coronal_transform);
> coronal_reslice->InterpolateOn();
> coronal_reslice->SetBackgroundLevel(1023);
>// end of coronal cut
>
>// axial cut to viewer
> coronal_viewer = vtkImageViewer::New();
> coronal_viewer->SetInput(coronal_reslice->GetOutput());
> coronal_viewer->SetZSlice(y_dimension_volumen-1);
> coronal_viewer->SetColorWindow(2000);
> coronal_viewer->SetColorLevel(1000);
>// axial cut to viewer
>
>// assign actor to the coronal renderer
> renCoronal->AddActor2D(coronal_viewer->GetActor2D());
>// end assign actor to the coronal renderer
>
>
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
_________________________________________________________________
Discutez en ligne avec vos amis, essayez MSN Messenger :
http://messenger.msn.fr
More information about the vtkusers
mailing list