[MINC-users] mincaverage error

Alex Zijdenbos zijdenbos at gmail.com
Tue Mar 8 09:06:17 EST 2011


Lisa A,

mincaverage -normalize will normalize each image to its mean prior to
averaging; which in my opinion is actually a poor way to normalize
them. I tend to normalize them explicitly prior to averaging with
something slightly smarter than a plain average across the image.

Now, I don't know what mincnorm is or does, but assuming it does some
sort of intensity normalization and you did run that on your images
prior to adding them, you should be ok. But either way you would want
to normalize them *before* averaging.

As for your mincaverage problem I am at a loss; but have you tried the
same thing with mincmath? In other words, does mincmath give the same
error when you add them all up in one call? (mincmath -float -add
<file1.mnc> <file2.mnc> <sum.mnc>) If it does I'd that points at a
generic problem in libminc; if not, it may be specific to mincaverage.
I would try to avoid adding images one by one, but if you do use a
float output type (like in the mincmath call above).

And here is a long shot: I noticed your images are at an
unconventional sampling lattice. This *should* really not pose any
problem, but on the off-chance that you ran into an odd bug, you may
want to run mincresample with '-like icbm_template_1.00mm.mnc'
instead of the template you used (you should have these template files
I believe). If (big if) that solves the problem that might give an
indication of where the problem lies.

-- A

On Mon, Mar 7, 2011 at 4:17 PM, Lisa F. Akiyama <lrisa87 at uw.edu> wrote:
> Hi again,
>
> Some update:
>
> I was just able to add each file one by one to create a sum image, and was
> able to divide this by the total #N value (constant) using mincmath.
> Then, I ran mincnorm.
> Is this equivalent/close enough to what mincaverage -normalize does?
>
> Thanks.
>
>
> Best,
> Lisa
>  ______________________________
>
>
>
>
> On Mon, Mar 7, 2011 at 11:04 AM, Lisa F. Akiyama <lrisa87 at uw.edu> wrote:
>
>> Alex Z.,
>>
>> Here's a list of pre-processing I performed on each site S and site I files
>> before putting them through mincaverage:
>> 1) N3 intensity nonuniformity correction
>> 2) mincnorm so that the range would be 0-100
>> 3) Linear registration of subject images to standard template: bestlinreg
>> using Vladimir Fonov's NIHPD-BIC model for 00-02 year age range (range
>> 0-100) as the target. I also created a brain mask image and specified as the
>> target_mask that in the command. Used -lsq9.
>>     When I look at the header of the files, they all have a stamp
>> mentioning that the files went through mincresample with -like NIHPD-BIC
>> template.
>>     I've check each individual's resampled image and they all seem fairly
>> well registered. (There were a few images that didn't do so well, but after
>> creating the subject specific brainmask and re-running bestlinreg on these
>> individuals, the outcomes were good)
>>
>> I just ran mincinfo on all files: They all have the same dimension lengths,
>> steps and start values.
>>
>> I'm not sure whether I should run the following as you suggested earlier
>> since I've registered them to a standard template already and also because
>> they have the same dimensions.
>>
>>  If you do want to register them without prior registration, you could
>>> still get this to work by simply resampling all volumes to one of
>>> them, e.g.,
>>> mincresample -like <file1.mnc> <file2.mnc> <file2_resampled.mnc>
>>
>>
>> Claude,
>>
>> mincinfo and mincheader will give you information about the orientation
>>
>> of the images. Watch for +ve vs -ve steps, voxel sizes, start coords,
>>
>> direction cosines, storage format.
>>
>>
>> It seems like all files have very similar headers. Regardless of which site
>> the scan came from, they had the same dimension length, step, start,
>> direction cosine, and units (mm) for x, y, and z.
>> I've attached mincinfo and mincheader outputs for S1 and I1 to this email
>> for your reference.
>>
>>  For example, S1+S2+...+SN+S1+S2+... Does adding more images make
>>
>> it blow up? I want you to repeat images of the same site, not mixed
>>
>> sites.
>>
>>
>> I ran the following trials:
>>
>> 1) mincaverage -normalize -filelist all-S-site-files.txt Savg.mnc  ===> OK;
>> looks fine
>>
>> 2) mincaverage -normalize -filelist all-I-site-files.txt Iavg.mnc  ===> OK;
>> looks fine
>>
>> 3) mincaverage -normalize -filelist Savg.mnc-and-all-S-site-files.txt ===>
>> ERROR; miicv_attach: MINC package entry point
>>  ncvarid: ncid -1: NetCDF: Not a valid ID
>>
>> 3a) mincaverage -normalize -filelist Savg.mnc-and-one-S-site-file.txt ===>
>> OK.
>>
>> 3b) mincaverage -normalize -filelist Savg.mnc-and-27(out of 28
>> total)-S-site_files.txt ===> OK. Same size, looks identical to original
>> Savg.mnc
>>       However, when I ran Savg.mnc-and-27-S-site-files (removed a different
>> subject image than previously), error message "
>>       ncvarid: ncid -1: NetCDF: Not a valid ID" appeared.  Haven't tested
>> for all possible pairings.
>>
>>
>> 4) mincaverage -normalize -filelist Iavg.mnc-and-all-I-site-files.txt ===>
>> OK; looks fine, same size and looks identical to original Iavg.mnc
>>
>>
>> 4a) mincaverage -normalize -filelist Iavg.mnc-and-14(out of 15
>> total)-I-site-files.txt (tried this with removing different subjects each
>> time although I haven't tested all possible pairings) ===> OK; looks good,
>> same size, and looks identical to original Iavg.mnc
>>
>>
>>
>> It appears that there is something sketchy with the site S files rather
>> than the site I files.
>>
>> Thank you.
>>
>>
>> Best,
>> Lisa
>>
>>
>> On Sat, Mar 5, 2011 at 8:45 PM, Claude LEPAGE <claude at bic.mni.mcgill.ca>wrote:
>>
>>> Hi,
>>>
>>> I thought about the resampling issue too, as suggested by Alex,
>>> but after doing a mincaverage -help:
>>>
>>>  -check_dimensions:      Check that dimension info matches across files
>>> (default).
>>>  -nocheck_dimensions:    Do not check dimension info.
>>>
>>> It seems that the default is to check dimensions! Maybe the check
>>> is wrong...
>>>
>>> Lisa, since you don't get an error when averaging images from the
>>> same site, can you keep adding more images from the same site?
>>> For example, S1+S2+...+SN+S1+S2+... Does adding more images make
>>> it blow up? I want you to repeat images of the same site, not mixed
>>> sites.
>>>
>>> mincinfo and mincheader will give you information about the orientation
>>> of the images. Watch for +ve vs -ve steps, voxel sizes, start coords,
>>> direction cosines, storage format. Alex's suggestion to resample
>>> like a template file makes a lot of sense.
>>>
>>> When you manage to obtain an output, does it make sense when you
>>> look at it in register/Display?
>>>
>>> Claude
>>> _______________________________________________
>>> MINC-users at bic.mni.mcgill.ca
>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>>>
>>
>>
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>
>


More information about the MINC-users mailing list