123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- function saveCenters(path, patientID, cax, cm, data, nclass, nRealizations)
- %path is the core directory
- %cax are the mid intervals in images
- %cm are the interval durations (1,n)
- %data are the images
- %nclass is number of typical responses sought
- %nRealizations is number of realizations
-
- c1=size(cax,1);
- A=reshape(data,[],c1);
-
- if nclass==10
- fuzzyPar=1.5;
- end
- if nclass==20
- fuzzyPar=1.45;
- end
-
- if nclass==30
- fuzzyPar=1.4;
- end
-
-
-
- options=[fuzzyPar 100 1 true];
-
- dt=size(data);
- for j=1:nRealizations
- [centers,U]=fcm(A,nclass,options);
- for i=1:nclass
- code=sprintf('%s_%d_%d_center%d',patientID,nclass,j,i);
- ofile=fullfile(path,patientID,sprintf('%s_center.txt',code));
- try
- writematrix(centers(i,:),ofile,'Delimiter',',');
- catch ME
- dlmwrite(ofile,centers(i,:),',');
- end
- u=reshape(U(i,:),dt(1:3));
- headerInfoOut.data=single(u);
- headerInfoOut.content=sprintf('%s_centerWeight',code);
- nhdr_nrrd_write(fullfile(path,patientID, sprintf('%s_centerWeight.nrrd',code)),headerInfoOut,1);
- end
- end
-
|