help > Co-registration in V1.3
Showing 1-4 of 4 posts
Display:
Results per page:
Dec 20, 2019  09:12 PM | Kate Marvel - KAUST
Co-registration in V1.3
Dear Prof Schwarz,

I have downloaded MCALT V1.3 and am trying to run the matlab script. I got an error.  Please see below. Your great assistance is appreciated.


>> addpath C:\Users\kate\Documents\spm12
>> inFile = "C:\Users\kate\images\mprage_T1.nii"

inFile =

"C:\Users\kate\images\mprage_T1.nii"

>> outDir = "C:\Users\kate\images"

outDir =

"C:\Users\kate\images"

>> MCALT_T1File = which('MCALT_T1.nii');
>> MCALT_TPMFile = "C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3\MCALT_tpm.nii";
>> startTime = tic;
>> owd=pwd;
>> cleanupVar = onCleanup(@()cd(owd));
>> if ~exist('inFile','var') || isempty(inFile)
help(mfilename);
return;
end
>> [fpath,fbase,fext]=fileparts(inFile);
>> if ~exist('outDir','var') || isempty(outDir)
outDir=[fpath filesep 'seg12'];
end
>> if ~exist(outDir,'dir')
mkdir(outDir);
end
>> copyfile(inFile,outDir);
>> chdir(outDir);
>> jobFile={which('MCALT_spm12_segment_job.m')};
>> [~,fb]=fileparts(jobFile{1});
>> fb

fb =

'MCALT_spm12_segment_job'

>> clear matlabbatch;
>> eval(fb);
>> if ~exist('matlabbatch','var')
error('MCALT_spm12_segment:noMatlabBatch','cannot get matlabbatch struct from %s',jobFile{1});
end
>> matlabbatch{1}.spm.spatial.preproc.channel.vols = {[fbase fext ',1']};
>> for i=1:length(matlabbatch{1}.spm.spatial.preproc.tissue)
matlabbatch{1}.spm.spatial.preproc.tissue(i).tpm{1}=[MCALT_TPMFile ',' num2str(i)];
end
>> spm('defaults', 'PET');
>> disp('Initializing subject->template registration with spm_coreg');
Initializing subject->template registration with spm_coreg
>> regInit=spm_coreg(matlabbatch{1}.spm.spatial.preproc.channel.vols{1},MCALT_T1File);

SPM12: spm_coreg (v7320) 09:48:17 - 02/12/2019
========================================================================
No appropriate method, property, or field 'pinfo' for class 'string'.

Error in spm_coreg>loaduint8 (line 229)
if size(V.pinfo,2)==1 && V.pinfo(1) == 2

Error in spm_coreg (line 127)
VG.uint8 = loaduint8(VG);

>> addpath C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3
>> regInit=spm_coreg(matlabbatch{1}.spm.spatial.preproc.channel.vols{1},MCALT_T1File);

SPM12: spm_coreg (v7320) 09:49:08 - 02/12/2019
========================================================================
No appropriate method, property, or field 'pinfo' for class 'string'.

Error in spm_coreg>loaduint8 (line 229)
if size(V.pinfo,2)==1 && V.pinfo(1) == 2

Error in spm_coreg (line 127)
VG.uint8 = loaduint8(VG);

>> regInit=spm_coreg(matlabbatch{1}.spm.spatial.preproc.channel.vols{1},MCALT_T1File);

SPM12: spm_coreg (v7320) 09:52:03 - 02/12/2019
========================================================================
No appropriate method, property, or field 'pinfo' for class 'string'.

Error in spm_coreg>loaduint8 (line 229)
if size(V.pinfo,2)==1 && V.pinfo(1) == 2

Error in spm_coreg (line 127)
VG.uint8 = loaduint8(VG);

>> matlabbatch{1}.spm.spatial.preproc.channel.vols

ans =

1×1 cell array

{1×3 string}

>> matlabbatch{1}.spm.spatial.preproc.channel.vol{1}
Reference to non-existent field 'vol'.

Did you mean:
>> matlabbatch{1}.spm.spatial.preproc.channel.vols{1}

ans =

1×3 string array

"LPA_s3543942_e38076_N4_corrected" ".nii" ",1"

>> MCALT_T1File

MCALT_T1File =

0×0 empty char array

>> MCALT_T1File

MCALT_T1File =

0×0 empty char array

>> MCALT_T1File = which('MCALT_T1.nii');
>> MCALT_T1File

MCALT_T1File =

'C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3\MCALT_T1.nii'

>> MCALT_TPMFile = "C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3\MCALT_tpm.nii";
>> MCALT_TPMFile

MCALT_TPMFile =

"C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3\MCALT_tpm.nii"

>> MCALT_T1File

MCALT_T1File =

'C:\Users\kate\Documents\spm12\toolbox\MCALT_v1.3\MCALT_T1.nii'

>> regInit=spm_coreg(matlabbatch{1}.spm.spatial.preproc.channel.vols(1),MCALT_T1File);

SPM12: spm_coreg (v7320) 09:58:28 - 02/12/2019
========================================================================
Dot indexing is not supported for variables of this type.

Error in spm_coreg>loaduint8 (line 229)
if size(V.pinfo,2)==1 && V.pinfo(1) == 2

Error in spm_coreg (line 127)
VG.uint8 = loaduint8(VG);

>> matlabbatch{1}.spm.spatial.preproc.channel.vols(1)

ans =

1×1 cell array

{1×3 string}

>> matlabbatch{1}.spm.spatial.preproc.channel.vols{1}

ans =

1×3 string array

"LPA_s3543942_e38076_N4_corrected" ".nii" ",1"

>> regInit=spm_coreg(matlabbatch{1}.spm.spatial.preproc.channel.vols{1},MCALT_T1File);

SPM12: spm_coreg (v7320) 09:59:31 - 02/12/2019
========================================================================
No appropriate method, property, or field 'pinfo' for class 'string'.

Error in spm_coreg>loaduint8 (line 229)
if size(V.pinfo,2)==1 && V.pinfo(1) == 2

Error in spm_coreg (line 127)
VG.uint8 = loaduint8(VG);


Thanks,

kate
Jan 2, 2020  08:01 PM | Christopher Schwarz - Mayo Clinic
RE: Co-registration in V1.3
I think your primary issue is that you defined your file paths using double quotes (strings), which aren't supported by this or most SPM functions. You need to use character arrays, which are defined using single rather than double quotation marks. 

Chris
Jan 3, 2020  05:01 PM | Christopher Schwarz - Mayo Clinic
RE: Co-registration in V1.3
FYI in the next release I will update the function to detect string-type inputs and convert them to char-type to avoid this error.
Jan 28, 2020  04:01 PM | Kate Marvel - KAUST
RE: Co-registration in V1.3
Thank you very much Prof Schwarz. It works now after making the string in single quotes. 

kate