-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename everything to brainmapper and explicitly support old cellfinde…
…r directories (#61) * Rename everything to brainmapper and explicitly support old cellfinder directories * Remove unnecessary test data
- Loading branch information
1 parent
4e0d384
commit 6c41f2d
Showing
23 changed files
with
120 additions
and
99 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"signal_planes_paths": ["2"], "background_planes_path": ["4"], "output_dir": "output", "signal_ch_ids": null, "background_ch_id": null, "registration_config": "cellfinder.conf.custom", "voxel_sizes": ["5", "2.31", "2.31"], "network_voxel_sizes": [5, 1, 1], "no_detection": false, "no_classification": false, "no_register": false, "no_analyse": false, "no_figures": false, "start_plane": 0, "end_plane": -1, "save_planes": false, "outlier_keep": false, "artifact_keep": false, "max_cluster_size": 100000, "soma_diameter": 16, "ball_xy_size": 6, "ball_z_size": 15, "ball_overlap_fraction": 0.6, "log_sigma_size": 0.2, "n_sds_above_mean_thresh": 10, "soma_spread_factor": 1.4, "trained_model": "model.h5", "model_weights": null, "network_depth": "50", "batch_size": 64, "cube_width": 50, "cube_height": 50, "cube_depth": 20, "save_empty_cubes": false, "n_free_cpus": 8, "max_ram": null, "save_csv": false, "debug": false, "sort_input_file": false, "no_models": false, "model": "resnet50_tv", "heatmap_smooth": 100, "mask_figures": true, "install_path": ".cellfinder", "download_path": "tmp", "no_amend_config": false, "atlas": "allen_mouse_100um", "orientation": "prs", "backend": "niftyreg", "affine_n_steps": 6, "affine_use_n_steps": 5, "freeform_n_steps": 6, "freeform_use_n_steps": 4, "bending_energy_weight": 0.95, "grid_spacing": -10, "smoothing_sigma_reference": -1.0, "smoothing_sigma_floating": -1.0, "histogram_n_bins_floating": 128, "histogram_n_bins_reference": 128, "paths": {"output_dir": "output_dir", "registration_output_folder": "output_dir/brainreg_output", "metadata_path": "output/brainmapper.json", "registration_metadata_path": "output_dir/brainreg_output/brainreg.json"}} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import json | ||
import pathlib | ||
|
||
import pytest | ||
|
||
from brainglobe_napari_io.brainmapper import brainmapper_reader_dir | ||
|
||
brainmapper_dir = ( | ||
pathlib.Path(__file__).parent.parent.parent / "data" / "brainmapper_output" | ||
) | ||
registration_dir = brainmapper_dir / "registration" | ||
|
||
cellfinder_dir = ( | ||
pathlib.Path(__file__).parent.parent.parent / "data" / "cellfinder_output" | ||
) | ||
DOWNSAMPLED_IMAGE_SIZE = (135, 108, 77) | ||
|
||
|
||
@pytest.fixture | ||
def metadata(): | ||
with open(brainmapper_dir / "brainmapper.json") as json_file: | ||
metadata = json.load(json_file) | ||
return metadata | ||
|
||
|
||
def test_is_brainmapper_dir(): | ||
assert brainmapper_reader_dir.is_brainmapper_dir(brainmapper_dir) | ||
assert not brainmapper_reader_dir.is_brainmapper_dir( | ||
brainmapper_dir.parent | ||
) | ||
assert not brainmapper_reader_dir.is_brainmapper_dir(__file__) | ||
|
||
|
||
def test_is_cellfinder_dir(): | ||
assert brainmapper_reader_dir.is_brainmapper_dir(cellfinder_dir) | ||
|
||
|
||
def test_brainmapper_read_dir(): | ||
assert ( | ||
brainmapper_reader_dir.brainmapper_read_dir(str(brainmapper_dir)) | ||
== brainmapper_reader_dir.reader_function | ||
) | ||
assert brainmapper_reader_dir.brainmapper_read_dir(brainmapper_dir) is None | ||
assert ( | ||
brainmapper_reader_dir.brainmapper_read_dir( | ||
str(brainmapper_dir.parent) | ||
) | ||
is None | ||
) | ||
|
||
|
||
def check_metadata(metadata): | ||
assert metadata["atlas"] == "allen_mouse_100um" | ||
assert metadata["orientation"] == "prs" | ||
assert metadata["soma_diameter"] == 16 | ||
|
||
|
||
def test_get_metadata(): | ||
check_metadata(brainmapper_reader_dir.get_metadata(brainmapper_dir)) | ||
check_metadata(brainmapper_reader_dir.get_metadata(cellfinder_dir)) | ||
|
||
|
||
def test_load_brainmapper_dir(): | ||
layers = brainmapper_reader_dir.reader_function(brainmapper_dir) | ||
assert len(layers) == 4 | ||
|
||
layer_names = ["allen_mouse_100um", "Boundaries", "Non cells", "Cells"] | ||
layer_types = ["labels", "image", "points", "points"] | ||
layer_shapes = [ | ||
DOWNSAMPLED_IMAGE_SIZE, | ||
DOWNSAMPLED_IMAGE_SIZE, | ||
(22, 3), | ||
(103, 3), | ||
] | ||
for idx, layer in enumerate(layers): | ||
assert layer[1]["name"] == layer_names[idx] | ||
assert layer[2] == layer_types[idx] | ||
assert layer[0].shape == layer_shapes[idx] | ||
|
||
|
||
def test_load_registration(metadata): | ||
layers = brainmapper_reader_dir.load_registration( | ||
[], registration_dir, metadata | ||
) | ||
assert len(layers) == 2 | ||
assert layers[0][0].shape == DOWNSAMPLED_IMAGE_SIZE | ||
assert layers[1][0].shape == DOWNSAMPLED_IMAGE_SIZE | ||
|
||
assert layers[0][1]["name"] == "allen_mouse_100um" | ||
assert layers[1][1]["name"] == "Boundaries" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
tests/tests/test_integration/test_wholebrain_cell_reader.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters