[MINC-users] Reading time-width data with minc2 API

Claude LEPAGE claude at bic.mni.mcgill.ca
Mon Aug 10 14:32:42 EDT 2009


Hi Jim,

The malloc is wrong and must be commented out. 

>    Thanks for the suggestion. I did as you suggested and commented out
> the malloc in libsrc2/dimension.c and rebuilt using minc-2.0.18.  No
> success, however, after tossing in liberal printf's I found that it's
> going here ...
>
>   if (dimension->widths == NULL) {
>     for (i=start_position; i <= diff; i++) {
>       widths[j] = dimension->width;
>       j++;
>     }
>   }
>
> In other words, it's returning zeros because the dimension->widths
> pointer is null.  So either the pointer is not being initialized, or
> "miget_dimension_widths" does not do what I expect it to do --- which
> in this case is return the 34 time-width values from the volume.  The
> API does not seem to suggest any other obvious routines, although, all
> we really need is to be able to read the values from the "time-width"
> variable. I feel like I'm missing something really obvious.

I think dimension->widths is NULL because the widths are uniform and
all equal to dimension->width, if which case the widths vector does
not need to exist. This is a simple copy. dimension->width should not
be zero. Hard-code a non-zero value in there, like 3.1415, and see if 
it can be returned  to the calling program?

>     for (i=start_position; i <= diff; i++) {
>       widths[j] = 3.1415;         //  dimension->width;
>       j++;
>     }

Next, we'll have to figure out why dimension->width is zero.

Claude


More information about the MINC-users mailing list