I never used Analyse HDR/IMG format before so I can't tell if the conversion with dcm2nii works, but it may be worth a shot.
Are you on Linux or Mac OS X? If you send me the output of the command `head -c350 <path-to-nifti-file> | hexdump -Cv`, where <path-to-nifti-file> is the path to your NIFTI file, I could have a look for you if it is the same problem. If you are on Windows, you could use a Hex Editor (I used http://www.hexedit.com/hex-edit-shots.htm a long time ago) to do the same in a graphical user interface. Open the NIFTI file in the Hex Editor and send me a screenshot with the contents at the start of the file. Jalmar > On 10 Jun 2015, at 11:46, Kriegel, Jennifer Lynn Sarai > <jlk130...@utdallas.edu> wrote: > > Hi Jalmar, > > Thanks, that's very helpful because the files I am working with have been > transformed more than once, and were originally par/rec files. I do not have > those original files - I only have the analyze files which I was trying to > convert to .nii, since the hdr file gives a different error than the bad > magic number from the .nii. The transformation matrix sounds like it was the > answer I was looking for but I wouldn't know where to find it, or what it > should contain. > > I appreciate this information. > > Best, > Jennifer > > > > -----Original Message----- > From: freesurfer-boun...@nmr.mgh.harvard.edu > [mailto:freesurfer-boun...@nmr.mgh.harvard.edu] On Behalf Of Jalmar Teeuw > Sent: Wednesday, June 10, 2015 4:10 AM > To: Freesurfer support list > Subject: Re: [Freesurfer] bad magic number > > Hi Jennifer, > > We had the same problem with importing scans into Freesurfer that had been > converted from PAR/REC to NIFTI using nipy. The problem only affected a > subset of the data. When visualising the data with Fiji the brain appeared > highly skewed. Upon closer inspection of the header data of the NIFTI file we > discovered that there was an extra byte somewhere between the description > fields and the magic number sequence, causing the magic number to be > misinterpreted by Freesurfer. The extra byte was somewhere in the > transformation matrix that is located between the description field and the > magic number, but it's impossible to fix unless you know what the content of > the transformation matrix is supposed to be. However, when using dcm2nii, > part of mricron (from what I understand a newer version of mricro), to > convert our PAR/REC files to NIFTI the problem disappeared. > > Maybe you could try dcm2nii and see if that helps your case as well? It's > available from here: > http://www.mccauslandcenter.sc.edu/mricro/mricron/install.html > > If you are on Linux or Mac OS X you could try to run the command `head -c350 > <path-to-nifti-file> | hexdump -Cv`, where <path-to-nifti-file> is the path > to your NIFTI file. This command will print the first 350 bytes of the NIFTI > file that contains the header (plus two extra bytes) in hexadecimal and ASCII > format. I don't have an example available at the moment, but the header > should end in 'ni1..' or 'n+1..' in the rightmost column. If you get 'ni1.' > or 'n+1.' (only one dot at the end), you probably have the same problem as we > experienced. We don't know the origin of this extra byte, but most likely it > is a bug in the conversion software that is affecting only some of the scans. > > Regards, > Jalmar > >> On 09 Jun 2015, at 22:21, Kriegel, Jennifer Lynn Sarai >> <jlk130...@utdallas.edu> wrote: >> >> mricro >> >> -----Original Message----- >> From: freesurfer-boun...@nmr.mgh.harvard.edu >> [mailto:freesurfer-boun...@nmr.mgh.harvard.edu] On Behalf Of Douglas N >> Greve >> Sent: Tuesday, June 09, 2015 3:16 PM >> To: freesurfer@nmr.mgh.harvard.edu >> Subject: Re: [Freesurfer] bad magic number >> >> how was it created? >> >> On 06/09/2015 04:03 PM, Kriegel, Jennifer Lynn Sarai wrote: >>> MRIcro opens it, and so does SPM 8. >>> >>> >>> >>> -----Original Message----- >>> From: freesurfer-boun...@nmr.mgh.harvard.edu >>> [mailto:freesurfer-boun...@nmr.mgh.harvard.edu] On Behalf Of Bruce >>> Fischl >>> Sent: Tuesday, June 09, 2015 3:02 PM >>> To: Freesurfer support list >>> Subject: Re: [Freesurfer] bad magic number >>> >>> Hi Jennifer >>> >>> can MRIcro read it? Usually that means it is corrupted Bruce >>> >>> >>> On Tue, 9 Jun 2015, Kriegel, Jennifer Lynn Sarai >>> wrote: >>> >>>> Hi, >>>> >>>> >>>> >>>> I’m getting a bad magic number error using mri_convert. I’m trying >>>> to convert a .nii file to a .mgz file. I’ve searched all over and >>>> all I can find is that you can use python in another program to >>>> delete this number, and it is related to the file extension. I’ve >>>> tried using the >>>> .nifti1 extension, as well as .nii, as I have a .img file in the >>>> folder as well, but then it doesn’t recognize the file extension. >>>> The files were converted using mricro from hdr/img MPRAGE files to correct >>>> orientation into the .nii files. >>>> >>>> >>>> >>>> I also tried using the original .hdr file to convert, and it spits >>>> out an orientation error. >>>> >>>> >>>> >>>> Any help would be appreciated. >>>> >>>> >>>> >>>> >>>> >>>> - Jennifer Lynn Sarai Kriegel >>>> >>>> MS in Psychological Sciences, Cognition and Neuroscience Emphasis >>>> >>>> Functional Neuroimaging of Memory Lab, Center for Vital Longevity >>>> >>>> The University of Texas at Dallas >>>> >>>> jlk130...@utdallas.edu >>>> >>>> ------------------------------------------------------------ >>>> >>>> I am looking for a lot of men who have an infinite capacity to not >>>> know what can't be done. >>>> >>>> - Henry Ford >>>> >>>> >>>> >>>> The important thing is not to stop questioning. Curiosity has its >>>> own reason for existing. >>>> >>>> - Albert Einstein >>>> >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Freesurfer mailing list >>> Freesurfer@nmr.mgh.harvard.edu >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>> >>> >> >> -- >> Douglas N. Greve, Ph.D. >> MGH-NMR Center >> gr...@nmr.mgh.harvard.edu >> Phone Number: 617-724-2358 >> Fax: 617-726-7422 >> >> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 >> www.nmr.mgh.harvard.edu/facility/filedrop/index.html >> Outgoing: >> ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ >> >> _______________________________________________ >> Freesurfer mailing list >> Freesurfer@nmr.mgh.harvard.edu >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >> >> >> The information in this e-mail is intended only for the person to whom it is >> addressed. If you believe this e-mail was sent to you in error and the >> e-mail contains patient information, please contact the Partners Compliance >> HelpLine at http://www.partners.org/complianceline . If the e-mail was sent >> to you in error but does not contain patient information, please contact the >> sender and properly dispose of the e-mail. >> >> _______________________________________________ >> Freesurfer mailing list >> Freesurfer@nmr.mgh.harvard.edu >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer