Skip to content

Commit

Permalink
Fixed bug on resampling where the EPI dimensions weren't used. Also n…
Browse files Browse the repository at this point in the history
…ow download specific version of twolevel_dbm.
  • Loading branch information
Gab-D-G committed Jan 21, 2020
1 parent 6d4ed28 commit 8da1d9d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ csv_labels=$template_dir/DSURQE_40micron_R_mapping.csv
python $RABIES/gen_masks.py $DSURQE_100micron_labels $csv_labels $template_dir/DSURQE_100micron

# install twolevel_ants_dbm
git clone https://github.com/CobraLab/twolevel_ants_dbm $RABIES/twolevel_ants_dbm && \
git clone https://github.com/CoBrALab/twolevel_ants_dbm.git $RABIES/twolevel_ants_dbm
cd twolevel_ants_dbm
git checkout bde563f3ee017eb7f374b72e8599f2102a69c1da
cd ..
echo 'export PATH=$RABIES/twolevel_ants_dbm:$PATH' >> $HOME/.bashrc
8 changes: 4 additions & 4 deletions rabies/preprocess_bold_pkg/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def init_bold_preproc_trans_wf(resampling_dim, name='bold_preproc_trans_wf'):
bold_transform.inputs.resampling_dim = resampling_dim
bold_transform.inputs.data_type = os.environ["rabies_data_type"]

merge = pe.Node(Merge(), name='merge', mem_gb=5)
merge = pe.Node(Merge(), name='merge', mem_gb=3)
merge.inputs.data_type = os.environ["rabies_data_type"]
merge.plugin_args = {'qsub_args': '-pe smp %s' % (str(4*int(os.environ["min_proc"]))), 'overwrite': True}
merge.plugin_args = {'qsub_args': '-pe smp %s' % (str(3*int(os.environ["min_proc"]))), 'overwrite': True}

# Generate a new BOLD reference
bold_reference_wf = init_bold_reference_wf()
Expand Down Expand Up @@ -72,9 +72,9 @@ def init_bold_commonspace_trans_wf(resampling_dim, name='bold_commonspace_trans_
bold_transform.inputs.resampling_dim = resampling_dim
bold_transform.inputs.data_type = os.environ["rabies_data_type"]

merge = pe.Node(Merge(), name='merge', mem_gb=5)
merge = pe.Node(Merge(), name='merge', mem_gb=3)
merge.inputs.data_type = os.environ["rabies_data_type"]
merge.plugin_args = {'qsub_args': '-pe smp %s' % (str(4*int(os.environ["min_proc"]))), 'overwrite': True}
merge.plugin_args = {'qsub_args': '-pe smp %s' % (str(3*int(os.environ["min_proc"]))), 'overwrite': True}

# Generate a new BOLD reference
bold_reference_wf = init_bold_reference_wf()
Expand Down
8 changes: 7 additions & 1 deletion rabies/preprocess_bold_pkg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,13 @@ def _run_interface(self, runtime):
import nibabel as nb
import os
img=nb.load(self.inputs.in_file)
resample_image(nb.load(self.inputs.ref_file), self.inputs.data_type, img_dim=self.inputs.resampling_dim).to_filename('resampled.nii.gz')

if not self.inputs.resampling_dim=='origin':
resample_image(nb.load(self.inputs.ref_file), self.inputs.data_type, img_dim=self.inputs.resampling_dim).to_filename('resampled.nii.gz')
else:
shape=img.header.get_zooms()
dims="%sx%sx%s" % (shape[0],shape[1],shape[2])
resample_image(nb.load(self.inputs.ref_file), self.inputs.data_type, img_dim=dims).to_filename('resampled.nii.gz')

#tranforms is a list of transform files, set in order of call within antsApplyTransforms
transform_string=""
Expand Down

0 comments on commit 8da1d9d

Please sign in to comment.