[vtkusers] vtkimagereslicemapper to get exact slice
chasank
chasank at gmail.com
Fri Mar 7 11:05:35 EST 2014
Hi,
I coded to draw and save rectangle roi as a nifti file. I have no problem of
drawing and saving rectangle roi. After I draw roi on an axial (xy plane)
slice and save it as nifti file with range [0, 1], when I try to display the
saved roi file on renderer, the roi is displayed not only on the slice I
drew but also on the previous slice. In other words, it is displayed on two
consecutive slices. A piece of code that I wrote to display the saved roi:
void Display(vtkImageData *imageData, vtkRenderer *renderer, vtkImageStack
*imageStack, int layerIndex, ORIENTATION_TYPE orientationType)
{
double spacing[3];
imageData->GetSpacing(spacing);
imageResliceMapper->SetInputData(imageData);
imageResliceMapper->SliceFacesCameraOff();
imageResliceMapper->SliceAtFocalPointOff();
imageResliceMapper->SetImageSampleFactor(2);
imageResliceMapper->BorderOn();
imageResliceMapper->BackgroundOn();
double *center = imageData->GetCenter();
vtkPlane *plane = this->imageResliceMapper->GetSlicePlane();
plane->SetOrigin(center);
if(orientationType == ORIENTATION_TYPE::AXIAL)
{
plane->SetNormal(0.0, 0.0, 1.0);
imageResliceMapper->SetSlabThickness(spacing[2]);
}
else if(orientationType == ORIENTATION_TYPE::CORONAL)
{
plane->SetNormal(0.0, 1.0, 0.0);
imageResliceMapper->SetSlabThickness(spacing[1]);
}
else if(orientationType == ORIENTATION_TYPE::SAGITTAL)
{
plane->SetNormal(1.0, 0.0, 0.0);
imageResliceMapper->SetSlabThickness(spacing[0]);
}
imageResliceMapper->UpdateInformation();
imageResliceMapper->Modified();
double windowLevel[2];
histogramRepresentation->SetRenderer(renderer);
histogramRepresentation->SetImageData(imageData);
histogramRepresentation->BuildRepresentation();
histogramRepresentation->GetOptimumWindowLevel(windowLevel);
imageProperty->SetLayerNumber(layerIndex);
imageProperty->SetColorLevel(windowLevel[1]);
imageProperty->SetColorWindow(windowLevel[0]);
imageProperty->SetLookupTable(lookupTable);
imageProperty->SetInterpolationTypeToLinear();
imageProperty->SetAmbient(1.0);
imageProperty->SetDiffuse(1.0);
imageProperty->SetOpacity(1.0);
imageSlice->SetMapper(imageResliceMapper);
imageSlice->SetProperty(imageProperty);
imageSlice->Update();
imageStack->AddImage(imageSlice);
imageStack->Update();
}
I also tried to display saved roi with Osirix and it is displayed well. The
roi is displayed on the slice I drew it. So, there is no problem in creating
roi and saving roi data. Probably, I could not configure
vtkImageResliceMapper with using its necessary methods. So, please guide me
to find where I did the mistake.
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkimagereslicemapper-to-get-exact-slice-tp5726226.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list