[Insight-developers] spatial object iterators

Julien Jomier jjomier@cs.unc.edu
Sun, 9 Feb 2003 21:45:01 -0500


Hi Damion,

> 1) Because the conditional iterators are templated, it should be 
> possible to use any of them with SpatialObjects, provided 
> SpatialObjects have an Evaluate() function. I don't know how 
> much sense 
> this makes in the context of spatial objects (in that they 
> don't really 
> "Evaluate"), but it would be relatively simple to wrap 
> IsInside() into 
> Evaluate(). Both functions expect N-d points, so there's no 
> fundamental 
> data type problem.

This sounds a good solution to me, if this is the only function we have
to wrap. If this is the case, we'll have to document that well in
SpatialObjects.
If you need to wrap other functions (like ValueAt(), ... ) I'd rather
derive a SpatialObjectFunction class from SpatialFunction.

I'm making some modifications to SpatialObjects ... let me know if I can
help with this.

Julien

> -----Original Message-----
> From: insight-developers-admin@public.kitware.com 
> [mailto:insight-developers-admin@public.kitware.com] On 
> Behalf Of Damion Shelton
> Sent: Sunday, February 09, 2003 9:23 PM
> To: Insight-developers@public.kitware.com
> Subject: [Insight-developers] spatial object iterators
> 
> 
> I've been looking over the spatial object code to see how 
> easy it will 
> be to integrate them with the conditional iterators and I have a few 
> comments and questions.
> 
> First, the primary difference between spatial objects and spatial 
> functions is the means by which a value is returned. The 
> InteriorExteriorSpatialFunction's (to be renamed to 
> BooleanSpatialFunctions) return true when a point is inside the 
> function, and false otherwise, in response to an Evaluate() 
> call. This 
> is the "condition" in the conditional iterators. SpatialObjects are 
> quite similar, but the corresponding call is IsInside().
> 
> There are a several ways I can see of solving this problem:
> 
> 1) Because the conditional iterators are templated, it should be 
> possible to use any of them with SpatialObjects, provided 
> SpatialObjects have an Evaluate() function. I don't know how 
> much sense 
> this makes in the context of spatial objects (in that they 
> don't really 
> "Evaluate"), but it would be relatively simple to wrap 
> IsInside() into 
> Evaluate(). Both functions expect N-d points, so there's no 
> fundamental 
> data type problem.
> 
> 2) It may be possible to do type checking at runtime, and call the 
> appropriate function. Is this true?
> 
> 3) SpatialObjects might be a subclass of SpatialFunctions, although I 
> haven't convinced myself of this. Are there any problems with 
> subclassing the spatial objects from spatial functions?
> 
> 4) It would be relatively straightforward to write additional 
> conditional iterators, where the IsPixelIncluded() function is 
> implemented to call IsInside(). My concerns here are that this code 
> would essentially duplicate that of the spatial function iterators 
> (with the exception of one line) and therefore would create 
> extra code 
> to maintain.
> 
> A final issue is the name of the resulting iterators. Right now, we 
> have FloodFilledSpatialFunctionConditionalIterator; if we create a 
> version of this which can iterate over spatial objects, would 
> the name 
> be confusing?
> 
> -Damion-
> 
> _______________________________________________
> Insight-developers mailing list Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>