ledigchr / MALPEM

MALPEM whole-brain segmentation framework
Other
20 stars 10 forks source link

File does not exist: tmp_fusion/1000_noN4_masked_scaled.nii.gz #1

Closed schuhschuh closed 5 years ago

schuhschuh commented 8 years ago

When using the options -m, --noN4, and --noN4_after_pincram, I get a File does not exist error regarding 1000_noN4_masked_scaled.nii.gz.

as12312@merapi:/homes/as12312/Experiments/MALPEM/MAL35
> malpem -i /homes/as12312/Datasets/MAL35/N4/1000.nii.gz -o /homes/as12312/Experiments/MALPEM/MAL35 -f 1.5T -m /homes/as12312/Datasets/MAL35/Masks/PINCRAM+Labels/1000.nii.gz --noN4 --noN4_after_pincram --nosubdir -t 8
--------------------------------------
Input file: /homes/as12312/Datasets/MAL35/N4/1000.nii.gz
Output directory: /homes/as12312/Experiments/MALPEM/MAL35
Field strength: 1.5T
Max. threads: 8
Using input mask:  /homes/as12312/Datasets/MAL35/Masks/PINCRAM+Labels/1000.nii.gz
Using input segmentation:  False
Using transformation to initialise MNI alignment:  False
Performing initial bias correction: False
Stopping after brain extraction: False
Perform another N4 bias correction after the brain extraction: False
Create a subdirectory for output: False
Create final pdf report: True
Will clean up once finished: False
--------------------------------------

--- STARTED Whole-brain segmentation pipeline (MALPEM) ---
Skipping bias correction: file exists / specified by user
--- STARTED Registration (rigid) ---
--- FINISHED Registration (rigid) in 0:00:44 ---
--- STARTED apply brain mask ---
--- FINISHED apply brain mask in 0:00:04 ---
--- STARTED Whole-brain segmentation pipeline (MALPEM) ---
--- STARTED Registration (nonrigid) ---
[...]
--- FINISHED Label propagation in 1:38:40 ---
--- STARTED locally weighted label fusion ---
--- STARTED Robust intensity rescaling ---
--- ERROR: File does not exist (/homes/as12312/Experiments/MALPEM/MAL35/tmp_fusion/1000_noN4_masked_scaled.nii.gz):  ---

PS: Ignore the fact I am trying to segment an image that is part of the atlas. Just a test run ;-).

schuhschuh commented 8 years ago

Probably I get this error because I used malpem directly, not malpem-proot?!?

Here's the log/normalise-1000_noN4_masked.log:

/vol/biomedic/users/as12312/malpem-1.2/lib/scale /homes/as12312/Experiments/MALPEM/MAL35/1000_noN4_masked.nii.gz /homes/as12312/Experiments/MALPEM/MAL35/tmp_fusion/1000_noN4_masked_scaled.nii.gz /homes/as12312/Experiments/MALPEM/MAL35 >> /homes/as12312/Experiments/MALPEM/MAL35/log/normalise-1000_noN4_masked.log 2>&1
mkdir: cannot create directory ‘/homes/as12312/Experiments/MALPEM/MAL35/tmp/’: File exists
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 26: cl_erosion: command not found
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 28: seg_stats: command not found

/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 37: seg_maths: command not found
(standard_in) 2: syntax error

/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 42: seg_maths: command not found
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 43: seg_maths: command not found
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 44: seg_maths: command not found
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 46: seg_maths: command not found
/vol/biomedic/users/as12312/malpem-1.2/lib/scale: line 47: seg_maths: command not found
rm: cannot remove ‘/homes/as12312/Experiments/MALPEM/MAL35/tmp/1000_noN4_masked_tmp.nii.gz’: No such file or directory
rm: cannot remove ‘/homes/as12312/Experiments/MALPEM/MAL35/tmp/1000_noN4_masked_peaks.nii.gz’: No such file or directory
schuhschuh commented 8 years ago

I guess this line in the scale script should either include the ${curdir}/irtk directory or be changed to PATH="${curdir}/irtk:$PATH".

Trying it.

ledigchr commented 8 years ago

Your first problem is caused by a known bug in the code. If there are multiple input files (e.g. intensity image, binary brain mask) with the same file name, those will overwrite each other when copied to the CARE directory. As a work around I suggest renaming the mask file to for example 1000_mask.nii.gz

Regarding the second problem. This is indeed most likely caused by running malpem (outside the CARE environment) instead of malpem-proot.

Hope this helps for a start.

schuhschuh commented 8 years ago

If there are multiple input files (e.g. intensity image, binary brain mask) with the same file name, those will overwrite each other when copied to the CARE directory.

I don't think that's an issue (at least not with the latest version, I use v1.2). The MALPEM output directory contains the following files at the top level:

-rw-r--r-- 1 as12312 vip 153K Jul 26 20:58 1003_mask.nii.gz
-rw-r--r-- 1 as12312 vip 6.6M Jul 26 20:58 1003_noN4_masked.nii.gz
-rw-r--r-- 1 as12312 vip  15M Jul 26 20:58 1003_noN4.nii.gz
-rw-r--r-- 1 as12312 vip   83 Jul 26 20:58 mni-1003.dof.gz

Seems the mask file is anyway renamed when copied.

Changing the PATH to PATH=${curdir}/irtk:$PATH fixed this first error. It was able to find cl_erosion. But I missed that it also didn't find the NiftySeg commands which are in ${curdir}/niftyseg. Added it now and running it again...

schuhschuh commented 8 years ago

Changing PATH fixed it. I also noticed that if I was to run PINCRAM, it would also fail because of an incorrect PATH set within the shell script.

I think the following changes are needed so malpem can be used directly on Ubuntu >=14:

ledigchr commented 5 years ago

Update PATH as suggested.