warp_setting=registration_setting) simpleGlobal_alignment_spec = dict(stack_m=brain_m_spec, stack_f=brain_f_spec, warp_setting=0) aligner_parameters = generate_aligner_parameters_v2( alignment_spec=alignment_spec, structures_m=structures_m, fixed_structures_are_sided=True, fixed_surroundings_have_positive_value= fixed_surroundings_have_positive_value, fixed_use_surround=fixed_use_surround) aligner = Aligner(aligner_parameters['volume_fixed'], aligner_parameters['volume_moving'], labelIndexMap_m2f=aligner_parameters['label_mapping_m2f']) aligner.compute_gradient(smooth_first=True) aligner.set_label_weights(label_weights=aligner_parameters['label_weights_m']) ################################ if use_simple_global: T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol = bp.unpack_ndarray_file( '/home/yuncong/' + brain_f_spec['name'] + '_T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol.bp' ) aligner.set_initial_transform( T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol) aligner.set_centroid(centroid_m='structure_centroid',
fixed_use_surround = False else: raise alignment_spec = dict(stack_m=brain_m_spec, stack_f=brain_f_spec, warp_setting=registration_setting) simpleGlobal_alignment_spec = dict(stack_m=brain_m_spec, stack_f=brain_f_spec, warp_setting=0) aligner_parameters = generate_aligner_parameters_v2(alignment_spec=alignment_spec, structures_m=structures_m, fixed_structures_are_sided=True, fixed_surroundings_have_positive_value=fixed_surroundings_have_positive_value, fixed_use_surround=fixed_use_surround) aligner = Aligner(aligner_parameters['volume_fixed'], aligner_parameters['volume_moving'], labelIndexMap_m2f=aligner_parameters['label_mapping_m2f']) aligner.compute_gradient(smooth_first=True) aligner.set_label_weights(label_weights=aligner_parameters['label_weights_m']) ################################ if use_simple_global: T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol = bp.unpack_ndarray_file('/home/yuncong/CSHL_simple_global_registration/' + brain_f_spec['name'] + '_T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol.bp') aligner.set_initial_transform(T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol) aligner.set_centroid(centroid_m='structure_centroid', centroid_f='centroid_m') else: T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol = np.array([[1,0,0,0],[0,1,0,0],[0,0,1,0]]) aligner.set_initial_transform(T_atlas_wrt_canonicalAtlasSpace_subject_wrt_wholebrain_atlasResol) aligner.set_centroid(centroid_m='structure_centroid', centroid_f='structure_centroid')