Mask+Neumann Boundary Condition

View: New views
6 Messages — Rating Filter:   Alert me  

Mask+Neumann Boundary Condition

by Brady McCary :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

insight-users,

Is there an neighborhood iterator which will use a non-rectangular
mask and a Neumann boundary condition? I.e., I would like an iterator
that will

1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
2. Use the Neumann boundary condition to compute a neighborhood, using
information only within the mask.

Brady
_____________________________________
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

Re: Mask+Neumann Boundary Condition

by Michael Mai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

See itk::ShapedNeighborhoodIterator (http://www.itk.org/Insight/Doxygen/html/classitk_1_1ShapedNeighborhoodIterator.html) with customized TBoundaryCondition.


-----Ursprüngliche Nachricht-----
Von: insight-users-bounces@... [mailto:insight-users-bounces@...] Im Auftrag von Brady McCary
Gesendet: Dienstag, 3. November 2009 22:16
An: insight-users@...
Betreff: [Insight-users] Mask+Neumann Boundary Condition

insight-users,

Is there an neighborhood iterator which will use a non-rectangular
mask and a Neumann boundary condition? I.e., I would like an iterator
that will

1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
2. Use the Neumann boundary condition to compute a neighborhood, using
information only within the mask.

Brady
_____________________________________
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

Re: Mask+Neumann Boundary Condition

by Karthik Krishnan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's an abuse of what ShapedNeighborhood iterator is meant for. Its meant for small shape templates. Theoretically, yes you can do this with that class, but in practice no..

Its API is not meant for this. For each voxel in the mask, you will have to activate each offset for the shape template pixel  by pixel ..

  shapedIt.ActivateOffset( offset1 ); ....

And you would duplicate your entire mask as a shape template. And it would be slow.

I think you don't have such a class in ITK. However, it should not be hard to write your own iterator.

Thanks
--
karthik


On Wed, Nov 4, 2009 at 3:27 AM, Michael Mai <Michael.Mai@...> wrote:
See itk::ShapedNeighborhoodIterator (http://www.itk.org/Insight/Doxygen/html/classitk_1_1ShapedNeighborhoodIterator.html) with customized TBoundaryCondition.


-----Ursprüngliche Nachricht-----
Von: insight-users-bounces@... [mailto:insight-users-bounces@...] Im Auftrag von Brady McCary
Gesendet: Dienstag, 3. November 2009 22:16
An: insight-users@...
Betreff: [Insight-users] Mask+Neumann Boundary Condition

insight-users,

Is there an neighborhood iterator which will use a non-rectangular
mask and a Neumann boundary condition? I.e., I would like an iterator
that will

1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
2. Use the Neumann boundary condition to compute a neighborhood, using
information only within the mask.

Brady
_____________________________________
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



_____________________________________
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

Re: Mask+Neumann Boundary Condition

by Luis Ibanez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Brady,

There are two mentions of a "Mask" in your email,
and I'm wondering if we are interpreting them correctly.

You say that you want an iterators that uses a

                   "non-rectangular mask"

do you mean that you want the iterator to visit all
the pixels of a non-rectangular region of the image ?

You are probably aware of the difference between the
ITK ImageRegion iterators and the ITK Neighborhood
Iterators.

The use of Boundary conditions is relevant for the
Neighborhood iterators, not for the RegionIterators.

Could you please clarify if you are looking for
a Neighborhood iterator or not ?

and whether you need to look at the neighbors of
every pixel in a particular pattern ?

Maybe a high level description of what you are trying
to achieve, will be very helpful here.


      Thanks


           Luis


----------------------------------------------------------------------------------------------------------
On Tue, Nov 3, 2009 at 4:15 PM, Brady McCary <brady.mccary+ITK@...> wrote:

> insight-users,
>
> Is there an neighborhood iterator which will use a non-rectangular
> mask and a Neumann boundary condition? I.e., I would like an iterator
> that will
>
> 1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
> 2. Use the Neumann boundary condition to compute a neighborhood, using
> information only within the mask.
>
> Brady
> _____________________________________
> 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

Re: Mask+Neumann Boundary Condition

by Brady McCary :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Luis,

A high-level description is:

1. Imagine an image with circular ROI.
2. Iterate a neighborhood over the ROI.
3. Use a BC when the neighborhood extends outside of the ROI.

Said with more details:

1. Input images are rectangular.
2. I want to be able to set a ROI and perform a computation only over
this ROI. The ROI will in general be non-rectangular.
3. This computation requires a neighborhood for each pixel in the ROI.
4. Some pixels in the ROI will be on the boundary of the ROI and
therefor the neighborhood will extend outside of the ROI.
5. In the case where pixels in the neighborhood are outside of the
ROI, I want to be able to use a boundary condition to compute their
values.
6. A Neumann-like BC will be fine.
7. Note that the usual grid-aligned, rectangular region is a convex
case (see next note).
8. Note that defining the Neumann BC for a non-convex region is more
complicated that the convex case.

I hope this clarifies my post. Please let me know if you need more information.

Brady

On Sun, Nov 8, 2009 at 1:20 PM, Luis Ibanez <luis.ibanez@...> wrote:

> Hi Brady,
>
> There are two mentions of a "Mask" in your email,
> and I'm wondering if we are interpreting them correctly.
>
> You say that you want an iterators that uses a
>
>                   "non-rectangular mask"
>
> do you mean that you want the iterator to visit all
> the pixels of a non-rectangular region of the image ?
>
> You are probably aware of the difference between the
> ITK ImageRegion iterators and the ITK Neighborhood
> Iterators.
>
> The use of Boundary conditions is relevant for the
> Neighborhood iterators, not for the RegionIterators.
>
> Could you please clarify if you are looking for
> a Neighborhood iterator or not ?
>
> and whether you need to look at the neighbors of
> every pixel in a particular pattern ?
>
> Maybe a high level description of what you are trying
> to achieve, will be very helpful here.
>
>
>      Thanks
>
>
>           Luis
>
>
> ----------------------------------------------------------------------------------------------------------
> On Tue, Nov 3, 2009 at 4:15 PM, Brady McCary <brady.mccary+ITK@...> wrote:
>> insight-users,
>>
>> Is there an neighborhood iterator which will use a non-rectangular
>> mask and a Neumann boundary condition? I.e., I would like an iterator
>> that will
>>
>> 1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
>> 2. Use the Neumann boundary condition to compute a neighborhood, using
>> information only within the mask.
>>
>> Brady
>> _____________________________________
>> 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

Re: Mask+Neumann Boundary Condition

by Luis Ibanez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Brady,

Thanks a lot for the clarification.

In order to address this need, you will have to customize
a new Iterator class.

You may want to start from the itkNeighborhood iterator,
which provides the walking capability (although it needs
to be modified) and the ability to visit the neighbors of
the current pixel.

The Neighborhood iterators already support the use
of BoundaryConditions,... although their implementation
would have to be modified in your case, since the values
that need to be computed outside of the ROI would have
to follow a rule that doesn't require borders that are aligned
with the axis.

---

Regarding the Walking capability, one efficient way of
implementing this iterator, would be to take advantage
of the new itkLabel classes in the Insight/Code/Review
directory.  They allow you to represent the ROI using
run-length-encoding, which in its turn will give you an
efficient guidance for walking over the inside of ROI
and will let you know how to jump from the end of one
ROI row to the beginning of the next.

These classes are described in the following Insight
Journal paper:

"Label object representation and manipulation with ITK"
 http://www.insight-journal.org/browse/publication/176
 http://hdl.handle.net/1926/584


This will not be a trivial task....

You are probably looking at a week-long session of coding.


Of course,
If you undertake this effort, we will strongly encourage you
to share it with the community, via a submission to the
Insight Journal    :-)


Please let us know if you have further questions,


       Thanks


             Luis


---------------------------------------------------------------------------------
On Sun, Nov 8, 2009 at 3:09 PM, Brady McCary <brady.mccary+ITK@...> wrote:

> Luis,
>
> A high-level description is:
>
> 1. Imagine an image with circular ROI.
> 2. Iterate a neighborhood over the ROI.
> 3. Use a BC when the neighborhood extends outside of the ROI.
>
> Said with more details:
>
> 1. Input images are rectangular.
> 2. I want to be able to set a ROI and perform a computation only over
> this ROI. The ROI will in general be non-rectangular.
> 3. This computation requires a neighborhood for each pixel in the ROI.
> 4. Some pixels in the ROI will be on the boundary of the ROI and
> therefor the neighborhood will extend outside of the ROI.
> 5. In the case where pixels in the neighborhood are outside of the
> ROI, I want to be able to use a boundary condition to compute their
> values.
> 6. A Neumann-like BC will be fine.
> 7. Note that the usual grid-aligned, rectangular region is a convex
> case (see next note).
> 8. Note that defining the Neumann BC for a non-convex region is more
> complicated that the convex case.
>
> I hope this clarifies my post. Please let me know if you need more information.
>
> Brady
>
> On Sun, Nov 8, 2009 at 1:20 PM, Luis Ibanez <luis.ibanez@...> wrote:
>> Hi Brady,
>>
>> There are two mentions of a "Mask" in your email,
>> and I'm wondering if we are interpreting them correctly.
>>
>> You say that you want an iterators that uses a
>>
>>                   "non-rectangular mask"
>>
>> do you mean that you want the iterator to visit all
>> the pixels of a non-rectangular region of the image ?
>>
>> You are probably aware of the difference between the
>> ITK ImageRegion iterators and the ITK Neighborhood
>> Iterators.
>>
>> The use of Boundary conditions is relevant for the
>> Neighborhood iterators, not for the RegionIterators.
>>
>> Could you please clarify if you are looking for
>> a Neighborhood iterator or not ?
>>
>> and whether you need to look at the neighbors of
>> every pixel in a particular pattern ?
>>
>> Maybe a high level description of what you are trying
>> to achieve, will be very helpful here.
>>
>>
>>      Thanks
>>
>>
>>           Luis
>>
>>
>> ----------------------------------------------------------------------------------------------------------
>> On Tue, Nov 3, 2009 at 4:15 PM, Brady McCary <brady.mccary+ITK@...> wrote:
>>> insight-users,
>>>
>>> Is there an neighborhood iterator which will use a non-rectangular
>>> mask and a Neumann boundary condition? I.e., I would like an iterator
>>> that will
>>>
>>> 1. Only iterate over a mask I supply (e.g., an itk::ImageMaskSpatialObject).
>>> 2. Use the Neumann boundary condition to compute a neighborhood, using
>>> information only within the mask.
>>>
>>> Brady
>>> _____________________________________
>>> 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