Skip to content

Commit

Permalink
ENH better error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianoF committed Mar 16, 2018
1 parent c1a9540 commit 82ecccc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions spot/spotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ def _check_propagation_options(self):
# Sanity check:
msg = ''
for bfc_mod in self.propagation_options['N_rigid_mod_diff_bfc']:
if bfc_mod not in self.propagation_options['N_rigid_modalities']:
msg += '\n\n === The modality selected for the differential bias field is not present in ' \
'the stack. Turn N_rigid_mod_diff_bfc to empty list, or add its values to ' \
'N_rigid_modalities == \n'
if len(self.propagation_options['N_rigid_modalities']) > 0:
if bfc_mod not in self.propagation_options['N_rigid_modalities']:
msg += '\n\n === The modality selected for the differential bias field is not present in ' \
'the stack. Turn N_rigid_mod_diff_bfc to empty list, or add its values to ' \
'N_rigid_modalities == \n'

if len(self.propagation_options['Affine_reg_masks']) > 0:
if not len(self.propagation_options['Affine_reg_masks']) == len(self.propagation_options['Affine_modalities']):
Expand Down
2 changes: 1 addition & 1 deletion spot/tools/iterative_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def non_rigid_propagator(sp):
for _ in range(num_modalities)]
stack_a_list_of_images_from_list_pfi(pfi_target_reg_mask_list, pfi_target_reg_mask)

else:
else: # TODO every input subject must have roi_mask and reg_mask per modality.
assert len(sp.propagation_options['N_rigid_modalities']) == len(sp.propagation_options['N_rigid_reg_masks'])
pfi_target_reg_mask_list = [
jph(pfo_target_masks, '{0}_{1}_{2}.nii.gz'.format(sp.target_name, m, target_suffix_mask))
Expand Down

0 comments on commit 82ecccc

Please sign in to comment.