[vtkusers] question about vtkImageReslice speed

zhangzhijun zjzhang at ee.cuhk.edu.hk
Wed Jun 12 10:50:40 EDT 2002


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020612/a8a14d19/attachment.htm>


More information about the vtkusers mailing list