[Insight-developers] Preconditions / Exceptions / Code values
Miller, James V (CRD)
millerjv@crd.ge.com
Tue, 2 Jan 2001 11:14:28 -0500
I think you can still use the IsPointInside() method but it needs to take a parameter (the point).
The algorithm code would then look like
if( mapper->IsPointInside( myInterestPoint ) )
{
value = mapper->GetPixel( myInterestPoint );
// inside the image, value is valid
}
else
{
// outside the image,
// do something else
}
This would be my choice. It would allow algorithms that "need-to-check" whether a given point is
inside or not to check while allowing algorithms that know they are always inside to avoid the check.
I am wary of using exceptions for things that can be handled without them. But this might just
because I don't have a lot of experience with exceptions. My naive thinking is to limit their use to
"device" related problems (out of memory, out of disk space, etc.).
Jim
-----Original Message-----
From: Luis Ibanez [mailto:ibanez@cs.unc.edu]
Sent: Wednesday, December 20, 2000 4:26 PM
To: Paul Hughett
Cc: Insight-developers@public.kitware.com
Subject: Re: [Insight-developers] Preconditions / Exceptions / Code
values
On Wed, 20 Dec 2000, Paul Hughett wrote:
> A further point: Unless you are being a lot trickier than appears on the
> surface, the local static values implied by
>
> void SetPoint( const Point<dimension, double> & coordinates );
> bool IsPointInside( void ) const;
> TPixelType GetPixel( void ) const;
>
> are not going to be thread-safe. What happens if two different threads
> are using these methods at the same time on the same image?
>
Oops!!
My mistake,
that sequence of three call will not survive a concurrent access.
I guess that the only option left is to use exceptions...
Thanks for pointing this out.
Luis
_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers