Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper always keeps propagate_angle on DeepSlice #38

Closed
carlocastoldi opened this issue Mar 6, 2024 · 11 comments
Closed

wrapper always keeps propagate_angle on DeepSlice #38

carlocastoldi opened this issue Mar 6, 2024 · 11 comments

Comments

@carlocastoldi
Copy link

for some reasons, in my environment, deepslice fails on Model.propagate_angles(). Ignoring this problem, i wanted to disable it from ABBA, however it seemed like it keept trying to modify the angle.
From logs i see that whether i tick or not the "Allow change of atlas slicing angle" checkbox, it always passes the --propagate_angles option to deepslice_cli_v1.1.5.1.py

Export as QuickNii Dataset done - Folder : /tmp/deepslice16665589499590696741
[bash -c /home/castoldi/.conda/envs/deepslice/bin/python /home/castoldi/.conda/envs/deepslice/deepslice_cli_v1.1.5.1.py mouse /tmp/deepslice16665589499590696741/ --ensemble --section_numbers --propagate_angles]
[...]
@NicoKiaru
Copy link
Member

I probably let it all the time because there's no support for different angles per slice in ABBA anyway.

What's the error message ? Do you think it's dataset dependent ?
Which version of DeepSlice do you have ? Are you using the windows installer ?

Cheers

@NicoKiaru
Copy link
Member

Also "Allow change of atlas slicing angle" is not related to angle propagation. Angle propagation enforces the same slicing angles for all sections - which is what happens in ABBA anyway. Setting a similar angle for all slices can be performed at the DeepSlice (or not, but I do not allow this yet), and is performed in any case at the ABBA level here.

@carlocastoldi
Copy link
Author

I probably let it all the time because there's no support for different angles per slice in ABBA anyway.
Also "Allow change of atlas slicing angle" is not related to angle propagation.

Oh i understand! Thanks. Sorry for the dumb mistake

What's the error message ?

I tried to use the dataset prepared by ABBA.

from DeepSlice import DSModel 
folderpath = '/tmp/deepslice13250635722828928472'
Model = DSModel("mouse")
Model.predict(folderpath, ensemble=True, section_numbers=True)
Model.propagate_angles()

and it fails with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/castoldi/.conda/envs/deepslice/lib/python3.7/site-packages/DeepSlice/main.py", line 155, in propagate_angles
    self.predictions, method, self.species
  File "/home/castoldi/.conda/envs/deepslice/lib/python3.7/site-packages/DeepSlice/coord_post_processing/angle_methods.py", line 115, in propagate_angles
    DV_angle_list, ML_angle_list, method, depths, species
  File "/home/castoldi/.conda/envs/deepslice/lib/python3.7/site-packages/DeepSlice/coord_post_processing/angle_methods.py", line 91, in get_mean_angle
    weighted_accuracy = [weighted_accuracy[int(y)] for y in df_center]
  File "/home/castoldi/.conda/envs/deepslice/lib/python3.7/site-packages/DeepSlice/coord_post_processing/angle_methods.py", line 91, in <listcomp>
    weighted_accuracy = [weighted_accuracy[int(y)] for y in df_center]
IndexError: list index out of range

Do you think it's dataset dependent ?

Since I'm just giving a QuickNII folder as an input i don't think it's a formatting/ABBA problem.
There is no indication of it being a problem of the images themselves either

Which version of DeepSlice do you have ?

pip list | grep DeepSlice
DeepSlice            1.1.5

Are you using the windows installer ?

No, I'm currently on Linux

@NicoKiaru
Copy link
Member

Just one thought: can you flip the indices of the files (if you are using indices) ? cf PolarBean/DeepSlice#43 and PolarBean/DeepSlice#61

@carlocastoldi
Copy link
Author

Just one thought: can you flip the indices of the files (if you are using indices)

it didn't even work when I aligned only one slice (if angle propagation even makes sense).
Do you think I should still try flipping the indices of multiple files?

cf PolarBean/DeepSlice#61

i could not find this issue :\

@NicoKiaru
Copy link
Member

It the problem is well contained into DeepSlice, maybe you can post the issue on the DeepSlice repo ?

@NKalavros
Copy link

NKalavros commented Sep 17, 2024

I tried the same code without the --propagate_angles argument and the extras and it works with a single slice. Can we change the setting call within ABBA for the deepslice python call, or maybe a tick mark if we're working with a single slice, since angle propagation means nothing there.

EDIT: A quick and dirty way of fixing this would be checking what ABBA calls for DeepSlice and changing the following lines:

# If you would like to normalise the angles (you should)
if args.propagate_angles:
    pass
    #model.propagate_angles()

@NicoKiaru
Copy link
Member

NicoKiaru commented Sep 17, 2024

Ah, is the problem happening when there's only one slice ?

In this case I need to set propagate angle to false rather in this repo:

https://github.com/BIOP/ijp-imagetoatlas/blob/master/src/main/java/ch/epfl/biop/atlas/aligner/command/RegisterSlicesDeepSliceLocalCommand.java

@NKalavros
Copy link

I think so, as there is nothing to propagate to, though I will try with 2 slices from the same animal and come back to you.

@NicoKiaru
Copy link
Member

Indeed the single slice causes issue. One needs to set propagate_angles to false and enforce_index_order to false as well.

The same is true when there are only two slices selected.

However the fix has to be in ABBA. See transfered issue:

BIOP/ijp-imagetoatlas#214

@NicoKiaru
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants