Skip to content

Commit

Permalink
Set which atlases are following the Allen ccfv3 convention
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoKiaru committed Oct 31, 2024
1 parent 665ed5e commit 4f5101d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
4 changes: 4 additions & 0 deletions examples/demo_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@


def main():

# if you want to change the atlas that are using the ccfv3 convention
# abba.atlases_using_allen_ccfv3_convention = []

# To enable Java debugging:

attach_java_debugger = False
Expand Down
60 changes: 31 additions & 29 deletions src/abba_python/abba.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@

LogLevel = Literal['OFF', 'DEBUG', 'INFO']

atlases_using_allen_ccfv3_convention = [
'example_mouse_100um',
'allen_mouse_10um',
'allen_mouse_25um',
'allen_mouse_50um',
'allen_mouse_100um',
'kim_mouse_10um',
'kim_mouse_25um',
'kim_mouse_50um',
'kim_mouse_100um',
'osten_mouse_10um',
'osten_mouse_25um',
'osten_mouse_50um',
'osten_mouse_100um',
'perens_lsfm_mouse_20um',
'kim_dev_mouse_stp_10um',
'kim_dev_mouse_idisco_10um',
'kim_dev_mouse_mri_a0_10um',
'kim_dev_mouse_mri_adc_10um',
'kim_dev_mouse_mri_dwi_10um',
'kim_dev_mouse_mri_fa_10um',
'kim_dev_mouse_mri_mtr_10um',
'kim_dev_mouse_mri_t2_10um',
'allen_mouse_bluebrain_barrels_10um',
'allen_mouse_bluebrain_barrels_25um',
'princeton_mouse_20um'
]

def get_java_dependencies():
"""
Expand All @@ -31,7 +58,7 @@ def get_java_dependencies():
"""
return ['net.imagej:imagej:2.15.0',
'net.imagej:imagej-legacy:1.2.2',
'ch.epfl.biop:ImageToAtlasRegister:0.9.6',
'ch.epfl.biop:ImageToAtlasRegister:0.9.7',
'ch.epfl.biop:bigdataviewer-biop-tools:0.10.6',
'sc.fiji:bigdataviewer-playground:0.10.5',
'sc.fiji:bigwarp_fiji:9.1.2',
Expand Down Expand Up @@ -142,35 +169,10 @@ def get(self):

# Specify which atlases are compatible with DeepSlice Mouse and Rat models - this only affects the GUI
DeepSliceHelper = jimport('ch.epfl.biop.atlas.aligner.DeepSliceHelper')
mouse_compatible_atlases = [ # Not sure thew all work!
'example_mouse_100um',
'allen_mouse_10um',
'allen_mouse_25um',
'allen_mouse_50um',
'allen_mouse_100um',
'kim_mouse_10um',
'kim_mouse_25um',
'kim_mouse_50um',
'kim_mouse_100um',
'osten_mouse_10um',
'osten_mouse_25um',
'osten_mouse_50um',
'osten_mouse_100um',
'perens_lsfm_mouse_20um',
'kim_dev_mouse_stp_10um',
'kim_dev_mouse_idisco_10um',
'kim_dev_mouse_mri_a0_10um',
'kim_dev_mouse_mri_adc_10um',
'kim_dev_mouse_mri_dwi_10um',
'kim_dev_mouse_mri_fa_10um',
'kim_dev_mouse_mri_mtr_10um',
'kim_dev_mouse_mri_t2_10um',
'allen_mouse_bluebrain_barrels_10um',
'allen_mouse_bluebrain_barrels_25um',
'princeton_mouse_20um'
]
for atlas_name in mouse_compatible_atlases:

for atlas_name in atlases_using_allen_ccfv3_convention:
DeepSliceHelper.addMouseCompatibleAtlas(JString(atlas_name))

DeepSliceHelper.addRatCompatibleAtlas(JString('whs_sd_rat_39um'))


Expand Down
12 changes: 4 additions & 8 deletions src/abba_python/abba_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import numpy as np

import abba

AffineTransform3D = jimport('net.imglib2.realtransform.AffineTransform3D')
ArrayList = jimport('java.util.ArrayList')
AtlasHelper = jimport('ch.epfl.biop.atlas.struct.AtlasHelper')
Expand All @@ -25,12 +27,6 @@ def array_to_source(ij, array, name, transform=AffineTransform3D()):
rai_source = RandomAccessibleIntervalSource(img, pixel_type, transform, name_java_str)
return SourceAndConverterHelper.createSourceAndConverter(rai_source)


def is_mouse_ccfv3_compatible(atlas_name: str):
# Assume that if it is deepslice compatible, it is ccfv3 compatible
DeepSliceHelper = jimport('ch.epfl.biop.atlas.aligner.DeepSliceHelper')
return DeepSliceHelper.isDeepSliceMouseCompatible(JString(atlas_name))

@JImplements(AtlasMap)
class AbbaMap(object):
"""This python class is part of the translation mechanism between the underlying Java ABBA API:
Expand Down Expand Up @@ -68,7 +64,7 @@ def initialize(self, atlasName):
affine_transform = AffineTransform3D()
affine_transform.scale(JDouble(vox_x_mm), JDouble(vox_y_mm), JDouble(vox_z_mm))

if is_mouse_ccfv3_compatible(atlasName):
if atlasName in abba.atlases_using_allen_ccfv3_convention:
transform_to_ccfv3 = AffineTransform3D()
transform_to_ccfv3.set(
JDouble(0), JDouble(0), JDouble(1), JDouble(0),
Expand Down Expand Up @@ -144,7 +140,7 @@ def getAtlasPrecisionInMillimeter(self):

@JOverride
def getCoronalTransform(self):
if is_mouse_ccfv3_compatible(self.atlasName):
if self.atlasName in abba.atlases_using_allen_ccfv3_convention:
coronal_transform = AffineTransform3D()
coronal_transform.set(
JDouble(0), JDouble(0), JDouble(1), JDouble(0),
Expand Down

0 comments on commit 4f5101d

Please sign in to comment.