From 6e2f7dc4446a1f07037a9abb3d69001efacad808 Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Tue, 21 Apr 2020 15:38:01 +0100 Subject: [PATCH] Update imports (#89) * add gitter info * readme typo * update coverage dependency * deploy to linux and windows * update coverage dependency * add six dependency * travis revert * update travis * speed up test * change cibuildtools syntax * docker deploy * update travis * update travis * update travis * docker into jobs * name deplot stage * change deploy * update testing script * update coverage dependency * new curation interface * update stages * remove matrix * update jobs * update python versions * update wheelbuilding * remove script and add os * update travis * formatting check with black * update wheelbuilding * ls before deployment * remove install from deployment job * move install to script * conditional deployment * update conditions * update conditions * twine upload * install twine * install twine * update travis * change twine upload * update testing * retry twine upload * retry twine upload * bump * full deploy test * update manifest * update travis * full deployment * fix typo in travis.yml * tag * edit conditional deployment * remove sudo * update travis * update travis * update travis * remove wheelbuilding * update conditions * Update conditions * tag condition * update conditions * add branch to condition * remove branch * update conditions * add branch to conditions * add repo to conditions * add repo to conditions * reorder conditions * reorder conditions * add condition * add matrix * revert travis * update tests * more job detail * more job detail * full test and deploy * bump * update coverage * remove unneeded line in travis * remove unneeded line in travis * test coveralls * pin coveralls version * update coveralls * windows tests * Upgrade setuptools * upgrade setuptools * bump * update coverage call * update coveralls depedency * update coveralls depedency * fix documentation * fix import statement * fix conflicts * update napari points api usage * update docs * update amap api useage * fix imlib source_files import errors * bump * bump * update docs * update imports * removed commented code --- cellfinder/summarise/count_summary.py | 10 +++------- cellfinder/utils/roi_transform.py | 11 +++++------ cellfinder/utils/xml_crop.py | 23 ++++++----------------- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/cellfinder/summarise/count_summary.py b/cellfinder/summarise/count_summary.py index 4a254da4..4a8f555f 100644 --- a/cellfinder/summarise/count_summary.py +++ b/cellfinder/summarise/count_summary.py @@ -13,16 +13,17 @@ from imlib.image.metadata import define_pixel_sizes from imlib.general.config import get_config_obj from imlib.IO.structures import load_structures_as_df - +from imlib.source.source_files import get_structures_path from imlib.anatomy.structures.structures_tree import ( atlas_value_to_structure_id, CellCountMissingCellsException, UnknownAtlasValue, ) +from neuro.atlas_tools.misc import get_atlas_pixel_sizes + import cellfinder.tools.parser as cellfinder_parse from cellfinder.tools.prep import prep_atlas_conf, Paths -from imlib.source.source_files import get_structures_path LEFT_HEMISPHERE = 2 RIGHT_HEMISPHERE = 1 @@ -34,7 +35,6 @@ def region_summary_cli_parser(): ) parser = cli_parse(parser) parser = cellfinder_parse.count_summary_parse(parser) - # parser = cellfinder_parse.atlas_parse(parser) parser = cellfinder_parse.pixel_parser(parser) return parser @@ -208,9 +208,6 @@ def get_structure_from_coordinates( def analysis_run(args, file_name="summary_cell_counts.csv"): args = prep_atlas_conf(args) - # if args.structures_file_path is None: - # args.structures_file_path = get_structures_path() - atlas = brainio.load_any(args.paths.registered_atlas_path) hemisphere = brainio.load_any(args.paths.hemispheres_atlas_path) @@ -218,7 +215,6 @@ def analysis_run(args, file_name="summary_cell_counts.csv"): args.paths.classification_out_file, cells_only=args.cells_only, ) max_coords = get_max_coords(cells) # Useful for debugging dimensions - # structures_reference_df = load_structures_as_df(args.structures_file_path) structures_reference_df = load_structures_as_df(get_structures_path()) atlas_pixel_sizes = get_atlas_pixel_sizes(args.atlas_config) diff --git a/cellfinder/utils/roi_transform.py b/cellfinder/utils/roi_transform.py index f050d988..bf32acbd 100644 --- a/cellfinder/utils/roi_transform.py +++ b/cellfinder/utils/roi_transform.py @@ -23,10 +23,11 @@ ) from imlib.general.exceptions import RegistrationError from imlib.source.source_files import source_custom_config_cellfinder +from imlib.source.niftyreg_binaries import get_niftyreg_binaries, get_binary +from neuro.atlas_tools.misc import get_atlas_pixel_sizes from amap.config.atlas import Atlas -from amap.config.config import get_binary -from amap.tools.source_files import get_niftyreg_binaries -import cellfinder.summarise.count_summary as cells_regions + +from imlib.source.niftyreg_binaries import get_binary # TODO: get this from amap @@ -311,9 +312,7 @@ def main(): atlas = brainio.load_nii(str(destination_image), as_array=False) atlas_scale = atlas.header.get_zooms() - atlas_pixel_sizes = cells_regions.get_atlas_pixel_sizes( - args.registration_config - ) + atlas_pixel_sizes = get_atlas_pixel_sizes(args.registration_config) transformation_matrix = np.eye(4) for i, axis in enumerate(("x", "y", "z")): diff --git a/cellfinder/utils/xml_crop.py b/cellfinder/utils/xml_crop.py index fd2d85a9..039f933b 100644 --- a/cellfinder/utils/xml_crop.py +++ b/cellfinder/utils/xml_crop.py @@ -5,22 +5,21 @@ from brainio import brainio from imlib.general.numerical import check_positive_float, check_positive_int -import cellfinder.summarise.count_summary as cells_regions from imlib.IO.cells import cells_to_xml -from cellfinder.tools.prep import prep_atlas_conf from imlib.source.source_files import get_structures_path from imlib.IO.structures import load_structures_as_df +from neuro.atlas_tools.misc import get_atlas_pixel_sizes + +from cellfinder.tools.prep import prep_atlas_conf +import cellfinder.summarise.count_summary as cells_regions def xml_crop(args, df_query="name"): args = prep_atlas_conf(args) - # if args.reference_structures_file_path is None: - # args.reference_structures_file_path = get_structures_path() if args.structures_file_path is None: args.structures_file_path = get_structures_path() - # reference_struct_df = pd.read_csv(args.reference_structures_file_path) reference_struct_df = pd.read_csv(get_structures_path()) curate_struct_df = pd.read_csv(args.structures_file_path) @@ -34,12 +33,9 @@ def xml_crop(args, df_query="name"): atlas = brainio.load_any(args.registered_atlas_path) hemisphere = brainio.load_any(args.hemispheres_atlas_path) - # structures_reference_df = load_structures_as_df( - # args.reference_structures_file_path - # ) structures_reference_df = load_structures_as_df(get_structures_path()) - atlas_pixel_sizes = cells_regions.get_atlas_pixel_sizes(args.atlas_config) + atlas_pixel_sizes = get_atlas_pixel_sizes(args.atlas_config) sample_pixel_sizes = args.x_pixel_um, args.y_pixel_um, args.z_pixel_um scales = cells_regions.get_scales(sample_pixel_sizes, atlas_pixel_sizes) @@ -107,14 +103,7 @@ def get_parser(): type=str, help="Curated csv structure list (as per the allen brain atlas csv", ) - # parser.add_argument( - # "--ref-structures-file", - # dest="reference_structures_file_path", - # type=str, - # help="The csv file containing the structures " - # "definition (if not using the default " - # "Allen brain atlas).", - # ) + parser.add_argument( "--hemisphere-query", dest="hemisphere_query",