[vtkusers] vtkImageReslice using stencil

David Gobbi david.gobbi at gmail.com
Tue Sep 21 15:48:11 EDT 2010


My guess is that you are not building the ResliceAxes the right way.
You want the reslice axes to cause a rotation around the center of the
volume, so you need them to do this:

1) shift to the center of the volume
2) rotate
3) shift back again, the opposite of (1)

If you have a stack of images, you should set the center to (CenterX,
CenterY, CenterZ), unless you specifically want to rotate around a
point in the first slice.

The reason that SetOutputOriginToDefault() sets 1e+300 is that this
large value is a flag to reslice that causes it to internally compute
a "best guess" for the origin.  It tries to find an origin that will
display as much of the image as possible, i.e. the "Default" causes it
to a shift the image around in order to get the best view.

  David


2010/9/21 E.R <frantic_tictoc83 at yahoo.gr>:
>
> I did the following steps:
>
> -vtkAppender is connected to vtkImageReslice.
> -Appender.SetAppendAxis(2);
> -The vtkImageData (of the Volume) 's origin is 0,0,0
> -I set the ResliceAxes with an offset in the center (CenterX,CenterY,0) the volume.
> -I set Reslice's outspacing same as the volume.
> -I set Reslice 's outExtent (0, 511,0,804,0,0)
>
> When i call reslice.SetOutputOriginToDefault(), I get an origin's value like 1.0e+300. Why is that? but I can see  correct the whole image (reslice). (I dont use any vtk Viewer,just taking image's data from the vtkImageReslice and draw them by myself)
> if I call reslice.SetOutputOrigin(0,0,0), I can see a black image with only one row of pixels in the top.
> What I am doing wrong?? Miss anything?
>
>
>
> --- Στις Τρίτ., 21/09/10, ο/η David Gobbi <david.gobbi at gmail.com> έγραψε:
>
>> Από: David Gobbi <david.gobbi at gmail.com>
>> Θέμα: Re: [vtkusers] vtkImageReslice using stencil
>> Προς: "E.R" <frantic_tictoc83 at yahoo.gr>
>> Κοιν.: vtkusers at vtk.org
>> Ημερομηνία: Τρίτη, 21 Σεπτέμβριος 2010, 18:18
>> Hi Elias,
>>
>> You can make vtkImageReslice clip the data by setting the
>> OutputOrigin
>> and OutputSpacing to be the same as the input's origin and
>> spacing.
>>
>> reslice.SetOutputExtent(100, 300, 250, 300, 0, 0);
>> reslice.SetOutputOrigin(...same as for the input data...)
>> reslice.SetOutputSpacing(...same as for the input data...)
>>
>>   David
>>
>>
>> 2010/9/21 E.R <frantic_tictoc83 at yahoo.gr>:
>> > Sorry!
>> > I mean... I cant extract a specific region inside the
>> reslice.
>> > I only get the whole Reslice..fitted inside this whole
>> extent (100, 300, 250, 300, 0, 0).
>> >
>> > So I used vtkImageClip for that...
>> >
>> > my code is like this now:
>> >
>> > reslice.SetOutputExtent(0, 511,0,804,0,0);
>> > clip.SetOuputExtent(100, 300, 250, 300, 0, 0);
>> > padFilter.SetOutputExtent(0, 511,0,804,0,0);
>> >
>> > How I can produce the same result without using
>> vtkImageClip??
>> >
>> > --- Στις Δευτ., 20/09/10, ο/η David Gobbi
>> <david.gobbi at gmail.com>
>> έγραψε:
>> >
>> >> Από: David Gobbi <david.gobbi at gmail.com>
>> >> Θέμα: Re: [vtkusers] vtkImageReslice using
>> stencil
>> >> Προς: "E.R" <frantic_tictoc83 at yahoo.gr>
>> >> Κοιν.: vtkusers at vtk.org
>> >> Ημερομηνία: Δευτέρα, 20
>> Σεπτέμβριος 2010, 22:00
>> >> Hi Elias,
>> >>
>> >> You don't give enough information in your email.
>> When
>> >> you say
>> >> "it isn't working", that does not tell me what is
>> going
>> >> wrong.  Is
>> >> the output shifted?  Empty?  Black?  Does it
>> >> crash?
>> >>
>> >>    David
>> >>
>> >>
>> >> 2010/9/20 E.R <frantic_tictoc83 at yahoo.gr>:
>> >> > Thank you very much!
>> >> >
>> >> > How I extract a specific region with
>> >> reslice.SetOutputExtent(100, 300, 250, 300, 0, 0)?
>> ?
>> >> >
>> >> > It's not working...Its the same with
>> >> reslice.SetOuputExtent(0,200,0,50,0,0)...
>> >> >
>> >> >
>> >> > --- Στις Δευτ., 20/09/10, ο/η David
>> Gobbi
>> >> <david.gobbi at gmail.com>
>> >> έγραψε:
>> >> >
>> >> >> Από: David Gobbi <david.gobbi at gmail.com>
>> >> >> Θέμα: Re: [vtkusers] vtkImageReslice
>> using
>> >> stencil
>> >> >> Προς: "E.R" <frantic_tictoc83 at yahoo.gr>
>> >> >> Κοιν.: vtkusers at vtk.org
>> >> >> Ημερομηνία: Δευτέρα, 20
>> >> Σεπτέμβριος 2010, 17:09
>> >> >> Hi Elias,
>> >> >>
>> >> >> I recommend that you don't use
>> vtkImageStencilData
>> >> for what
>> >> >> you are
>> >> >> doing.  Instead, you should first use
>> reslice on
>> >> just
>> >> >> the region, and
>> >> >> then pad the output with
>> vtkImagePadFilter:
>> >> >>
>> >> >>
>> >>
>>  padFilter.SetInputConnection(reslice.GetOutputPort());
>> >> >>  reslice.SetOutputExtent(100, 300, 250,
>> 300, 0,
>> >> 0);
>> >> >>  padFilter.SetOutputExtent(0,
>> 511,0,804,0,0);
>> >> >>
>> >> >> With stencils, you cannot easily build a
>> >> >> vtkImageStencilData from
>> >> >> scratch.  The vtkImageStencilData should
>> be only
>> >> be
>> >> >> produced by a
>> >> >> source or filter.
>> >> >>
>> >> >>   David
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> 2010/9/20 E.R <frantic_tictoc83 at yahoo.gr>:
>> >> >> >  I have tried this..but I got a
>> memory
>> >> >> >  error.."Attempted to read or
>> write
>> >> protected
>> >> >> memory"...
>> >> >> >  What I am doing wrong????? :-|
>> >> >> >
>> >> >> >> --- Στις Δευτ.,
>> 20/09/10, ο/η
>> >> Jim
>> >> >> Peterson <jimcp at cox.net>
>> >> >> >> έγραψε:
>> >> >> >>
>> >> >> >> > Από: Jim Peterson <jimcp at cox.net>
>> >> >> >> > Θέμα: Re: [vtkusers]
>> >> vtkImageReslice
>> >> >> using
>> >> >> >> stencil
>> >> >> >> > Προς: "E.R" <frantic_tictoc83 at yahoo.gr>
>> >> >> >> > Κοιν.: vtkusers at vtk.org
>> >> >> >> > Ημερομηνία:
>> >> Δευτέρα, 20
>> >> >> >> Σεπτέμβριος 2010,
>> 15:15
>> >> >> >> > Elias,
>> >> >> >> > If I read that error
>> message
>> >> correctly, it
>> >> >> sounds
>> >> >> >> like
>> >> >> >> >
>> >> reslice.SetOutputExtent(100,300,250,300,0,0)
>> >> >> ;
>> >> >> >> > would be accepted. The
>> question is
>> >> would it
>> >> >> be the
>> >> >> >> desired
>> >> >> >> > result?
>> >> >> >> >
>> >> >> >> > HTH
>> >> >> >> > Jim
>> >> >> >> >
>> >> >> >> > E.R wrote:
>> >> >> >> > > Greetings!!
>> >> >> >> > >
>> >> >> >> > > I am using
>> >> vtkImageReslice.setStencil()
>> >> >> to limit
>> >> >> >> a
>> >> >> >> > specific area.
>> >> >> >> > > My code is like that:
>> >> >> >> > > vtkImageStencilData
>> test = new
>> >> >> >> vtkImageStencilData();
>> >> >> >> > >
>> >> >> >> > > test.SetExtent(100,
>> 300, 250,
>> >> 300, 0,
>> >> >> 0);
>> >> >> >> > >
>> reslice.SetStencil(test);
>> >> >> >> > >
>> reslice.SetOutputExtent(0,
>> >> >> 511,0,804,0,0);
>> >> >> >> > >
>> >> >> >> > > but I am getting this
>> error
>> >> message:
>> >> >> >> > >
>> >> >> >> > > "The update extent
>> specified in
>> >> the
>> >> >> information
>> >> >> >> for
>> >> >> >> > output port 0 on algorithm
>> >> >> >> vtkTrivialProducer(086731A0) is
>> 0
>> >> >> >> > 511 0 804 0 0, which is
>> outside the
>> >> whole
>> >> >> extent 100
>> >> >> >> 300 250
>> >> >> >> > 300 0 0."
>> >> >> >> > >
>> >> >> >> > > What I am doing
>> wrong?? How I
>> >> ll set the
>> >> >> stencil
>> >> >> >> > inside my Image bounds?
>> >> >> >> > >
>> >> >> >> > > thanks in advance!
>> >> >> >> > >
>> >> >> >> > > Elias
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > >
>> >> >>
>> _______________________________________________
>> >> >> >> > > 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
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> _______________________________________________
>> >> >> > 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
>> >> >> >
>> >> >>
>> >> >
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>>
>
>
>



More information about the vtkusers mailing list