[Insight-developers] ImageFunction

Miller, James V (Research) millerjv at crd.ge.com
Fri Nov 4 08:52:20 EST 2005


Lydia, 

Do you recall why ImageFunction provides several function overloads for IsInsideBufffer() that take a Point, ContinuousIndex, or Index but Evaluate() only takes a Point and one needs to use EvaluateAtContinuousIndex() to evaluate at a ContinuousIndex.  I cannot recall the reason we did it this way.  I remember we discussed it on the tcons many years ago. I think it might have been because Evaluate() is virtual and we did not want to force the developer to provide all overloaded implementations if they didn't need to.

I had a bug where I was calling Evaluate() and passing in a ContinuousIndex since I expected it to be overloaded since IsInsideBuffer() was overloaded.  Since ContinuousIndex is a subclass of Point, the compiler happily called Evaluate(Point &).

Along these lines, do you have an opinions of moving ContinuousIndex so that it is not a subclass of Point?  I found I could not do

someContinousIndex = someContinuousIndex + someVector;

because operator+ is not defined in ContinuousIndex but is defined in Point.  The problem is that operator+ in Point returns a Point which cannot be assigned to a ContinuousIndex (left hand side of the statement).  I could, however, do a 

someContinuousIndex += someVector;

without issue since this line of code ignores the return value of operator+=

Moving ContinuousIndex out from under Point would require duplicating most of the code that is already in Point.  However, it would
keep ContinousIndices from being cast by the compile back to a Point.

Jim Miller 
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C223
1 Research Circle, Schenectady NY 12309-1027

millerjv at research.ge.com <mailto:millerjv at research.ge.com>
(518) 387-4005, Dial Comm: 8*833-4005
Cell: (518) 505-7065, Fax: (518) 387-6981


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20051104/186975ee/attachment.htm


More information about the Insight-developers mailing list