BIOP / abba_python

ABBA, controlled from python
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Notebooks currently non functional #14

Open NicoKiaru opened 8 months ago

NicoKiaru commented 8 months ago

I get this error in the first example notebook:

4. DeepSlice Registration(s)[¶](http://localhost:8888/lab/workspaces/auto-C/tree/Dropbox/BIOP/abba_python/example_notebooks/0.%20Register%20And%20Save%20State.ipynb#4.-DeepSlice-Registration(s))

# a first deepslice registration round : possible because it's the Allen CCF atlas, cut in coronal mode

# what's assumed : the sections are already in the correct order

aligner.register_slices_deepslice_local(channels=[0, 1],

                                  ensemble=False,

                                  model='mouse',

                                  post_processing='Keep order + ensure regular spacing',

                                  slices_spacing_micrometer=-1,      

                                  allow_slicing_angle_change=True) # use run_mode='Web' if you are not headless and without a local deepslice env

​

#allow_slicing_angle_change: bool,

#                                        channels: str,

#                                        ensemble: bool,

#                                        model: str,

#                                        post_processing: str,

#                                        slices_spacing_micrometer: float

​

# second deepslice registration: because the slices are resampled for the registration,

# we usually get a slightly better positioning along z and cutting angle

# also: it's fast, and the combination of two affine transforms is

# an affine transform, so it's not like we are adding extra degrees of freedom

# aligner.register_slices_deepslice(channels=[0, 1],

#                                  maintain_slices_order = True, # the slices are already sorted: do not mess the order

#                                  run_mode='local') # use run_mode='web' if you are not headless and without a local deepslice env

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[13], line 3
      1 # a first deepslice registration round : possible because it's the Allen CCF atlas, cut in coronal mode
      2 # what's assumed : the sections are already in the correct order
----> 3 aligner.register_slices_deepslice_local(channels=[0, 1],
      4                                   ensemble=False,
      5                                   model='mouse',
      6                                   post_processing='Keep order + ensure regular spacing',
      7                                   slices_spacing_micrometer=-1,      
      8                                   allow_slicing_angle_change=True) # use run_mode='Web' if you are not headless and without a local deepslice env
     10 #allow_slicing_angle_change: bool,
     11 #                                        channels: str,
     12 #                                        ensemble: bool,
   (...)
     22 #                                  maintain_slices_order = True, # the slices are already sorted: do not mess the order
     23 #                                  run_mode='local') # use run_mode='web' if you are not headless and without a local deepslice env

File ~\AppData\Local\abba-python-0.8.0\lib\site-packages\abba_python\abba.py:834, in Abba.register_slices_deepslice_local(self, allow_slicing_angle_change, channels, ensemble, model, post_processing, slices_spacing_micrometer)
    821 """
    822 Uses Deepslice for affine in plane and axial registration of selected slices
    823 
   (...)
    830 slices_spacing_micrometer (float): Spacing (micrometer), used only when 'Keep order + set spacing' is selected
    831 """
    832 RegisterSlicesDeepSliceLocalCommand = jimport(
    833     'ch.epfl.biop.atlas.aligner.command.RegisterSlicesDeepSliceLocalCommand')
--> 834 return self.ij.command().run(RegisterSlicesDeepSliceLocalCommand, True,
    835                              'mp', self.mp,
    836                              'allow_slicing_angle_change', allow_slicing_angle_change,
    837                              'channels', channels,
    838                              'ensemble', ensemble,
    839                              'model', model,
    840                              'post_processing', post_processing,
    841                              'slices_spacing_micrometer', slices_spacing_micrometer).get()

TypeError: No matching overloads found for org.scijava.command.DefaultCommandService.run(_jpype._JClass,bool,str,ch.epfl.biop.atlas.aligner.MultiSlicePositioner,str,bool,str,list,str,bool,str,str,str,str,str,int), options are:
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(java.lang.String,boolean,java.util.Map)
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(org.scijava.command.CommandInfo,boolean,java.util.Map)
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(org.scijava.command.CommandInfo,boolean,java.lang.Object[])
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(java.lang.Class,boolean,java.util.Map)
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(java.lang.String,boolean,java.lang.Object[])
    public java.util.concurrent.Future org.scijava.command.DefaultCommandService.run(java.lang.Class,boolean,java.lang.Object[])
NicoKiaru commented 8 months ago

It's because of the channels taht are lists...

NicoKiaru commented 8 months ago

Another error in notebook 2:


ModuleNotFoundError Traceback (most recent call last) Cell In[5], line 6 1 # -- FOR DEBUGGING 2 # import imagej.doctor 3 # imagej.doctor.checkup() 4 # imagej.doctor.debug_to_stderr() ----> 6 aligner = Abba('azba_zfish_4um') # Simply put the name of the BrainGlobe atlas 7 aligner.show_bdv_ui() # creates and show a bdv view 9 # !! Warning : it takes time... first : downloading the atlas if not present 10 # it can take up to a minute...

NicoKiaru commented 8 months ago

File ~\AppData\Local\abba-python-0.8.0\lib\site-packages\abba_python\abba.py:181, in Abba.init(self, atlas_name, ij, slicing_mode, headless, print_config) 179 bg_atlas = BrainGlobeAtlas(atlas_name) 180 # initialized --> 181 from abba_private import abba_atlas 182 atlas = abba_atlas.AbbaAtlas(bg_atlas, ij) 183 atlas.initialize(None, None)

ModuleNotFoundError: No module named 'abba_private'

NicoKiaru commented 8 months ago

Notebook 4: mettre a jour la commande deepslice

GuillaumeLeGoc commented 7 months ago

Another error in notebook 2:

ModuleNotFoundError Traceback (most recent call last) Cell In[5], line 6 1 # -- FOR DEBUGGING 2 # import imagej.doctor 3 # imagej.doctor.checkup() 4 # imagej.doctor.debug_to_stderr() ----> 6 aligner = Abba('azba_zfish_4um') # Simply put the name of the BrainGlobe atlas 7 aligner.show_bdv_ui() # creates and show a bdv view 9 # !! Warning : it takes time... first : downloading the atlas if not present 10 # it can take up to a minute...

Hey @NicoKiaru, indeed we can't load Brainglobe atlases anymore, with the error you posted : ModuleNotFoundError: No module named 'abba_private'. I'm not familiar with Python packages/modules etc. so I don't know why it is not found while the abba_python folder is next to the abba.py module. But changing this line : https://github.com/BIOP/abba_python/blob/be17a502f4174efcf4622c1418d3d2dacd1aac8b/src/abba_python/abba.py#L181 to

from abba_python.abba_private import abba_atlas

works.

NicoKiaru commented 7 months ago

Thanks!

I'm not familiar with Python packages/modules etc. s

Yeah, me neither 😓 . I'm struggling to get an identical code to work both:

Honestly that's a mess.