[vtkusers] vtkimagereslicemapper to get exact slice

chasank chasank at gmail.com
Thu Mar 13 12:20:48 EDT 2014


Hi,

Here is my code. I suspect that it is not working because of
SliceAtFocalPoint being off. Also, I traverse among slices by changing
planes -not using camera.

void Display(vtkImageData *imageData, vtkRenderer *renderer, vtkImageStack
*imageStack, int layerIndex, ORIENTATION_TYPE orientationType) {
    double spacing[3];
    roiImageData->GetSpacing(spacing);

    imageResliceMapper->SetInputData(roiImageData);
    imageResliceMapper->SliceFacesCameraOff();
    *imageResliceMapper->SliceAtFocalPointOff();*
    imageResliceMapper->JumpToNearestSliceOn();
    imageResliceMapper->SetImageSampleFactor(2);
    imageResliceMapper->BorderOn();
    imageResliceMapper->BackgroundOn();
    imageResliceMapper->UpdateInformation();
    imageResliceMapper->GetSlicePlane()->SetOrigin(basePlane->GetOrigin());
    imageResliceMapper->GetSlicePlane()->SetNormal(basePlane->GetNormal());
    imageResliceMapper->GetSlicePlane()->Modified();
    imageResliceMapper->Modified();

    double window = 1;
    double level = 0.5;

    lookupTable = TMDSmartPointer< vtkLookupTable >::New();
    lookupTable->SetNumberOfTableValues(2);
    lookupTable->Build();
    lookupTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0);
    lookupTable->SetTableValue(1, 1.0, 0.0, 0.0, 1.0);

    imageProperty->SetLayerNumber(layerIndex);
    imageProperty->SetColorLevel(level);
    imageProperty->SetColorWindow(window);
    imageProperty->SetLookupTable(lookupTable.GetPointer());
    imageProperty->SetInterpolationTypeToLinear();
    imageProperty->SetAmbient(1.0);
    imageProperty->SetDiffuse(1.0);
    imageProperty->SetOpacity(0.4);

    imageSlice->SetMapper(imageResliceMapper);
    imageSlice->SetProperty(imageProperty);
    imageSlice->Update();
    imageStack->AddImage(imageSlice);
    imageStack->Update();
}

Best regards,
Chasan



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkimagereslicemapper-to-get-exact-slice-tp5726226p5726300.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list