[vtkusers] Re: Texture mapping on a 3D surface.

Jens Ivar Jørdre jensivar at fmri.no
Wed Jun 8 11:50:05 EDT 2005


Hi Goodwin

First, thank you so much for your suggestions. I'm afraid I'm not done 
yet. :)

I tried your suggestion but there was little success. What I find is 
that if I let MR voxel values correspond to cell attribute data then the 
instance of vtkProbeFilter is not able to assign scalars to the points 
in fPolyData. I even tried to assign only 0 values to the cells in 
fTextureData.

Actually let me explain my color mapping here. I define an HSV lookup 
table in the following way:

vtkLookupTable* lut = vtkLookupTable::New();
   lut->SetTableRange(fMin, fMax);
   lut->SetHueRange(0.66, 0.66);
   lut->SetSaturationRange(0., 0.);
   lut->SetValueRange(0., 1.);
   lut->Build();

Here fMin and fMax are the minimum and maximum voxel values in my MR 
image volume. Hence I want the scalar at each point in the poly data set 
to be rendered to map the color value in the range 0 - 1.

Now going back to my attempt to use 0 values for the cell data 
attributes in fTextureData. Even then I get non-zero color values. 
However, if instead of assigning the 0s as cell attributes I assign them 
as point attributes in fTextureData then the color values are zero. That 
is the reason why I think I need to use vtkCellDataToPointData.

I've started to wonder if I need a source object at the start of the 
pipeline, i.e. at the start of the branch that gives the source to the 
instance of vtkProbeFilter. Should I rather us vtkImageImport or 
something similar to that the recursive Update() at rendering time stops 
at a source object?

Kind regards
Jens Ivar Jørdre

Goodwin Lawlor skrev:
> Hi Jens,
> 
> Just try fTextureData as the source to probe...
> 
>  vtkProbeFilter* probe = vtkProbeFilter::New();
>     probe->SetInput(fPolyData);   // My instance of vtkPolyData
>     probe->SetSource(fTextureData);
> 
> probe will interpolate the values at the input points.
> 
> 
> hth
> 
> Goodwin
> 
> 
> ----- Original Message ----- 
> From: "Jens Ivar Jørdre" <jensivar at fmri.no>
> To: "Goodwin Lawlor" <goodwin.lawlor at ucd.ie>; <vtkusers at public.kitware.com>
> Sent: Wednesday, June 08, 2005 3:25 PM
> Subject: Re: [vtkusers] Re: Texture mapping on a 3D surface.
> 
> 
> 
>>Hi Goodwin.
>>
>>I think this is the way to go, although I have some difficulty getting
>>the coloring right. The problem I face comes about when I want to
>>prepare the MR image volume as the source for vtkProbeFilter.
>>
>>When I fill an instance of vtkImageData (called fTextureData) with MR
>>voxel values I guess I should this info as cell attributes, right? I
>>mean the voxel data corresponds to attributes of cells in vtkImage.
>>Hence I fill an instance of vtkFloatArray (called textureArray) with
>>voxel values and call
>>fTextureData->GetCellData()->SetScalars(textureArray);
>>
>>However, the entities whose color I want to determine are points.
>>Therfoe I try to use vtkCellDataToPointData in order to determine the
>>point attributes in fTextureData. The output from this filter I then
>>pipe into vtkProbeFilter. This part of the pipe line looks like this:
>>
>>vtkCellDataToPointData* ctp = vtkCellDataToPointData::New();
>>   ctp->SetInput(fTextureData);
>>   ctp->PassCellDataOn();
>>
>>vtkProbeFilter* probe = vtkProbeFilter::New();
>>   probe->SetInput(fPolyData);   // My instance of vtkPolyData
>>   probe->SetSource(ctp->GetPolyDataOutput());
>>
>>The result of this is that probe complains about the source being empty.
>>  Does anyone see what I'm doing wrong? It kind of looks as if I don't
>>use the vtkCellDataToPointData filter properly.
>>
>>Kind regards
>>Jens Ivar Jørdre
>>
>>Goodwin Lawlor skrev:
>>
>>>Hi Jens,
>>>
>>>Use vtkProbeFilter with your (vtkPolyData) tessellated surface as the
> 
> input
> 
>>>and your (vtkImageData) MR image volume as the source. The output will
> 
> be
> 
>>>the same vtkPolyData as the input with some point scalar values sampled
> 
> from
> 
>>>the source.
>>>
>>>hth,
>>>
>>>Goodwin
>>>
>>>
>>>"Jens Ivar Jørdre" <jensivar at fmri.no> wrote in message
>>>news:42A6ADF7.60600 at fmri.no...
>>>Howdy.
>>>
>>>Here comes a question from someone who quite recently started using VTK
>>>4.2 on Windows XP. So far I've used VTK to visualize a tessellated
>>>surface of the brain  reconstructed from MR images.
>>>
>>>I then want to move on to color the surface in grey tones according to
>>>voxel intensities of the surface points. I first tried to use vtkTexture
>>>to load a (3D) vtkImageData filled with voxel intensities from the MR
>>>image volume. However, since vtkTexture only supports 2D texture maps I
>>>had to give up this effort.
>>>
>>>Then I've tried to assign texture coordinates to the points that define
>>>the tessellated surface, but I see no effect on the surface rendered.
>>>Does anyone have some example for me to look at? I don't find relevant
>>>suggestions in the examples shipped with VTK.
>>>
>>>Kind regards
>>>Jens Ivar Jørdre
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at:
>>>http://www.vtk.org/Wiki/VTK_FAQ
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the 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