[MINC-users] MINC support in Brainstorm

Pierre Bellec pierre.bellec at criugm.qc.ca
Thu Jul 25 10:40:34 EDT 2013


Dear François,


> For reading the nifti files, I'm using my own matlab-only function
> (attached here) that I wrote a few years ago. It's not supporting all the
> extensions of the nifti format, it reads only what we need in Brainstorm
> (volume, basic orientation of the cube, voxel size). So indeed, it's not
> that the voxel<=>world transformation is not present in the output of the
> mnc2nii file, it's just that I'm not reading it.
>
> Except for CIVET, all the other programs I know for MRI segmentation
> (FreeSurfer, BrainVISA, BrainSuite) are saving their surface files in MRI
> coordinates, there is no additional transform needed to get the
> correspondence MRI/surface. I guess this is why I never had to read those
> transformations properly.
>
> With these discussions, I realize it probably makes more sense for me to
> put efforts into reading correctly the transformation directly from the
> MINC format rather than going through the nifti format. I will try to use
> Pierre's code to get the information I need (voxel <=> world
> transformation).
>

That would be the cleanest approach indeed.


> Apparently, it is also the easiest way for me to get a fully scripted
> function, with no compilation involved (easier to maintain and distribute).
> Matlab supports natively NetCDF and HDF5 formats, no need to redistribute
> additional libraries.
>
> Agreed, that's why despite all the work involved and the overlap with some
other projects (including NIAK) I still felt it was necessary to get the
MOMINC library done eventually.

Pierre: Can I distribute your code with the the main Brainstorm
> distribution in the "external" folder?
>

Absolutely.


> Do you want to attach a copyright notice on top of what is already in the
> code?
>
> Nope, MIT license in the code is fine.

I'll try to finish a beta version that works with both MINC1 and MINC2 by
next week. Best,

Pierre


> Thank you for you help!
> Francois
>
>
>
>
> On 23/07/2013 11:38 PM, Pierre Bellec wrote:
>
>> Dear François (and Andrew),
>>
>>
>>> 2) The mnc2nii solution is not going to be a valid long-term solution for
>>> one specific reason: the import of the CIVET output surfaces in
>>> Brainstorm.
>>> By converting to NIfTI, we lose the initial MINC coordinate system, on
>>> which all the CIVET output is based. If I don't have access to the origin
>>> of the referential, I don't think I can register correctly the cortical
>>> envelopes generated by CIVET with the corresponding T1 MRI.
>>> Therefore we will need a different solution for importing the MINC
>>> volumes.
>>>
>>>
>>>  As Andrew said, the conversion from minc to nifti should retain the
>> correct
>> voxel-to-world transformation. Hopefully this will be fixed once and for
>> all by Andrew with niftilib. Great to hear about that very useful future
>> development.
>>
>>
>>  3) Since HDF5 and netCDF are formats that are fully supported in many
>>> platform-independent languages (Java, Matlab, Python), will there be at
>>> some point a MINC reader available that does not rely on any external
>>> compiled library?
>>> I looked at Pierre Bellec's Matlab functions (
>>> http://code.google.com/p/**
>>> mominc/ <http://code.google.com/p/**mominc/<http://code.google.com/p/mominc/>>),
>>> but for what I understood it
>>>
>>> does the reading of the HDF5/netCDF contents and does not provide any
>>> tool
>>> to re-orient the the volume in another standard coordinate system (such
>>> as
>>> NIfTI).
>>> There is probably not much to add to get a Matlab-based (or Java-based)
>>> version of mnc2nii (that reads the MINC volume into a NIfTI-oriented
>>> volume
>>> but with the full MINC header information).
>>> Are there other solutions readily available to help us with this MINC
>>> import?
>>> Is anybody working on or interested in those aspects at the present time?
>>>
>>>
>>>  I have put some efforts in mominc from time to time, and I am confident
>> a
>> reliable reader can be implemented for minc1 and minc2 in matlab, and
>> minc1
>> for octave. I haven't prototyped the writer, but it should work. A lot of
>> what's left to do for the reader is to run some systematic test (with some
>> fancy slice-based intensity normalization) and finalize the fields of the
>> header to retain compatibility with the reader/writer in NIAK (which is a
>> different beast altogether based on system calls to the minc tools).
>> Regarding the limitation you mentioned on the re-orientation, I have added
>> a few features from NIAK in minc_read (for MINC1 files only for now, MINC2
>> will crash). If you download the head revision of the
>> code<https://code.google.com/**p/mominc/source/checkout<https://code.google.com/p/mominc/source/checkout>>
>> (I'll
>>
>> also send it to you by email) and run something like:
>>
>> [hdr,vol] = minc_read('test.mnc');
>>
>> you'll get a field hdr.info.mat which is a 4 x 4 transformation matrix
>> from
>> voxel coordinates to world coordinates. If you want to get a list of world
>> coordinates for each voxel (and assuming vol is 3D):
>>
>> ind = find(true(size(vol)));
>> [x,y,z] = ind2sub(size(vol),ind);
>> coord_w = minc_voxel2world([x,y,z],hdr.**info.mat);
>>
>> COORD_W is an array (nb_voxel x 3) where each row is the world coordinates
>> of one voxel in the volume. You can use MINC_WORLD2VOXEL to go the other
>> way around. If you want to have a volume that has been resampled such that
>> the first dimension is "left to right", the second is "caudal to rostral"
>> and the third is "ventral to dorsal", and the voxel to world
>> transformation
>> has a diagonal matrix for rotation, with diagonal elements coding only for
>> voxel size, I can implement that as well.
>>
>> Let me know if you think this could solve your problem and, if so, I'll
>> help wrap that up.
>>
>> Best,
>>
>> Pierre
>>
>> Those would be very helpful tools for us and probably for the developers
>> of
>>
>>> other software packages as well. We would be willing to help for any new
>>> developments in this direction, and more generally support the
>>> integration
>>> between the different software environments at the Neuro.
>>>
>>> Thanks
>>> Francois
>>>
>>>
> --
> François Tadel, MSc
> MEG / McConnell Brain Imaging Center / MNI / McGill University
> 3801 rue University, Montreal, QC H3A2B4, Canada
>
>


More information about the MINC-users mailing list