[Insight-users] Filtering region by region an image
Mathieu Malaterre
Mathieu.Malaterre@creatis.insa-lyon.fr
Fri, 21 Feb 2003 14:28:41 +0100
David,
Thank you for your answer. Could you please have a look at this piece
of code and tell where I am wrong.
//define region
InputImageType::RegionType region;
InputImageType::SizeType size;
InputImageType::IndexType index;
index[0] = index[1] = 50;
size[0] = size[1] = 50;
region.SetSize(size);
region.SetIndex(index);
//ITK pipeline
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
reader->GetOutput()->SetRegions(region);
reader->GetOutput()->Allocate();
writer->Update();
I also try:
[snip]
//ITK pipeline
reader->GetOutput()->SetLargestPossibleRegion( region );
reader->GetOutput()->SetBufferedRegion( region );
reader->GetOutput()->SetRequestedRegion( region );
reader->GetOutput()->Allocate();
writer->Update();
In both case, the filter works on the *whole* image and not only the
region I want.
Again here is what I want:
A is the image I read from file (FileReader) but I want to process
*only* the subregion B of this image and then write back an image of
same dimension as A but with the subregion B filtered.
-----------------------------------
| A |
| |
| |
| |
| |
| ----------------- |
| | | |
| | B | |
| | | |
| ----------------- |
| |
-----------------------------------
And I really don't think it should be complicated, but I haven't been
able to find any example in ITK Exemple tree (nor in
ItkSoftwareGuide.pdf) that shows the pipeline to set up in order to do this.
As suggested by James Miller I could have use: StreamingImageFilter but
this filter looks terribly complicated for my purpose. The region B is
not necesseraly centered. And I don't want to process the whole image.
In the near future I would like to process differents parts (not only
just one) of my image but I don't want to process it *all*.
For example (A is still the initial image I read from file). And I would
like to filter region B, C, D, E and then write backk the image
generated (again the dimension should be the same as A, that's why I
can't use ExtractImageFilter).
-----------------------------------
| A |
| |
| -------- |
| | B | -------- |
| -------- | E | |
| -------- -------- |
| | C | -------- |
| -------- | D | |
| -------- |
| |
-----------------------------------
The only condition I could have here is that intersections between those
pieces is NULL.
Does anyone know how to set this up ? Any help would REALLY be appreciated.
Thanks,
mathieu
Ps: I should really give aalib a try ;)
David Holmes wrote:
> Mathieu-
>
> I think that you also could use the RequestedRegion
> property (see other note). In your case, you would
> have to determine if each of your regions combined
> with fully cover the entire image.
>
> thanks
>
> david
> --- Mathieu Malaterre
> <Mathieu.Malaterre@creatis.insa-lyon.fr> wrote:
>
>>Hi all,
>>
>> I would like to know, how I can work on a region
>>of an image. I tried
>>to do it with ExtractImageFilter but I fail to make
>>it work.
>>
>> The output of the filter where of the size of the
>>extracted region
>>(which is the way ExtractImageFilter is supposed to
>>work: decrease
>>size), but I wanted it to be of size of the initial
>>image (= input of
>>ExtractImageFilter)
>>
>> Basically here is what I want to do. Let say I
>>have an image that I
>>want to filter on 4 distinct parts (not necesseraly
>>identical).
>>
>>---------- ----------
>>| | |
>>| | |
>>| 1 | 2 |
>>| | |
>>---------- ----------
>>| | |
>>| | |
>>| 3 | 4 |
>>| | |
>>---------------------
>>
>> Could someone give me the pipeline to use ? So
>>that at the end I have
>>filtered the whole image (I don't know how to concat
>>images after having
>>them extracted through ExtractImageFilter).
>>
>> Should I use ImageRegion/ ImageRegionIterator/
>>ExtractImageFilter ?
>>
>> Hoping to be clear,
>>
>> Thank you,
>> Mathieu Malaterre
>>
>>
>>--
>>Mathieu Malaterre
>>CREATIS
>>28 Avenue du Doyen LEPINE
>>B.P. Lyon-Montchat
>>69394 Lyon Cedex 03
>>http://www.creatis.insa-lyon.fr/~malaterre/
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users@public.kitware.com
>>
>
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
>
--
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/