[vtkusers] vtkimagereslicemapper to get exact slice

David Gobbi david.gobbi at gmail.com
Thu Mar 13 14:41:25 EDT 2014


Hi Chasan,

Another option is to use the vtkImageSliceMapper instead
of the vtkImageResliceMapper.  The vtkImageSliceMapper
always restricts itself to bilinear interpolation.  However,
it's interface is slightly different: it uses SetSliceNumber()
instead of SetSlicePlane().

  David

On Thu, Mar 13, 2014 at 11:15 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Chasan,
>
> Yes, the problem is that JumpToNearestSlice only works if
> SliceAtFocalPoint is on.  That's what the documentation says.
>
> So in order to avoid interpolation between slices, you will have
> to make sure that Origin of your slice plane always lies exactly
> on one of the slices in your data set.
>
>   David
>
> On Thu, Mar 13, 2014 at 10:20 AM, chasank <chasank at gmail.com> wrote:
>> 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.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers


More information about the vtkusers mailing list