[vtkusers] voxel values in vtkImageData

Lisa Avila lisa.avila at kitware.com
Mon May 10 14:00:36 EDT 2004


Hello Tuhin,

If you want a new algorithm to be applied during ray casting, you should 
write a subclass of vtkVolumeRayCastFunction (there are three in VTK - one 
for maximum intensity, one for compositing and one for surface rendering - 
you can imaging writing a new one for averaging for example). Unless you 
need to change how the rays are cast (they are cast according to the 
current camera settings) then you should not need to change the volume ray 
cast mapper itself.

Lisa


At 03:44 PM 5/7/2004, Tuhin Sinha wrote:
>I have a question related to the VolumeMapper architecture in VTK.  A
>couple weeks ago I tried to write a surface projection volume mapper to
>no avail.  Basically, all I want to do is ray-cast until I hit the
>surface then average some sub-surface voxels to get the intensity I want
>projected.  The results I got lead me to believe that the ray caster
>only casts rays in orthogonal directions to the volume.  Is this true?
>If so, are there any ideas on how to implement a surface projection
>algorithm in the current ray cast architecture? Or, where can I modify
>the ray caster to project rays orthogonal to the view-plane?  Thanks for
>your time.
>
>Tuhin Sinha
>
>On Fri, 2004-05-07 at 14:27, Thomas Faust wrote:
> > Thank you for the explanation.
> > (The volume pro mapper drops out because we can't expect that every of our
> > users has the propper hardware)
> >
> > When I do the 'linear interpolation' with the ray cast mapper, my model
> > disappears. I have no idea why. When I switch back to 'nearest 
> interpolation'
> > it reappears.
> >
> > Has somebody changed the texture volume mapper before to handle image data
> > with 'nearest interpolation'?
> > What would these changes be?
> >
> > Tom
> >
> > On Friday 07 May 2004 02:26 pm, you wrote:
> > > Hello Thomas,
> > >
> > > No - it is not useless - it is just not used by every mapper. The ray 
> cast
> > > mapper can do either. I believe the VolumePro mapper only does one 
> (linear)
> > > because at the time the mapper was written nearest was unstable. The
> > > texture mapper only does linear but it not a hard change to make it do
> > > nearest as well.
> > >
> > > Lisa
> > >
> > > At 11:39 AM 5/7/2004, Thomas Faust wrote:
> > > >Does this mean, the interpolation type in vtkVolumeProperty (nearest vs.
> > > >linear) is useless? It only depends on the mapper I use?
> > > >
> > > >On Friday 07 May 2004 10:24 am, you wrote:
> > > > > Hello Thomas,
> > > > >
> > > > > Please keep in mind that the vtkVolumeRayCastMapper does nearest
> > > > > neighbor sampling, but the vtkVolumeTextureMapper2D does not (it does
> > > > > bilinear in two dimensions).
> > > > >
> > > > > Lisa
> > > > >
> > > > > At 06:55 PM 5/6/2004, Thomas Faust wrote:
> > > > > > >There is no way to get around that, apart from...
> > > > > >
> > > > > >There is... The last think I would do and the last thing I want 
> to do
> > > > > > is to write my own vtkVolumeMapper, that handles vtkImageData 
> like I
> > > > > > want. I did the same with vtkPicker before. I was writing my own,
> > > > > > that runs a ray through voxels using the 'voxel traversal 
> algorithm'.
> > > > > > I made major changes in vtkRenderWindow and 
> vtkRenderWindowInteractor
> > > > > > to implement it my out GUI. But, this would really be the last 
> thing
> > > > > > if no workaound would help.
> > > > > >
> > > > > > > If you zero-pad your image out to 5x5x5 you might be able to make
> > > > > > > it display a cross the way that you want.
> > > > > >
> > > > > >Thanks for this advice. I'll give it a try by tomorrow. My 
> coffee pot
> > > > > > went empty ;-)
> > > > > >
> > > > > >Thomas
> > > > > >
> > > > > >On Thursday 06 May 2004 06:40 pm, you wrote:
> > > > > > > Hi Thomas,
> > > > > > >
> > > > > > > The 3-voxels-are-2-voxels-wide problem is something that you 
> can't
> > > > > > > get away from in VTK, since as you stated below, VTK treats a
> > > > > > > vtkImageData as a set of points.  There is no way to get around
> > > > > > > that, apart from using a vtkUnstructuredGrid made of voxels which
> > > > > > > would be extremely inefficient. The vtkImageActor has the same
> > > > > > > behaviour as vtkVolume in this regard.
> > > > > > >
> > > > > > > Turning off interpolation, though, should at least eliminate the
> > > > > > > unwanted blending that you were seeing.
> > > > > > > If you zero-pad your image out to 5x5x5 you might be able to make
> > > > > > > it display a cross the way that you want.
> > > > > > >
> > > > > > >  - David
> > > > > > >
> > > > > > > On Thu, 6 May 2004, Thomas Faust wrote:
> > > > > > > > Thanks David, but this doesn't solve my problem at all.
> > > > > > > >
> > > > > > > > I was changing the interpolation method back and for, but the
> > > > > > > > output didn't changed.
> > > > > > > >
> > > > > > > > I'm not dealing with values that are defined on the gridpoints;
> > > > > > > > my values are the voxel itself.
> > > > > > > >
> > > > > > > > I'll give you (David and all out there) an example:
> > > > > > > > My matrix is 3x3x3 with the values: 000 010 000 - 010 111 010 -
> > > > > > > > 000 010 000 Do I expect to much brain grease if i would ask you
> > > > > > > > to picture this values in your imagination in 3D? Right, 
> this is
> > > > > > > > an 3D cross. But, if this is my vtkImageData I'll get a volume,
> > > > > > > > that is just 2 voxels in each direction. Please give it a try.
> > > > > > > > (I'll at the 15 line source code if you want me to)
> > > > > > > >
> > > > > > > > What I'd like to see as an output is an volume, that comes with
> > > > > > > > 27 (3x3x3) voxel. This means that this volume would have 64
> > > > > > > > (4x4x4) gridpoints. What I told about interpolation is, that i
> > > > > > > > can't interpolate these 64 gridpoints out of the 27 values to
> > > > > > > > create my own new vtkImageData.
> > > > > > > > It's all about the interpretation of values in vtkImageData by
> > > > > > > > vtkVolumeMapper.
> > > > > > > >
> > > > > > > > Thanks for your efforts.
> > > > > > > > Thomas
> > > > > > > >
> > > > > > > > On Thursday 06 May 2004 05:56 pm, you wrote:
> > > > > > > > > Hi Thomas,
> > > > > > > > >
> > > > > > > > > It looks like all you need to do is turn off interpolation:
> > > > > > > > >
> > > > > > > > > volume->GetProperty()->SetInterpolationTypeToNearest();
> > > > > > > > >
> > > > > > > > > On Thu, 6 May 2004, Thomas Faust wrote:
> > > > > > > > > > Hi VTK users,
> > > > > > > > > >
> > > > > > > > > > Lately I'm confronted with volume rendering. I decided 
> to use
> > > > > > > > > > VTK as graphical tool to render a huge mass of data. So 
> far,
> > > > > > > > > > I'm impressed by the power and usability of VTK.
> > > > > > > > > >
> > > > > > > > > > My problem is the handling of vtkImageData in
> > > > > > > > > > vtkVolumeMapper. My model is created by a collection of
> > > > > > > > > > values in 3 directions (x,y,z). These are stored in
> > > > > > > > > > vtkImageData.
> > > > > > > > > > I expect a volume that extent 3 values(voxels) in each
> > > > > > > > > > direction to be 3 length units long. But it isn't (It's 
> just
> > > > > > > > > > 2). The reason for this is, that the vtkVolumeMapper
> > > > > > > > > > interprets 3 points in one direction as 3 corner points
> > > > > > > > > > (vertices) of voxels. So I end up with 2 voxels that are a
> > > > > > > > > > mixture between my original values.
> > > > > > > > > >
> > > > > > > > > > The problem is that a interpolation between these values is
> > > > > > > > > > not a option, because two values that are even close 
> together
> > > > > > > > > > means totaly different things. (e.g. 0x40 is material 
> A, 0x41
> > > > > > > > > > is material B)
> > > > > > > > > >
> > > > > > > > > > How can I change one of the vtkVolumeMappers to 
> interpret the
> > > > > > > > > > values in vtkImageData to be voxel-based and not
> > > > > > > > > > vertex-based?
> > > > > > > > > >
> > > > > > > > > > Any comments are welcome and will be answered.
> > > > > > > > > > Thanks in advance
> > > > > > > > > > _______________________________________________
> > > > > > > > > > This is the private VTK discussion list.
> > > > > > > > > > Please keep messages on-topic. Check the FAQ at:
> > > > > > > > > > <http://public.kitware.com/cgi-bin/vtkfaq> 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://public.kitware.com/cgi-bin/vtkfaq> 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://public.kitware.com/cgi-bin/vtkfaq>
> > > > > >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://public.kitware.com/cgi-bin/vtkfaq>
> > 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://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list