[vtkusers] resample issue

Jérôme jerome.velut at gmail.com
Wed Dec 2 16:47:44 EST 2009


Hi,
You should be more precise about your problem. I guess you missed a
resample->Update() before setting the input of colorMap, but not for sure.

Jerome

2009/12/2 Karl <bulkmailaddress at gmail.com>

> Hi,
>
> I am attempting unsuccessfully to use vtkImageResample to change the
> spacing
> of an image.
> I have a 3D volume that is being resliced with a vtkImagePlaneWidget.  I am
> then requesting the slice.
> The code works fine until I add this filter, can anyone tell me what I am
> doing wrong.
>
> Thanks
> KB
>
> Code before filter is added (executes with no problem):
> _________________________________________
> vtkSmartPointer<vtkImageData> ImageSliceInfo::GetSliceData(QString
> sliceName)
> {
>        // use vtkImageMapToColors to map to 8-bit for output
>        vtkImageMapToColors* colorMap = vtkImageMapToColors::New();
>        colorMap->PassAlphaToOutputOff();
>        colorMap->SetActiveComponent(0);
>        colorMap->SetOutputFormatToLuminance();
>        colorMap->SetInput(planeWidget->GetResliceOutput());
>        colorMap->SetLookupTable(planeWidget->GetLookupTable());
>
>        vtkSmartPointer<vtkImageData> slice = colorMap->GetOutput();
>
>        colorMap->Delete();
>        return slice;
> }
>
>
>
> Code after filter is added:
> __________________________________________
> vtkSmartPointer<vtkImageData> ImageSliceInfo::GetSliceData()
> {
>        // resample to isotropic spacing
>        vtkImageResample* resample = vtkImageResample::New();
>        resample->SetInput(planeWidget->GetResliceOutput());
>        resample->SetDimensionality(2);
>        resample->SetAxisOutputSpacing(0,1);
>        resample->SetAxisOutputSpacing(1,1);
>
>        // use vtkImageMapToColors to map to 8-bit for output
>        vtkImageMapToColors* colorMap = vtkImageMapToColors::New();
>        colorMap->PassAlphaToOutputOff();
>        colorMap->SetActiveComponent(0);
>        colorMap->SetOutputFormatToLuminance();
>        colorMap->SetInput(resample->GetOutput());
>        colorMap->SetLookupTable(planeWidget->GetLookupTable());
>
>        vtkSmartPointer<vtkImageData> slice = colorMap->GetOutput();
>
>        resample->Delete();
>        colorMap->Delete();
>        return slice;
> }
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091202/9475b458/attachment.htm>


More information about the vtkusers mailing list