finnlennartsson / kpum_noddi

repo for processing of DKI/NODDI data for preterm project at KPUM
0 stars 0 forks source link

Invoke NODDI Toolbox from dmri_noddi.sh-script #3

Closed finnlennartsson closed 1 year ago

finnlennartsson commented 1 year ago

https://github.com/finnlennartsson/kpum_noddi/blob/fcb31888c15ebe662da77da914419c8e4464b464/scripts/dmri_noddi.sh#L115

Make a command that runs NODDI matlab-script from the script

finnlennartsson commented 1 year ago

This can be done by either using the NODDI Toolbox and -nojvm

or

Use AMICO

finnlennartsson commented 1 year ago

Installed AMICO

pip install ipython
conda activate py38
pip install dmri-amico -U
finnlennartsson commented 1 year ago

Running Matlab from command line can be done like this

matlab -nodesktop -nosplash -r "clc; clear all; addpath(genpath('$HOME/Software/vistasoft')); STRUCTURAL=niftiRead('${T2N4}.nii.gz'); x=STRUCTURAL.dim(1); y=STRUCTURAL.dim(2); z=STRUCTURAL.dim(3); bigMat=zeros(x*y*z,4); for i=1:4; nii=niftiRead(sprintf('${T2N4}-Pmap-000%d.nii.gz',i)); bigMat(:,i)=nii.data(:); end; bigMat2=bigMat; for j=1:x*y*z; bigMat2(j,:)=bigMat(j,:)./sum(bigMat(j,:)); end; for k=1:4; nii=niftiRead(sprintf('${T2N4}-Pmap-000%d.nii.gz',k)); nii.data=reshape(bigMat2(:,k),[x y z]); niftiWrite(nii,sprintf('${T2N4}-normalized-Pmap-000%d.nii.gz',k)); end; exit"
finnlennartsson commented 1 year ago

This has now been solved in https://github.com/finnlennartsson/kpum_noddi/blob/6d4aaea47b62155589b67f666d573c7bb8dfb0aa/shell/dmri_noddi.sh#L119