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

EJ Nikelski nikelski at bic.mni.mcgill.ca
Mon Aug 10 15:00:04 EDT 2009


Hi Claude,

  Done.  malloc is commented out and 3.1415 is indeed returned.

> I think dimension->widths is NULL because the widths are uniform and
> all equal to dimension->width, if which case the widths vector does

Hmmm .... don't think so.  When I look at the header, the "time" and
"time-width" variables are designated as "irregular".  Note the
attributes and the actual data values:
--------------------------------------
        double time(time) ;
                time:length = 34 ;
                time:dimorder = "time" ;
                time:varid = "MINC standard variable" ;
                time:vartype = "dimension____" ;
                time:version = "MINC Version    1.0" ;
                time:spacing = "irregular" ;
                time:alignment = "start_" ;
                time:units = "seconds" ;
                time:start = 0.016 ;
                time:step = 145.454545454545 ;
        double time-width(time) ;
                time-width:dimorder = "time" ;
                time-width:varid = "MINC standard variable" ;
                time-width:vartype = "dim-width____" ;
                time-width:version = "MINC Version    1.0" ;
                time-width:spacing = "irregular" ;
                time-width:filtertype = "square____" ;
                time-width:units = "seconds" ;

 time = 0.016, 15.016, 30.016, 45.016, 60.016, 90.016, 120.016, 150.016,
    180.016, 210.016, 240.016, 270.016, 300.016, 360.016, 420.016, 480.016,
    540.016, 600.016, 660.016, 720.016, 780.016, 840.016, 1020.016, 1200.016,
    1500.016, 1800.016, 2100.016, 2400.016, 2700.016, 3000.016, 3300.016,
    3600.016, 4200.016, 4800.016 ;
 time-width = 15, 15, 15, 15, 30, 30, 30, 30, 30, 30, 30, 30, 60, 60, 60, 60,
    60, 60, 60, 60, 60, 180, 180, 300, 300, 300, 300, 300, 300, 300, 300,
    600, 600, 600 ;

-Jim



On Mon, Aug 10, 2009 at 2:32 PM, Claude LEPAGE<claude at bic.mni.mcgill.ca> wrote:
> 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
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www2.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>



-- 
=================================
Jim Nikelski, Ph.D.
Postdoctoral Research Fellow
Bloomfield Centre for Research in Aging
Lady Davis Institute for Medical Research
Sir Mortimer B. Davis - Jewish General Hospital
McGill University



More information about the MINC-users mailing list