%reset random generator
rng shuffle

%add nrrd processing capability
addpath('nrrd_read_write_rensonnet')

path='/home/studen/temp/dynamicSPECT';
[cax,cm]=loadTime(path,patientID);

segm=tdfread(fullfile(path,'Segmentation.tsv'));
v0=loadPixels(segm,patientID);

data=loadSPECTdata(path,patientID,cm);

sigma2=str2num(sigma2);
na=7;
fcenters=extractCenters(data,v0,sigma2,na);

%this will write out fitPar
[globalPar, cPars] = fitCentersPixel(path, patientID, cax, cm, fcenters,sigma2);

%[globalPar, cPars, xa, U]=fitFromClusters(path,cax, cm, data, nclass,realizationId);

disp('DynamicPixelAnalysis done');

%writeData
