[vtkusers] Data pipeline between vtkContourFilter and vtkImageMapToColors

Bill Lorensen bill.lorensen at gmail.com
Tue Feb 3 11:33:36 EST 2015


Each contour line has a scalar value associated with it (the iso value
for that line). You just need to create a lookup table for the
polydata mapper that maps the isovalues to the colors you want. No
need to use image blend. Just render the contour lines as polydata.


On Tue, Feb 3, 2015 at 11:21 AM, Iyas Hamdan <iyas.hamdan at gmail.com> wrote:
> Hello vtkusers,
>
> I'm trying to visualize the RT dose on top of a CT image. To do so, I first
> find the iso-dose lines using vktContourFilter which works just fine.
> Then I want to add colors to those iso-lines depending on their value. So I
> creat a lookup table and then ( I think ) I have to map my image through
> this lookup table using vtkImageMapToColors.
> Afterwards, I have to use vtkImageBlend with two mappers as inputs ( one for
> iso-lines and one for the CT image).
>
> So it goes something like this:
>
> vtkSmartPointer<vtkImageMapToColors> DoseColorMapper =
> vtkSmartPointer<vtkImageMapToColors>::New();
> DoseColorMapper->SetInputData(contourFilter->GetOutput());
> DoseColorMapper->SetLookupTable(l_lut);
> DoseColorMapper->SetOutputFormatToRGB();
> /// ... the same for the CT image
> vtkSmartPointer<vtkImageBlend> imgBlender =
> vtkSmartPointer<vtkImageBlend>::New();
>  imgBlender->SetOpacity(0, 0.5);
>  imgBlender->SetOpacity(1, 0.5);
>  imgBlender->AddInputConnection(CtColorMapper->GetOutputPort());
>  imgBlender->AddInputConnection(DoseColorMapper->GetOutputPort());
>
>
>
> The problem is, when I trying doing passing the output of the ContourFilter
> to the mapper I get this error :
> vtkCompositeDataPipeline (037DBD78): Input for connection index 0 on input
> port index 0 for algorithm vtkImageMapToColors(037DBC50) is of type
> vtkPolyData, but a vtkImageData is required.
>
> So my question is, do I have to convert the output of ContourFilter from
> polydata to imagedata ?
> or is there another way around this by giving the mapper an input of type
> polydata ?
>
> any help would be really appreciated.
>
> Thanks in advance
>
> Iyas
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list