I’m trying to understand the issues related to mri_convert.

 

It looks like you did the following:

1. mri_convert aparc.DKTatlas+aseg.deep.mgz aparc.DKTatlas+aseg.deep.nii.gz

2. saved the manually edited as aparc.DKTatlas+aseg.deep.edited.nii.gz

3. mri_convert aparc.DKTatlas+aseg.deep.edited.nii.gz aparc.DKTatlas+aseg.deep.edited.mgz

3. MRIcron complained about the first number is not 1 when you tried to open aparc.DKTatlas+aseg.deep.edited.mgz (There is no error when you open aparc.DKTatlas+aseg.deep.mgz)

 

Which version of Freesurfer are you using? We changed the first number to encode the mgz_intent_code. In dev version of Freesurfer, the first number is not always 1 in .mgz. It is ‘((mgz_intent_code & 0xff ) << 8) | 1’ depending on mgz_intent_code. In your case, it should be mgz_intent_code=0 and first number=1.

 

mri_info reports intent if you are using dev version.

 

Best,

 

Yujing

 

 

 

From: freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> On Behalf Of Tsigaras, Thanos
Sent: Wednesday, May 15, 2024 4:38 AM
To: freesurfer@nmr.mgh.harvard.edu
Subject: [Freesurfer] Issue related to converting .nii.gz file to .mgz using FreeSurfer's mri_convert

 

        External Email - Use Caution        

Hello FreeSurfer Developers,

I am using FastSurfer for this processing, but the issue is related to FreeSurfer's mri_convert function. I wanted to perform some manual segmentation edits on the "aparc.DKTatlas+aseg.deep.mgz" output file of FastSurfer. Since ITK-SNAP can't open .mgz files, I used the mri_convert function to convert the .mgz file to .nii.gz. I performed the edits and tried to rerun FastSurfer using the manually edited .nii.gz file. I got the error:

 

"ERROR: Specified segmentation output and conformed image output do not have same file type.

You passed --asegdkt_segfile directory/to/aparc.DKTatlas+aseg.deep.nii.gz and --conformed_name directory/to/orig.mgz.

Make sure these have the same file-format and adjust the names passed to the flags accordingly!"

 

So I used mri_convert once again to convert the .nii.gz file back to .mgz. When tried to rerun FastSurfer, I got the error:

 

"You passed --surf_only or --no_asegdkt, but the whole-brain segmentation (directory/to/aparc.DKTatlas+aseg.deep.edited.mgz) could not be found."

 

I also tried opening the .mgz edited file using MRIcron, but I get an error there as well: "Error: first value in a MGH header should be 1 (got 1) and data type should be in the range 1..4. (got 10)", which is not the case when I open the original .mgz file. The way I am using the mri_convert function is simply "mri_convert aparc.DKTatlas+aseg.deep.edited.nii.gz aparc.DKTatlas+aseg.deep.edited.mgz".


I've searched the list and no similar errors have been reported. Please let me know if you need more details to help me troubleshoot this issue. For your time and help I would like to thank you in advance!

Best regards

Thanos Tsigaras



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Stefan Müller
Geschäftsführung: Prof. Dr. Astrid Lambrecht (Vorsitzende),
Karsten Beneke (stellv. Vorsitzender), Dr. Ir. Pieter Jansens
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------