KCL-BMEIS / niftyreg

This project contains command line tools to perform rigid, affine and non-linear registration of nifti or analyse images as well as utilities
BSD 3-Clause "New" or "Revised" License
141 stars 42 forks source link

groupwise_niftyreg_run.sh fails after first rigid registration iteration #32

Closed mmodat closed 6 years ago

mmodat commented 6 years ago

In gitlab by @svalette on Nov 15, 2017, 11:18

Hi,

the groupwise_niftyreg_run.sh script fails on my box. It correctly computes the first rigid registration iteration for all volumes, but computing the first average image fails. The volume list is:

[valette@desk reg-apps]$ ls ~/volumes
vol1.nii.gz  vol2.nii.gz  vol3.nii.gz

the config file is:

[valette@desk reg-apps]$ more params.sh 
#!/bin/sh

############################################################################
###################### PARAMETERS THAT CAN BE CHANGED ######################
############################################################################
# Array that contains the input images to create the atlas
export IMG_INPUT=(`ls ~/volumes/*.nii.gz`)
export IMG_INPUT_MASK= # leave empty to not use floating masks

# template image to use to initialise the atlas creation
export TEMPLATE=`echo ~/volumes/vol1.nii.gz`
export TEMPLATE_MASK= # leave empty to not use a reference mask

# folder where the result images will be saved
export RES_FOLDER=`pwd`/groupwise_result

# argument to use for the affine (reg_aladin)
export AFFINE_args="-omp 4"
# argument to use for the non-rigid registration (reg_f3d)
export NRR_args="-omp 4"

# number of affine loop to perform - Note that the first step is always rigid
export AFF_IT_NUM=5
# number of non-rigid loop to perform
export NRR_IT_NUM=10

# grid engine arguments
export QSUB_CMD="qsub -l h_rt=05:00:00 -l tmem=0.9G -l h_vmem=0.9G -l vf=0.9G -l s_stack=10240  -j y -S /bin/csh -b y -cwd -V -R y -pe smp 4"
############################################################################

and the output of the script is as bellow:

[valette@desk reg-apps]$ sh ./groupwise_niftyreg_run.sh ./params.sh 

************************************************************
>>> There are 3 input images to groupwise register <<<
>>> The template image to initialise the registration is /home/valette/volumes/vol1.nii.gz <<<
************************************************************

The output image folder (/home/valette/git/niftyreg/reg-apps/groupwise_result) does not exist
The output image folder (/home/valette/git/niftyreg/reg-apps/groupwise_result) has been created
** ERROR (nifti_image_write_hdr_img2): cannot open output file '/dev/null.nii'
** ERROR (nifti_image_write_hdr_img2): cannot open output file '/dev/null.nii'
** ERROR (nifti_image_write_hdr_img2): cannot open output file '/dev/null.nii'
[NiftyReg WARNING] Function: reg_io_checkFileFormat
[NiftyReg WARNING] No filename extension provided - the Nifti library is used by default
** ERROR (nifti_image_read): failed to find header file for '/home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/aff_mat_vol1_it1.txt'
./groupwise_niftyreg_run.sh : ligne 309 : 28166 Segmentation fault      (core dumped)reg_average ${RES_FOLDER}/aff_${CUR_IT}/average_affine_it_${CUR_IT}.nii.gz -demean1 ${averageImage} ${list_average}
Error when creating                         /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/average_affine_it_1.nii.gz

after further debugging, it seems that the script stops when launching the reg_average program, with this command line:

reg_average /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/average_affine_it_1.nii.gz -demean1 /home/valette/volumes/vol1.nii.gz /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/aff_mat_vol1_it1.txt /home/valette/volumes/vol1.nii.gz /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/aff_mat_vol2_it1.txt /home/valette/volumes/vol2.nii.gz /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/aff_mat_vol3_it1.txt /home/valette/volumes/vol3.nii.gz

it seems that reg_average is confused and is trying to read /home/valette/git/niftyreg/reg-apps/groupwise_result/aff_1/aff_mat_vol1_it1.txt as an image file, but the file contains a rigid transform.

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 11:13

assigned to @mmodat

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 11:13

created branch 32-groupwise_niftyreg_run-sh-fails-after-first-rigid-registration-iteration

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 12:38

mentioned in commit e8783cf0bce2f6d2335c5b24a3afaf3e916e590a

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 12:39

mentioned in merge request !19

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 12:39

closed via merge request !19

mmodat commented 6 years ago

In gitlab by @mmodat on Nov 16, 2017, 17:24

mentioned in commit 954b40a2d6ec2233e571d4ac15e8cb4dec2797ed