[vtkusers] question about vtkImageReslice speed

Luca Antiga lucantiga at hotmail.com
Thu Jun 13 03:25:55 EDT 2002


Dear Zhang,
if I'm not wrong you look for 3 orthogonal views along the axes of your 
image, so you don't really need to reslice your dataset. I think you should 
better use vtkExtractVOI, or even method CopyAndCastFrom (vtkImageData* 
inData, int extent[6]) in vtkImageData, if you really want to speed up 
things. Of course if you want to obtain a transversal slice, you will need 
to use vtkImageReslice.

Luca

>From: "zhangzhijun" <zjzhang at ee.cuhk.edu.hk>
>To: <vtkusers at public.kitware.com>
>Subject: [vtkusers] question about vtkImageReslice speed
>Date: Wed, 12 Jun 2002 22:50:40 +0800
>
>
>Dear all:
>         I use vtkImageReslice to get the 3 orthogonal views of a 3D image. 
>For axial, sagittal and coronal image I use 3
>imagereslicer to get the image slice respectively. Then I change the image 
>slice index interactively by
>adding or substracting the slice_index_x, slice_index_y and slice_index_z 
>by 1 then use the axial->SetResliceAxesOrigin(0,0,this->slice_index_z) etc 
>functions to refresh the new slice images. there is no problem with the 
>image displayed, the speed for the axial and coronal slices are quite ok 
>when I add or substract the image index by 1, but the speed for the 
>sagittal slice is much more slower then axial and coronal slices. is there 
>any reason for this?  Here is the code segment for this.
>
>void CDeformView::Addactors()
>{
>  axial=vtkImageReslice::New();
>  axial->SetInput(imageData);
>  axial->SetResliceAxesOrigin(0,0,0);
>  axial->SetOutputDimensionality(2);
>  axial->SetOutputSpacing(1,1,voxel_size_z);
>  axial->InterpolateOn();
>  axial->SetResliceAxesDirectionCosines(1, 0, 0,
>                                           0, 1, 0,
>                                           0, 0, 1);
>  axial_mapper=vtkImageMapper::New();
>  axial_mapper->SetInput(axial->GetOutput());
>  axial_mapper->SetColorWindow(255);
>  axial_mapper->SetColorLevel(127.5);
>  vtkActor2D *axial_actor=vtkActor2D::New();
>  axial_actor->SetMapper(axial_mapper);
>  axial_actor->SetPosition(interval,interval);
>  this->Renderer->AddActor(axial_actor);
>
>  sagittal=vtkImageReslice::New();
>  sagittal->SetInput(imageData);
>  sagittal->SetOutputDimensionality(2);
>  sagittal->InterpolateOn();
>  sagittal->SetResliceAxesOrigin(0,0,0);
>  sagittal->SetOutputSpacing(1,1,voxel_size_x);
>  sagittal->SetResliceAxesDirectionCosines(0,0,-1,
>                                                                 0,1,0,
>                                                                 1,0,0);
>  sagittal_mapper = vtkImageMapper::New();
>  sagittal_mapper->SetInput(sagittal->GetOutput());
>  sagittal_mapper->SetColorWindow(255);
>  sagittal_mapper->SetColorLevel(127.5);
>  vtkActor2D *sagittal_actor=vtkActor2D::New();
>  sagittal_actor->SetMapper(sagittal_mapper);
>  sagittal_actor->SetPosition(2*interval+(width-1)*voxel_size_x,interval);
>  this->Renderer->AddActor(sagittal_actor);
>
>
>  coronal=vtkImageReslice::New();
>  coronal->SetInput(imageData);
>  coronal->SetResliceAxesOrigin(0,0,0);
>  coronal->SetOutputDimensionality(2);
>  coronal->InterpolateOn();
>  coronal->SetOutputSpacing(1,1,voxel_size_y);
>  coronal->SetResliceAxesDirectionCosines(1,0,0,
>                                                                 0,0,1,
>                                                                 0,-1,0);
>  coronal_mapper = vtkImageMapper::New();
>  coronal_mapper->SetInput(coronal->GetOutput());
>  coronal_mapper->SetColorWindow(255);
>  coronal_mapper->SetColorLevel(127.5);
>  vtkActor2D *coronal_actor=vtkActor2D::New();
>  coronal_actor->SetMapper(coronal_mapper);
>  
>coronal_actor->SetPosition((depth-1)*voxel_size_z+(width-1)*voxel_size_x+3*interval,
>                          
>interval+((height-1)*voxel_size_y-(depth-1)*voxel_size_z)/2);
>  this->Renderer->AddActor(coronal_actor);
>}
>
>void CDeformView::OnSliceAxialup()
>{
>  this->slice_index_z++;
>  axial->SetResliceAxesOrigin(0,0,this->slice_index_z);
>  this->InvalidateRect(NULL,FALSE);
>}
>
>void CDeformView::OnSliceAxialdown()
>{
>  this->slice_index_z--;
>  axial->SetResliceAxesOrigin(0,0,this->slice_index_z);
>  this->InvalidateRect(NULL,FALSE);
>
>}
>
>void CDeformView::OnSliceSagittalup()
>{
>  this->slice_index_x++;
>  sagittal->SetResliceAxesOrigin(this->slice_index_x,0,0);
>  this->InvalidateRect(NULL,FALSE);
>}
>
>void CDeformView::OnSliceSagittaldown()
>{
>  this->slice_index_x--;
>  sagittal->SetResliceAxesOrigin(this->slice_index_x,0,0);
>  this->InvalidateRect(NULL,FALSE);
>}
>
>void CDeformView::OnSliceCoronalup()
>{
>  this->slice_index_y++;
>  coronal->SetResliceAxesOrigin(0,this->slice_index_y,0);
>  this->InvalidateRect(NULL,FALSE);
>}
>
>void CDeformView::OnSliceCoronaldown()
>{
>  this->slice_index_y--;
>  coronal->SetResliceAxesOrigin(0,this->slice_index_y,0);
>  this->InvalidateRect(NULL,FALSE);
>}
>
>
>regards,
>zhang zhijun


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




More information about the vtkusers mailing list