Re: [Freesurfer] Error in MATLAB while using freesurfer commands

2019-12-30 Thread Bruce Fischl
You can unzip it outside of freesurfer and name it *.mgh then see if it works

cheers
Bruce
> On Dec 30, 2019, at 3:49 AM, mahdi mahdavi  wrote:
> 
> 
> External Email - Use Caution
> 
> I think a part of the problem is from this part in load_mgh.m:
> 
> % unzip if it is compressed 
> if (strcmpi(fname((strlen(fname)-3):strlen(fname)), '.MGZ') | ...
> strcmpi(fname((strlen(fname)-3):strlen(fname)), '.GZ'))
>   rand('state', sum(100*clock));
>   gzipped =  round(rand(1)*1000 + ...
>   sum(int16(fname))) + round(cputime);
>   %ind = findstr(fname, '.');
>   %new_fname = sprintf('/tmp/tmp.load_mgh.%d.mgh', gzipped);
>   new_fname = sprintf('%s.load_mgh.%d.mgh', tempname,gzipped);
> 
>   if(strcmp(computer,'MAC') || strcmp(computer,'MACI') || ismac)
> unix(sprintf('gunzip -c %s > %s', fname, new_fname)) ;
>   else
> unix(sprintf('zcat %s > %s', fname, new_fname)) ;
>   end
>   fname = new_fname ;
> else
>   gzipped = -1 ;
> end
> 
> there is no command for windows (just mac and linux it seems) and matlab cant 
> recognize the zcat linux command (my linux shell, however, recognizes it). i  
> dont know how to modify this part to prevent the not recognized z cat error.
> 
>> On Mon, Dec 30, 2019 at 11:39 AM mahdi mahdavi  
>> wrote:
>> I wanted to test the QuickNATv2 MATLAB and since I saw that it used 
>> freesufer, I used one of the samples in the subjects folder of freesurfer 
>> (sample-001.mgz), conformed it to 256^3( the QuickNAT required 256^3) and 
>> saved it as subject-0001.mgz. I'm sending you the screenshot of mri_info 
>> subject-0001.mgz. Oh i also forgot to send you the complete MATLAB error; 
>> it's complete form is like this:
>> 'zcat' is not recognized as an internal or external command, 
>> operable program or batch file. 
>> ERROR: problem reading fname
>> 'rm' is not recognized as an internal or external command, 
>> operable program or batch file. 
>> SWITCH expression must be a scalar or a character vector.
>> 
>> Error in load_mgh (line 158)
>> switch type
>> 
>> Error in MRIread (line 87)
>>   [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);
>> 
>> Error in RunFile (line 15)
>> DataVol = MRIread([DataPath,FileName]);
>> 
>> I saw somewhere that the problem might be from the .mgz file so i extracted 
>> it using Winrar and renamed it subject-0001.mgh and this time it showed this 
>> error: 
>> ERROR: could not open C:\Users\home\Desktop\Project 
>> code\QuickNATv2\SampleDatasample-0001.mgh for reading
>> ERROR: loading C:\Users\home\Desktop\Project 
>> code\QuickNATv2\SampleDatasample-0001.mgh as MGH
>> Dot indexing is not supported for variables of this type.
>> 
>> Error in RunFile (line 16)
>> Data = DataVol.vol
>> 
>>  
>> >>  
>> 
>>> On Sun, Dec 29, 2019 at 10:56 PM Bruce Fischl  
>>> wrote:
>>> Hi Mahdi
>>> 
>>> can you run mri_info in a Linux shell on that file and send us the entire 
>>> screen output?
>>> 
>>> cheers
>>> Bruce
>>> On Sun, 29 Dec 2019, mahdi mahdavi wrote:
>>> 
>>> > 
>>> > External Email - Use Caution
>>> > 
>>> > Hi. I'm a medical student and I'm trying to use the QuickNATv2 MATLAB 
>>> > code for
>>> > structural MRI segmentation for a paper. However, at the last step when I 
>>> > want to
>>> > execute the Run command for this program, it returns an error related to 
>>> > MRIRead
>>> > function from freesurfer. I'm, using windows so I Cloned freesurfer 
>>> > library from
>>> > github and defined its path for MATLAB. The error is: SWITCH expression 
>>> > must be a
>>> > scalar or a character vector;  the MRI data is a .mgz file:
>>> > 
>>> > Error in load_mgh (line 166)
>>> > switch type
>>> > 
>>> > Error in MRIread (line 94)
>>> >   [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);
>>> > 
>>> > Error in RunFile (line 15)
>>> > DataVol = MRIread([DataPath,FileName]);
>>> > I've also tried using linux shell for windows 10 and installed the 
>>> > freesurfer with
>>> > it but i still get the same error. I didn't find any helpful guides on 
>>> > various
>>> > forums so I'm mailing you hoping to find a solution cause I really need 
>>> > to run
>>> > the  QuickNAT for a paper.
>>> > Regards 
>>> > Mahdi
>>> > 
>>> > 
>>> >___
>>> 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

Re: [Freesurfer] Error in MATLAB while using freesurfer commands

2019-12-30 Thread mahdi mahdavi
External Email - Use Caution

I think a part of the problem is from this part in load_mgh.m:

% unzip if it is compressed
if (strcmpi(fname((strlen(fname)-3):strlen(fname)), '.MGZ') | ...
strcmpi(fname((strlen(fname)-3):strlen(fname)), '.GZ'))
  rand('state', sum(100*clock));
  gzipped =  round(rand(1)*1000 + ...
  sum(int16(fname))) + round(cputime);
  %ind = findstr(fname, '.');
  %new_fname = sprintf('/tmp/tmp.load_mgh.%d.mgh', gzipped);
  new_fname = sprintf('%s.load_mgh.%d.mgh', tempname,gzipped);

  if(strcmp(computer,'MAC') || strcmp(computer,'MACI') || ismac)
unix(sprintf('gunzip -c %s > %s', fname, new_fname)) ;
  else
unix(sprintf('zcat %s > %s', fname, new_fname)) ;
  end
  fname = new_fname ;
else
  gzipped = -1 ;
end

there is no command for windows (just mac and linux it seems) and matlab
cant recognize the zcat linux command (my linux shell, however, recognizes
it). i  dont know how to modify this part to prevent the not recognized z
cat error.

On Mon, Dec 30, 2019 at 11:39 AM mahdi mahdavi 
wrote:

> I wanted to test the QuickNATv2 MATLAB and since I saw that it used
> freesufer, I used one of the samples in the subjects folder of freesurfer
> (sample-001.mgz), conformed it to 256^3( the QuickNAT required 256^3) and
> saved it as subject-0001.mgz. I'm sending you the screenshot of mri_info
> subject-0001.mgz. Oh i also forgot to send you the complete MATLAB error;
> it's complete form is like this:
> 'zcat' is not recognized as an internal or external command,
> operable program or batch file.
> ERROR: problem reading fname
> 'rm' is not recognized as an internal or external command,
> operable program or batch file.
> SWITCH expression must be a scalar or a character vector.
>
> Error in load_mgh (line 158)
> switch type
>
> Error in MRIread (line 87)
>   [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);
>
> Error in RunFile (line 15)
> DataVol = MRIread([DataPath,FileName]);
>
> I saw somewhere that the problem might be from the .mgz file so i
> extracted it using Winrar and renamed it subject-0001.mgh and this time it
> showed this error:
> ERROR: could not open C:\Users\home\Desktop\Project
> code\QuickNATv2\SampleDatasample-0001.mgh for reading
> ERROR: loading C:\Users\home\Desktop\Project
> code\QuickNATv2\SampleDatasample-0001.mgh as MGH
> Dot indexing is not supported for variables of this type.
>
> Error in RunFile (line 16)
> Data = DataVol.vol
>
>
> >>
>
> On Sun, Dec 29, 2019 at 10:56 PM Bruce Fischl 
> wrote:
>
>> Hi Mahdi
>>
>> can you run mri_info in a Linux shell on that file and send us the entire
>> screen output?
>>
>> cheers
>> Bruce
>> On Sun, 29 Dec 2019, mahdi mahdavi wrote:
>>
>> >
>> > External Email - Use Caution
>> >
>> > Hi. I'm a medical student and I'm trying to use the QuickNATv2 MATLAB
>> code for
>> > structural MRI segmentation for a paper. However, at the last step when
>> I want to
>> > execute the Run command for this program, it returns an error related
>> to MRIRead
>> > function from freesurfer. I'm, using windows so I Cloned freesurfer
>> library from
>> > github and defined its path for MATLAB. The error is: SWITCH expression
>> must be a
>> > scalar or a character vector;  the MRI data is a .mgz file:
>> >
>> > Error in load_mgh (line 166)
>> > switch type
>> >
>> > Error in MRIread (line 94)
>> >   [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);
>> >
>> > Error in RunFile (line 15)
>> > DataVol = MRIread([DataPath,FileName]);
>> > I've also tried using linux shell for windows 10 and installed the
>> freesurfer with
>> > it but i still get the same error. I didn't find any helpful guides on
>> various
>> > forums so I'm mailing you hoping to find a solution cause I really need
>> to run
>> > the  QuickNAT for a paper.
>> > Regards
>> > Mahdi
>> >
>> >
>> >___
>> 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

Re: [Freesurfer] Error in MATLAB while using freesurfer commands

2019-12-29 Thread Bruce Fischl

Hi Mahdi

can you run mri_info in a Linux shell on that file and send us the entire 
screen output?


cheers
Bruce
On Sun, 29 Dec 2019, mahdi mahdavi wrote:



External Email - Use Caution

Hi. I'm a medical student and I'm trying to use the QuickNATv2 MATLAB code for
structural MRI segmentation for a paper. However, at the last step when I want 
to
execute the Run command for this program, it returns an error related to MRIRead
function from freesurfer. I'm, using windows so I Cloned freesurfer library from
github and defined its path for MATLAB. The error is: SWITCH expression must be 
a
scalar or a character vector;  the MRI data is a .mgz file:

Error in load_mgh (line 166)
switch type

Error in MRIread (line 94)
  [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);

Error in RunFile (line 15)
DataVol = MRIread([DataPath,FileName]);
I've also tried using linux shell for windows 10 and installed the freesurfer 
with
it but i still get the same error. I didn't find any helpful guides on various
forums so I'm mailing you hoping to find a solution cause I really need to run
the  QuickNAT for a paper.
Regards 
Mahdi


___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

[Freesurfer] Error in MATLAB while using freesurfer commands

2019-12-29 Thread mahdi mahdavi
External Email - Use Caution

Hi. I'm a medical student and I'm trying to use the QuickNATv2 MATLAB code
for structural MRI segmentation for a paper. However, at the last step when
I want to execute the Run command for this program, it returns an error
related to MRIRead function from freesurfer. I'm, using windows so I Cloned
freesurfer library from github and defined its path for MATLAB. The error
is:
SWITCH expression must be a scalar or a character vector;  the MRI data is
a .mgz file:

Error in load_mgh (line 166)
switch type

Error in MRIread (line 94)
  [mri.vol, M, mr_parms, volsz] = load_mgh(fspec,[],[],headeronly);

Error in RunFile (line 15)
DataVol = MRIread([DataPath,FileName]);
I've also tried using linux shell for windows 10 and installed the
freesurfer with it but i still get the same error. I didn't find any
helpful guides on various forums so I'm mailing you hoping to find a
solution cause I really need to run the  QuickNAT for a paper.
Regards
Mahdi
___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer