[Insight-developers] Dashboard Cleanup: mini0.nlm MacOSX-cross-rosetta : 50 tests failing

Michel Audette michel.audette at kitware.com
Thu Jan 28 14:16:22 EST 2010


Hi Kevin,

I added a pair of brackets that makes d local. I only alerted Luis, because
I thought that would almost spam the list. In any event, I wanted to
preserve the functionality as much as possible, although Luis is steering me
to while loops these days, as they tend to debug well. I'll keep an eye on
the dashboard.

Cheers,

Michel

On Thu, Jan 28, 2010 at 1:59 PM, Kevin H. Hobbs <hobbsk at ohiou.edu> wrote:

> On 01/28/2010 01:31 PM, Michel Audette wrote:
> > Hi Luis,
> >
> > your value *d* in the bolded part of your suggested code is undefined
> > when used as an index. It has to be as
> > d = dim - 1;
> > l = coord[d];
> > d--;
> > for coord to have a valid index, doesn't it?
> >
> > I propose... (extra check on validity of index d)
> > #define NRRD_INDEX_GEN(I, coord, size, dim)   \
> > int d;                                                                 \
> > d = (dim) - 1;                                                      \
> > if ( (d) >= 0 )                                                      \
> > {                                                                       \
> >   (I) = (coord)[d];                                                \
> >   d--;                                                                 \
> >   while( d >= 0 )                                                 \
> >   {                                                                     \
> >   (I) = (coord)[d] + (size)[d] * (I);                          \
> >   d--;                                                                 \
> >   }                                                                     \
> > }                                                                       \
> > and to take out the pragmas.
> >
> > Seem reasonable?
> >
> > Michel
> >
>
> I like your check for d >= 0. Nothing will happen if dim = 1 where I'm
> guessing the present code would do something undefined if dim == 1. Does
> NRRD even deal with 1-d things?
>
> The only other thing that jumps to mind is that since this is a macro in
> C we might want to follow the lead of the original header and wrap the
> whole thing up in a do{...}while(0) I guess this is to avoid redefining
> d or declaring d in the middle of a block of code. This will probably
> make the code easier to digest for older compilers but I'm by no means
> an expert here.
>
> Instead of do{...}while(0) could it be if ( dim >= 1 ){...} else {...} ?
>
>


-- 
Michel Audette, Ph.D.
R & D Engineer,
Kitware Inc.,
Chapel Hill, N.C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100128/65e5bcb1/attachment.htm>


More information about the Insight-developers mailing list