[Insight-users] Get-methods in itk::BoundingBox

Ivo Wolf i.wolf at dkfz-heidelberg.de
Tue, 03 Feb 2004 19:25:28 +0100


Hi Luis,

Thank you very much for the changes!

I just recognized two additional issues, which may be useful to be changed.

1.) The return type of GetBounds() is BoundsArrayType. BoundsArrayType 
is a FixedArray.
Thus, every time GetBounds is called, a FixedArray is constructed and 
m_Bounds is copied
into it. My suggestion would be to return a const reference to m_Bounds.

Furthermore, the documentation of GetBounds does not match the 
implementation anymore
(NULL is never returned):

/** Get the bounding box. NULL is returned if the bounding box cannot be
* computed. (This may happen if the user never specifies something to
* compute the bounding box from.) */

------------------------

2.) It seems that most access methods call ComputeBoundingBox() before 
returning except GetBounds and IsInside. Maybe it would be more consistent
when they would also call ComputeBoundingBox().


Best regards,

Ivo

Luis Ibanez wrote:

>
> Hi Ivo,
>
> Thanks for pointing this out.
>
> This was entered as Bug # 559
> http://www.itk.org/Bug/bug.php?op=show&bugid=559&pos=0
> and has now been fixed in CVS.
>
>
> The following methods where changed
>
> >   bool ComputeBoundingBox(void) const;
> >   PointType GetCenter(void) const;
> >   PointType GetMinimum(void) const;
> >   PointType GetMaximum(void) const;
> >   AccumulateType GetDiagonalLength2(void) const;
> >   bool IsInside( const PointType & ) const;
>
> and the ivars were made mutable:
>
>
> >   mutable  BoundsArrayType    m_Bounds;
> >   mutable  TimeStamp          m_BoundsMTime;
>
>
> Please let us know if you find any further
> problems,
>
>
>    Thanks
>
>
>       Luis
>
>
>
> -----------------------
> Ivo Wolf wrote:
>
>> Hello,
>>
>> most of the Get-methods of itk::BoundingBox are not const.
>>
>> The reason is probably that they are calling ComputeBoundingBox(),
>> which changes m_Bounds and therefore cannot be const
>> (as long as m_Bounds is not defined mutable).
>>
>> Two methods do not call ComputeBoundingBox():
>> GetBounds (which is const and generated by a macro) and IsInside.
>>
>> Is this deliberately so?
>>
>> It would be nice to some const Get-methods (or at least keep GetBounds
>> const), because otherwise the bounding-box can not be used in
>> other const-methods.
>>
>> Regards,
>>
>> Ivo
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>
>
>
>


-- 
----------------------------------------------------------------------
Dr. Ivo Wolf, Dipl.-Phys.               Phone:  (+49) 6221/42-2327
Deutsches Krebsforschungszentrum        Fax:    (+49) 6221/42-2345
Div. Medical and Biological Informatics (B010)
Im Neuenheimer Feld 280                 email:  i.wolf at dkfz.de
D-69120 Heidelberg, Germany             http://mbi.dkfz-heidelberg.de
----------------------------------------------------------------------