diff --git a/MANIFEST.in b/MANIFEST.in index 66cf595..e08df78 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,3 +9,4 @@ recursive-include cellfinder_napari *.png recursive-exclude * __pycache__ recursive-exclude * *.py[co] recursive-exclude examples * +recursive-exclude cellfinder_napari/tests/data * diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/boundaries.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/boundaries.tiff new file mode 100644 index 0000000..c286266 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/boundaries.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e98f4bbdc240d119b5bb8669a82a0cf6c722eb6d32df98c74c834204985c4fd +size 1146784 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/brainreg.json b/cellfinder_napari/tests/data/brainreg-napari-output/brainreg.json new file mode 100644 index 0000000..d8b9a66 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/brainreg.json @@ -0,0 +1 @@ +{"image_paths": null, "backend": "niftyreg", "voxel_sizes": ["50.0", "40.0", "40.0"], "orientation": "psl", "data_orientation": "psl", "atlas": "example_mouse_100um", "atlas_key": "atlas_key.example_mouse_100um", "registration_output_folder": "/Users/dstansby/brainreg-napari-output", "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", "smoothing_sigma_floating": "1.0", "histogram_n_bins_floating": "128.0", "histogram_n_bins_reference": "128.0"} diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/cells.xml b/cellfinder_napari/tests/data/brainreg-napari-output/cells.xml new file mode 100644 index 0000000..ac9f06f --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/cells.xml @@ -0,0 +1,427 @@ + + + + placeholder.tif + + + 1 + + 1 + + 98 + 164 + 14 + + + 88 + 88 + 15 + + + 72 + 134 + 17 + + + 182 + 98 + 17 + + + 183 + 98 + 18 + + + 143 + 169 + 21 + + + 204 + 98 + 27 + + + 51 + 145 + 34 + + + 71 + 152 + 64 + + + 33 + 77 + 68 + + + 181 + 33 + 82 + + + 179 + 30 + 82 + + + 165 + 168 + 109 + + + 258 + 119 + 144 + + + 138 + 80 + 204 + + + 138 + 82 + 208 + + + 138 + 99 + 215 + + + 139 + 103 + 218 + + + 141 + 142 + 219 + + + 139 + 104 + 219 + + + 141 + 142 + 224 + + + 147 + 158 + 225 + + + 140 + 137 + 226 + + + 139 + 100 + 227 + + + 140 + 118 + 231 + + + 147 + 158 + 231 + + + 142 + 146 + 231 + + + 141 + 139 + 230 + + + 142 + 147 + 230 + + + 127 + 163 + 228 + + + 187 + 114 + 233 + + + 141 + 135 + 234 + + + 140 + 122 + 234 + + + 195 + 124 + 235 + + + 180 + 110 + 235 + + + 189 + 115 + 236 + + + 190 + 116 + 236 + + + 194 + 121 + 236 + + + 95 + 116 + 237 + + + 94 + 117 + 237 + + + 191 + 118 + 238 + + + 141 + 128 + 238 + + + 98 + 114 + 239 + + + 97 + 115 + 239 + + + 171 + 105 + 239 + + + 106 + 110 + 239 + + + 101 + 112 + 239 + + + 142 + 122 + 239 + + + 124 + 157 + 239 + + + 158 + 156 + 240 + + + 167 + 104 + 240 + + + 172 + 105 + 240 + + + 105 + 110 + 240 + + + 102 + 111 + 240 + + + 96 + 115 + 240 + + + 166 + 103 + 241 + + + 110 + 108 + 241 + + + 106 + 109 + 241 + + + 95 + 116 + 241 + + + 156 + 104 + 245 + + + 170 + 102 + 245 + + + 120 + 105 + 245 + + + 110 + 107 + 242 + + + 125 + 109 + 243 + + + 108 + 107 + 244 + + + 100 + 103 + 253 + + + 170 + 101 + 246 + + + 101 + 110 + 246 + + + 120 + 103 + 247 + + + 102 + 109 + 247 + + + 152 + 101 + 247 + + + 105 + 107 + 247 + + + 103 + 108 + 247 + + + 152 + 99 + 249 + + + 175 + 101 + 249 + + + 174 + 101 + 248 + + + 104 + 107 + 248 + + + 159 + 96 + 250 + + + 180 + 103 + 250 + + + 185 + 113 + 250 + + + 179 + 100 + 252 + + + 182 + 94 + 255 + + + 184 + 115 + 255 + + + + diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_0.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_0.tiff new file mode 100644 index 0000000..073e7e3 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_0.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42d24c156fa3afa71dde7b9dd9895d8d1c10601f4b27d29d812289cc39f8b280 +size 4514764 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_1.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_1.tiff new file mode 100644 index 0000000..e90ad00 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_1.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:768a3b913c45af73ac0b4c32b2df2a1cde7a217fccebdbe094b9e2f1d016d4f3 +size 4514764 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_2.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_2.tiff new file mode 100644 index 0000000..a87ad89 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/deformation_field_2.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11573d55a850cf50230fe1c149c403be8748a722990442626e9d58574c2d3450 +size 4514764 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/downsampled.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/downsampled.tiff new file mode 100644 index 0000000..f8a0cfb --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/downsampled.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:684ba44d3129c46798d497c7b156e7a9d8c9c10de587149421ce4308387844a3 +size 2267820 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/downsampled_standard.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/downsampled_standard.tiff new file mode 100644 index 0000000..d750c97 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/downsampled_standard.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9d7f640d1d9f5feea3bbee330194fc7f8395c1204b29f27bc60997f5cd1e382 +size 2429682 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/registered_atlas.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/registered_atlas.tiff new file mode 100644 index 0000000..923546c --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/registered_atlas.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:879e68241b53ee9d460c661933c2acd5db35fdb18e198a22bddfe1f43c68c48d +size 4513140 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/registered_hemispheres.tiff b/cellfinder_napari/tests/data/brainreg-napari-output/registered_hemispheres.tiff new file mode 100644 index 0000000..67c274f --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/registered_hemispheres.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5eb01c8e2533ab722ae987fb2c4a09ccac40ab4c6066a69ab0720d790234706 +size 1145160 diff --git a/cellfinder_napari/tests/data/brainreg-napari-output/volumes.csv b/cellfinder_napari/tests/data/brainreg-napari-output/volumes.csv new file mode 100644 index 0000000..9057fb4 --- /dev/null +++ b/cellfinder_napari/tests/data/brainreg-napari-output/volumes.csv @@ -0,0 +1,2 @@ +structure_name,left_volume_mm3,right_volume_mm3,total_volume_mm3 +root,1.7870000000000001,2.007,3.7940000000000005 diff --git a/cellfinder_napari/tests/test_transform.py b/cellfinder_napari/tests/test_transform.py index 7ecc5aa..57cec55 100644 --- a/cellfinder_napari/tests/test_transform.py +++ b/cellfinder_napari/tests/test_transform.py @@ -7,8 +7,19 @@ from cellfinder_napari.transform import transform +BRAINREG_OUTPUT_DIRECTORY = ( + Path(__file__).parent / "data" / "brainreg-napari-output" +) + def test_transform(make_napari_viewer): + """ + Check that transforming cells to a registered brain works. + + Note that the final check for the new coordinates of the cell has not yet + been checked for correctness, but is included to catch changes in the cell + transformation code in the future. + """ # Create cells cells_layer = Points(np.atleast_2d([0, 0, 0])) @@ -19,7 +30,7 @@ def test_transform(make_napari_viewer): viewer = make_napari_viewer() labels_layer, boundaries_layer = add_registered_image_layers( - viewer, registration_directory=Path.home() / "brainreg-napari-output" + viewer, registration_directory=BRAINREG_OUTPUT_DIRECTORY ) viewer.add_layer(brain_layer) viewer.add_layer(cells_layer)