[Insight-users] Apply filter only on a specific region ?

Ivan Macia imacia at vicomtech.org
Fri Feb 5 07:01:59 EST 2010


Hi,

Try

medianFilter->GetOutput()->SetRequestedRegion( wantedRegion3 )

before updating. The request must be done on the output, not in the input.
The pipeline calculates which is the required input to generate the output,
which in turn will be the output of the previous filter, and so on.

Best regards

Ivan

2010/2/5 steve harris <steve.harris18 at hotmail.com>

>  Hello again,
>
> I open again this subject because of what Louis suggested.
>
>
> > or even use the SetRequrestedRegion()
> > of the Median filter directly.
>
> I was also interested in this methods so I quickly tried it but without
> success..
>
> I didn't manage to find how to set the SetRequrestedRegion of the median
> filter directly ?
> That's what I tried:
>
>     start3[0] = 0;
>     start3[1] = 0;
>     start3[2] = 0;
>
>     size3[0] = 20;
>     size3[1] = 20;
>     size3[2] = 20;
>     wantedRegion3.SetIndex(start3);
>     wantedRegion3.SetSize(size3);
>
> mySimpleImage->SetRequestedRegion(wantedRegion3)
> neighRadius2[0] = 1;
> neighRadius2[1] = 1;
> neighRadius2[2] = 1;
> median->SetRadius(neighRadius2);
> median->SetInput(mySimpleImage);
> median->Update();
>
> But when I display median->GetOutput() all the image has been filtred and
> not only my requested region...
>
> Do I'm missing something ?
>
> Regards,
> Steve
>
> ------------------------------
> From: steve.harris18 at hotmail.com
> To: imacia at vicomtech.org; luis.ibanez at kitware.com
> Date: Tue, 26 Jan 2010 10:48:22 +0000
>
> CC: insight-users at itk.org
> Subject: Re: [Insight-users] Apply filter only on a specific region ?
>
>
> Hello,
>
> Just a word to say that using this pipeline
>
> RegionOfInterestImageFilter
> MedianImageFilter
> PasteImageFilter
>
> it works, I mean I quickly tried and I got a good visual result (only the
> part I chossed has been filtred)
>
> Thanks,
> Steve
>
> > From: imacia at vicomtech.org
> > To: luis.ibanez at kitware.com; steve.harris18 at hotmail.com
> > CC: insight-users at itk.org
> > Subject: RE: [Insight-users] Apply filter only on a specific region ?
> > Date: Mon, 25 Jan 2010 18:15:20 +0100
> >
> > Hi Luis,
> >
> > Just a question. We were discussing here at work the meaning of the
> > different regions (Largest vs Requested vs Buffered). One question we had
> is
> > if you can process a part of the image only by setting the Requested
> Region
> > on the output, which seems quite straightforward and compatible with the
> ITK
> > pipeline definition. What would you get here? An image whose Largest
> > Possible Region is the same as the one you requested?
> >
> > The idea I have is that the Requested Region is an important part of the
> ITK
> > pipeline and is used by the filters, at least internally, so why is its
> use
> > discouraged in this case?
> >
> > Thanks in advance
> >
> > Iván
> >
> > PD: it is common the case in which we have to process only a certain part
> of
> > the image in medical applications, for example when we have to calculate
> > statistics in a region of interest from a 3D image, as defined by the
> > radiologist. It may be inconsistent from the point of view image
> processing
> > but it works :) This is just an example but we have find many cases in
> which
> > we have had to restrict ourselves only to a certain part of the image as
> > defined by the user, due to memory limitations or for a faster processing
> > among other reasons.
> >
> >
> > -----Mensaje original-----
> > De: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org]
> En
> > nombre de Luis Ibanez
> > Enviado el: domingo, 24 de enero de 2010 16:11
> > Para: dsdfdff sfdsf
> > CC: insight-users at itk.org
> > Asunto: Re: [Insight-users] Apply filter only on a specific region ?
> >
> > Hi Steve,
> >
> > It depends....
> >
> > What exactly do you want at the output ?
> >
> > A) The full input input with the subregion modified ?
> >
> > or
> >
> > B) only the modified subregion ?
> >
> > ---
> >
> > If you want (A) you will have to use a pipeline
> > such as:
> >
> > RegionOfInterestImageFilter
> > MedianImageFilter
> > PasteImageFilter
> >
> > If you want (B) you could use simply
> >
> >
> > RegionOfInterestImageFilter
> > MedianImageFilter
> >
> > or even use the SetRequrestedRegion()
> > of the Median filter directly. Although
> > this last option is not a recommended
> > practice, unless you are very familiar
> > with the inner-workings of the ITK pipeline.
> >
> >
> > --
> >
> > On a side note:
> >
> > Why do you want to do such thing ? :-)
> >
> > From the pure image processing point of view,
> > it doesn't seem to be a good operation. You
> > will end up with an inconsistent image...
> >
> >
> >
> > Regards,
> >
> >
> > Luis
> >
> >
> > --------------------------------------
> > On Fri, Jan 22, 2010 at 5:51 AM, dsdfdff sfdsf
> > <steve.harris18 at hotmail.com> wrote:
> > > Hello itk user,
> > >
> > > I was wondering if it was possible to apply a filter only on a specific
> > > region of an image (like setting a bundary region)?
> > >
> > > for example if I have a simple 3D image (let say 30x30x30) is it
> possible
> > > for example to apply the mean filter
> > > only on the region (15x15x15)?
> > >
> > > regards,
> > > Steve
> > >
> > > ________________________________
> > > Faites une bonne action avec Bing Solidaire ! C'est ici !
> > > _____________________________________
> > > Powered by www.kitware.com
> > >
> > > Visit other Kitware open-source projects at
> > > http://www.kitware.com/opensource/opensource.html
> > >
> > > Kitware offers ITK Training Courses, for more information visit:
> > > http://www.kitware.com/products/protraining.html
> > >
> > > Please keep messages on-topic and check the ITK FAQ at:
> > > http://www.itk.org/Wiki/ITK_FAQ
> > >
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.itk.org/mailman/listinfo/insight-users
> > >
> > >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
>
> ------------------------------
> Windows 7 : Trouvez le PC qui vous convient! Découvrez notre offre !
> <http://clk.atdmt.com/FRM/go/181574577/direct/01/>
> ------------------------------
> Votre messagerie et bien plus où que vous soyez. Passez à Windows Live
> Hotmail, c'est gratuit ! Inscrivez-vous<https://signup.live.com/signup.aspx?id=60969>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100205/2629e1dd/attachment-0001.htm>


More information about the Insight-users mailing list