[vtkusers] vtkImageReslice using stencil

David Gobbi david.gobbi at gmail.com
Tue Sep 21 11:18:04 EDT 2010


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