[vtkusers] Problem with use of vtkImageChangeInformation::SetOutputSpacing()

Jérôme jerome.velut at gmail.com
Tue Jun 1 14:40:55 EDT 2010


Hi,
Another solution would be to set the two first arguments to
VTK_DOUBLE_MAX. By reading the code, it seems that it will keep the
input spacing:

file vtkImageChangeInformation

line 148:     inInfo->Get(vtkDataObject::SPACING(), spacing);

Then, a few line further, you find:

  for (i = 0; i < 3; i++)
    {
    if (this->OutputSpacing[i] != VTK_DOUBLE_MAX)
      {
      spacing[i] = this->OutputSpacing[i];
      }
   ...
   }

line 188:   outInfo->Set(vtkDataObject::SPACING(),spacing,3);

It has to be checked, but one again, I think that the command
   changeInformationFilter->SetOutputSpacing( VTK_DOUBLE_MAX,
VTK_DOUBLE_MAX, myCustomZSpacing );
would do the trick.

If not, Eric's solution is the one that simply work!

HTH
Jerome


2010/6/1 Eric E. Monson <emonson at cs.duke.edu>:
> Hey Daniela,
> You should be able to get the original spacing of you image data in each
> direction from the data itself with one of the GetSpacing() methods:
> http://www.vtk.org/doc/nightly/html/classvtkImageData.html
> -Eric
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
> On Jun 1, 2010, at 11:49 AM, Daniela Sacchetto wrote:
>
> Thanks Jerome for your advise but I not able to use this class.
> I think that I have to use
>
> vtkImageChangeInformation::SetOutputSpacing(float, float, float)
>
> but I don't understand how to set float parametres to have the effect
> desired: I want only change the slice distance, so I think that I have to
> set the value desired as third parameter between brackets, but I don't know
> how set the other....
>
> Have anyone an example for me?
>
> Regards
> Daniela
>
>> Date: Tue, 1 Jun 2010 10:16:03 +0200
>> Subject: Re: [vtkusers] Filter to set the slice distance in a 3D rendered
>> volume
>> From: jerome.velut at gmail.com
>> To: danysunflower at hotmail.it
>> CC: daviddoria+vtk at gmail.comvtkusers at vtk.org
>>
>> Hi Daniela,
>>
>> I think you can use the vtkImageAppend filter together with the
>> vtkImageChangeInformation.
>>
>> HTH
>> Jerome
>>
>>
>> 2010/6/1 Daniela Sacchetto <danysunflower at hotmail.it>:
>> > Ok, sorry,  I'll try to explain in an other way...
>> > I have a 3D rendered volume that is ok but its Z dimension is too
>> > little....I would like to set the Z dimenmsion (for example setting the
>> > pixels or slices distance)...
>> > I know that there is a Itk method (ImageType::SpacingType) that allows
>> > to
>> > set the pixels distance....Is there a VTK method that allows to render
>> > my
>> > image with a note distance in Z direction?
>> >
>> > I hope that now you could understand better my problem...
>> > Regards
>> > Daniela
>> >
>> >> Date: Mon, 31 May 2010 17:22:38 -0400
>> >> Subject: Re: [vtkusers] Filter to set the slice distance in a 3D
>> >> rendered
>> >> volume
>> >> From: daviddoria+vtk at gmail.com
>> >> To: danysunflower at hotmail.it
>> >> CC: vtkusers at vtk.org
>> >>
>> >> On Mon, May 31, 2010 at 5:08 PM, Daniela Sacchetto
>> >> <danysunflower at hotmail.it> wrote:
>> >> > Hi everyone
>> >> > I'm new in vtk and I'm trying to do a work for my thesis.
>> >> >
>> >> > I have to improve a code that gives a 3D volume from 2D slices (.jpg
>> >> > or
>> >> > other formats).
>> >> > My code has to be improved because the 3D visualized with VTK (I'm
>> >> > using
>> >> > vtkVolumeRayCastCompositeFunction) is too "slim": I would like to
>> >> > modifie
>> >> > the Z dimension.
>> >> > Have anyone found this problem yet? Could anyone suggest me a VTK
>> >> > method
>> >> > or
>> >> > class that do something similar?
>> >> >
>> >> > Regards
>> >> > Daniela
>> >>
>> >> I don't know what you mean by "slim". Can you give us a sample data
>> >> set or a screenshot of what you have and an explanation of what is
>> >> wrong?
>> >>
>> >> You may want to look into the Marching Cubes algorithm:
>> >>
>> >>http://www.vtk.org/Wiki/VTK/Examples/Medical/GenerateModelsFromLabels
>> >>
>> >> Good luck,
>> >>
>> >> David
>> >
>> > ________________________________
>> > Tanti account di posta? Unisci tutto sotto Hotmail
>> > _______________________________________________
>> > 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
>> >
>> >
>
> ________________________________
> Avatar per Messenger e sfondo per il PC Creali
> gratis!_______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects
> athttp://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
>
>



More information about the vtkusers mailing list