[vtkusers] Data pipeline between vtkContourFilter and vtkImageMapToColors

Bill Lorensen bill.lorensen at gmail.com
Fri Feb 6 11:04:08 EST 2015


This example cuts a polydata with planes:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/VisualizationAlgorithms/CutWithCutFunction


On Fri, Feb 6, 2015 at 9:01 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> vtkCutter can be used on the isosurface to produce isolines.
>
> On Fri, Feb 6, 2015 at 8:48 AM, Iyas Hamdan <iyas.hamdan at gmail.com> wrote:
>> Sorry for the late reply,
>> And thanks for the info Bill!
>> I added both actors to the renderer and it worked just fine.
>>
>> Another problem though, since i'm now working with 3D volumes, would
>> ContourFilter still work in this case ?
>> I tested it on 2D images and it works fine but when I try it a 3D imagedata
>> the result is a bit strange.
>>
>> Actually, what I'm looking for is to show the CT volume slice by slice, and
>> I want to show the isolines of the corresponding dose slice  on top of each
>> CT one.
>> But what I got is the whole isosurface shown over all the slices.
>>
>> So my question is, can the ContourFilter be used in my case ?
>> or should I extract slices from my dose volume one by one, find the isolines
>> in each slice then combine them all back in one volume and show this one on
>> top of the CT ?
>>
>> Thanks in advance,
>>
>> Iyas
>>
>> On Tue, Feb 3, 2015 at 5:33 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>>
>>> 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
>>
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list