@@ -55,10 +55,13 @@ stains = get_stains_all_subjects()
5555
5656stain_for_reg = None
5757
58+ template = config ["templates" ][config ["template" ]]
59+
60+
5861# first, check if there are any SPIM templates defined
5962# for the stains we have
6063use_spim_template = False
61- spim_templates = config [ "templates" ][ config [ " template" ]] .get ("spim_templates" , None )
64+ spim_templates = template .get ("spim_templates" , None )
6265
6366if spim_templates is not None :
6467 for stain in spim_templates .keys ():
@@ -103,36 +106,35 @@ else:
103106
104107
105108# atlas segmentations to use
106- all_atlas_segs = config ["templates" ][config ["template" ]]["atlases" ].keys ()
107109
108110if config ["atlas_segs" ] is None :
109- atlas_segs = all_atlas_segs
111+ atlas_segs = template . get ( "default_segs" , template [ "atlases" ]. keys ())
110112else :
111113 atlas_segs = []
112114 for seg in config ["atlas_segs" ]:
113- if seg not in all_atlas_segs :
115+ if seg not in template [ "atlases" ] :
114116 raise ValueError (
115- f"Chosen segmentation { seg } was not found in the template { config [ ' template' ] } "
117+ f"Chosen segmentation { seg } was not found in the template { template } "
116118 )
117119 else :
118120 atlas_segs .append (seg )
119121
120122# atlas segmentations to use for patches (defaults to roi22)
121123patch_atlas_segs = []
122124for seg in config ["patch_atlas_segs" ]:
123- if seg not in all_atlas_segs :
125+ if seg not in template [ "atlases" ] :
124126 raise ValueError (
125- f"Chosen patch segmentation { seg } was not found in the template { config [ ' template' ] } "
127+ f"Chosen patch segmentation { seg } was not found in the template { template } "
126128 )
127129 else :
128130 patch_atlas_segs .append (seg )
129131
130132# atlas segmentations to use for Imaris crops (defaults to roi22)
131133crop_atlas_segs = []
132134for seg in config ["crop_atlas_segs" ]:
133- if seg not in all_atlas_segs :
135+ if seg not in template [ "atlases" ] :
134136 raise ValueError (
135- f"Chosen crop segmentation { seg } was not found in the template { config [ ' template' ] } "
137+ f"Chosen crop segmentation { seg } was not found in the template { template } "
136138 )
137139 else :
138140 crop_atlas_segs .append (seg )
0 commit comments