PolarBean / DeepSlice

A python package which aligns histology to the Allen Brain Atlas and Waxholm rat atlas using deep learning.
https://www.deepslice.com.au
MIT License
76 stars 17 forks source link

Deepslice results only produce atlas images without histology overlay when opening json file in Quicknii #57

Closed TorSolOpp closed 3 weeks ago

TorSolOpp commented 3 weeks ago

After downloading the json/xml file from the web version of deepslice, I then try to open in Quicknii to make minor adjustments, but I when loading the json/xml file all that shows up are the atlas images and no histology. Similarly, if I try to open the file in visualign I only get an error message in the terminal. I've made sure the histology images are numbered correctly, have fixed widths of 1500 pixels, and have the json/xml file in the same folder so they should be formatted correctly for Quicknii. I tried deleting and redownloading Quicknii to no avail. Using the Quicknii filebuilder on the same files i supplied to Deepslice works as normal, and the histology images show up in Quicknii. Any idea what could be causing this issue?

PolarBean commented 3 weeks ago

Can you please post the json that comes out of DeepSlice and the json that comes out of the file builder so that I can compare :)

TorSolOpp commented 3 weeks ago

Sure, and thanks for the quick response. I tried using the python package, and this ended up working! Quite happy to be able to continue using DeepSlice in my pipeline. I'll add the python install json as well. Filebuilder only gave me the option of saving an xml which I can't upload to github, so I saved it as a json through quicknii. Not sure if that would affect anything you're interested in looking at.

filebuilder_json.json MyResults_python.json results_web.json

I also had some issues trying to install using pip install, which requires tensorflow<=2.1.5, but this version doesn't seem to be available and I wasn't able to install (at least not with pip or a local download).

Similarly, when I tried to create the DS-CPU environment, I received an error which I am unsure of how to resolve. I posted the error message at the bottom of this comment. DS-GPU on the other hand worked fine with no errors. As I said, I'm very happy to be able to use deepslice instead of going manual-mode in Quicknii!

Error message:

LibMambaUnsatisfiableError: Encountered problems while solving:

Could not solve for environment specs The following packages are incompatible ├─ _openmp_mutex ==4.5 1_gnu does not exist (perhaps a typo or a missing channel); ├─ aiohttp ==3.8.1 py37h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ anyio ==3.5.0 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ argon2-cffi-bindings ==21.2.0 py37h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ astor ==0.8.1 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ blinker ==1.4 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ blosc ==1.21.0 h8c45485_0 does not exist (perhaps a typo or a missing channel); ├─ bottleneck ==1.3.4 py37hce1f21e_0 does not exist (perhaps a typo or a missing channel); ├─ brotli ==1.0.9 he6710b0_2 does not exist (perhaps a typo or a missing channel); ├─ brotlipy ==0.7.0 py37h27cfd23_1003 does not exist (perhaps a typo or a missing channel); ├─ brunsli ==0.1 h2531618_0 does not exist (perhaps a typo or a missing channel); ├─ bzip2 ==1.0.8 h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ c-ares ==1.18.1 h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ ca-certificates ==2022.4.26 h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ certifi ==2022.5.18.1 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ cffi ==1.15.0 py37hd667e15_1 does not exist (perhaps a typo or a missing channel); ├─ cfitsio ==3.470 hf0d0db6_6 does not exist (perhaps a typo or a missing channel); ├─ charls ==2.2.0 h2531618_0 does not exist (perhaps a typo or a missing channel); ├─ cryptography ==36.0.0 py37h9ce1e76_0 does not exist (perhaps a typo or a missing channel); ├─ curl ==7.80.0 h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ cytoolz ==0.11.0 py37h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ debugpy ==1.5.1 py37h295c915_0 does not exist (perhaps a typo or a missing channel); ├─ expat ==2.4.4 h295c915_0 does not exist (perhaps a typo or a missing channel); ├─ flask ==1.1.2 pyhd3eb1b0_0 is installable and it requires │ └─ jinja2 >=2.10.1,<3.0 , which can be installed; ├─ freetype ==2.11.0 h70c0345_0 does not exist (perhaps a typo or a missing channel); ├─ frozenlist ==1.2.0 py37h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ gettext ==0.21.0 hf68c758_0 does not exist (perhaps a typo or a missing channel); ├─ giflib ==5.2.1 h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ git ==2.34.1 pl5262hc120c5b_0 does not exist (perhaps a typo or a missing channel); ├─ grpcio ==1.42.0 py37hce63b2e_0 does not exist (perhaps a typo or a missing channel); ├─ h5py ==2.10.0 py37hd6299e0_1 does not exist (perhaps a typo or a missing channel); ├─ hdf5 ==1.10.6 hb1b8bf9_0 does not exist (perhaps a typo or a missing channel); ├─ icu ==58.2 he6710b0_3 does not exist (perhaps a typo or a missing channel); ├─ imagecodecs ==2021.8.26 py37h4cda21f_0 does not exist (perhaps a typo or a missing channel); ├─ importlib-metadata ==4.8.2 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ intel-openmp ==2021.4.0 h06a4308_3561 does not exist (perhaps a typo or a missing channel); ├─ ipykernel ==6.4.1 py37h06a4308_1 does not exist (perhaps a typo or a missing channel); ├─ ipython ==7.31.1 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ jinja2 ==3.0.2 pyhd3eb1b0_0 is not installable because it conflicts with any installable versions previously reporte; ├─ jpeg ==9d h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ jupyter_core ==4.9.1 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ jxrlib ==1.1 h7b6447c_2 does not exist (perhaps a typo or a missing channel); ├─ kiwisolver ==1.3.2 py37h295c915_0 does not exist (perhaps a typo or a missing channel); ├─ krb5 ==1.19.2 hac12032_0 does not exist (perhaps a typo or a missing channel); ├─ lcms2 ==2.12 h3be6417_0 does not exist (perhaps a typo or a missing channel); ├─ ld_impl_linux-64 ==2.35.1 h7274673_9 does not exist (perhaps a typo or a missing channel); ├─ lerc ==3.0 h295c915_0 does not exist (perhaps a typo or a missing channel); ├─ libaec ==1.0.4 he6710b0_1 does not exist (perhaps a typo or a missing channel); ├─ libcurl ==7.80.0 h0b77cf5_0 does not exist (perhaps a typo or a missing channel); ├─ libdeflate ==1.8 h7f8727e_5 does not exist (perhaps a typo or a missing channel); ├─ libedit ==3.1.20210910 h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ libev ==4.33 h7f8727e_1 does not exist (perhaps a typo or a missing channel); ├─ libffi ==3.3 he6710b0_2 does not exist (perhaps a typo or a missing channel); ├─ libgcc-ng ==9.3.0 h5101ec6_17 does not exist (perhaps a typo or a missing channel); ├─ libgfortran-ng ==7.5.0 ha8ba4b0_17 does not exist (perhaps a typo or a missing channel); ├─ libgfortran4 ==7.5.0 ha8ba4b0_17 does not exist (perhaps a typo or a missing channel); ├─ libgomp ==9.3.0 h5101ec6_17 does not exist (perhaps a typo or a missing channel); ├─ libnghttp2 ==1.46.0 hce63b2e_0 does not exist (perhaps a typo or a missing channel); ├─ libpng ==1.6.37 hbc83047_0 does not exist (perhaps a typo or a missing channel); ├─ libprotobuf ==3.19.1 h4ff587b_0 does not exist (perhaps a typo or a missing channel); ├─ libsodium ==1.0.18 h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ libssh2 ==1.9.0 h1ba5d50_1 does not exist (perhaps a typo or a missing channel); ├─ libstdcxx-ng ==9.3.0 hd4cf53a_17 does not exist (perhaps a typo or a missing channel); ├─ libtiff ==4.1.0 h2733197_1 does not exist (perhaps a typo or a missing channel); ├─ libwebp ==1.2.0 h89dd481_0 does not exist (perhaps a typo or a missing channel); ├─ libxml2 ==2.9.12 h03d6c58_0 does not exist (perhaps a typo or a missing channel); ├─ libxslt ==1.1.34 hc22bd24_0 does not exist (perhaps a typo or a missing channel); ├─ libzopfli ==1.0.3 he6710b0_0 does not exist (perhaps a typo or a missing channel); ├─ locket ==0.2.1 py37h06a4308_1 does not exist (perhaps a typo or a missing channel); ├─ lxml ==4.8.0 py37h1f438cf_0 does not exist (perhaps a typo or a missing channel); ├─ lz4-c ==1.9.3 h295c915_1 does not exist (perhaps a typo or a missing channel); ├─ markdown ==3.3.4 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ markupsafe ==2.0.1 py37h27cfd23_0 does not exist (perhaps a typo or a missing channel); ├─ matplotlib-base ==3.5.1 py37ha18d171_0 does not exist (perhaps a typo or a missing channel); ├─ mistune ==0.8.4 py37h14c3975_1001 does not exist (perhaps a typo or a missing channel); ├─ mkl-service ==2.4.0 py37h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ mkl ==2021.4.0 h06a4308_640 does not exist (perhaps a typo or a missing channel); ├─ mkl_fft ==1.3.1 py37hd3c417c_0 does not exist (perhaps a typo or a missing channel); ├─ mkl_random ==1.2.2 py37h51133e4_0 does not exist (perhaps a typo or a missing channel); ├─ multidict ==5.2.0 py37h7f8727e_2 does not exist (perhaps a typo or a missing channel); ├─ nbconvert ==6.3.0 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ ncurses ==6.3 h7f8727e_2 does not exist (perhaps a typo or a missing channel); ├─ notebook ==6.4.8 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ numexpr ==2.8.1 py37h6abb31d_0 does not exist (perhaps a typo or a missing channel); ├─ openjpeg ==2.4.0 h3ad879b_0 does not exist (perhaps a typo or a missing channel); ├─ openssl ==1.1.1o h7f8727e_0 does not exist (perhaps a typo or a missing channel); ├─ pcre2 ==10.37 he7ceb23_1 does not exist (perhaps a typo or a missing channel); ├─ perl ==5.26.2 h14c3975_0 does not exist (perhaps a typo or a missing channel); ├─ pillow ==8.4.0 py37h5aabda8_0 does not exist (perhaps a typo or a missing channel); ├─ pip ==21.2.2 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ protobuf ==3.19.1 py37h295c915_0 does not exist (perhaps a typo or a missing channel); ├─ pyrsistent ==0.18.0 py37heee7806_0 does not exist (perhaps a typo or a missing channel); ├─ python ==3.7.11 h12debd9_0 does not exist (perhaps a typo or a missing channel); ├─ pywavelets ==1.1.1 py37h7b6447c_2 does not exist (perhaps a typo or a missing channel); ├─ pyyaml ==6.0 py37h7f8727e_1 does not exist (perhaps a typo or a missing channel); ├─ pyzmq ==22.3.0 py37h295c915_2 does not exist (perhaps a typo or a missing channel); ├─ readline ==8.1.2 h7f8727e_1 does not exist (perhaps a typo or a missing channel); ├─ scikit-image ==0.17.2 py37hdf5156a_0 does not exist (perhaps a typo or a missing channel); ├─ scikit-learn ==0.23.2 py37h0573a6f_0 does not exist (perhaps a typo or a missing channel); ├─ scipy ==1.7.3 py37hc147768_0 does not exist (perhaps a typo or a missing channel); ├─ setuptools ==58.0.4 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ snappy ==1.1.8 he6710b0_0 does not exist (perhaps a typo or a missing channel); ├─ sniffio ==1.2.0 py37h06a4308_1 does not exist (perhaps a typo or a missing channel); ├─ sqlite ==3.37.2 hc218d9a_0 does not exist (perhaps a typo or a missing channel); ├─ tensorflow-base ==2.2.0 mkl_py37hd506778_0 does not exist (perhaps a typo or a missing channel); ├─ tensorflow ==2.2.0 mkl_py37h6e9ce2d_0 does not exist (perhaps a typo or a missing channel); ├─ termcolor ==1.1.0 py37h06a4308_1 does not exist (perhaps a typo or a missing channel); ├─ terminado ==0.13.1 py37h06a4308_0 does not exist (perhaps a typo or a missing channel); ├─ tk ==8.6.11 h1ccaba5_0 does not exist (perhaps a typo or a missing channel); ├─ tornado ==6.1 py37h27cfd23_0 does not exist (perhaps a typo or a missing channel); ├─ websocket-client ==0.58.0 py37h06a4308_4 does not exist (perhaps a typo or a missing channel); ├─ wrapt ==1.13.3 py37h7f8727e_2 does not exist (perhaps a typo or a missing channel); ├─ xz ==5.2.5 h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ yaml ==0.2.5 h7b6447c_0 does not exist (perhaps a typo or a missing channel); ├─ yarl ==1.6.3 py37h27cfd23_0 does not exist (perhaps a typo or a missing channel); ├─ zeromq ==4.3.4 h2531618_0 does not exist (perhaps a typo or a missing channel); ├─ zfp ==0.5.5 h295c915_6 does not exist (perhaps a typo or a missing channel); ├─ zlib ==1.2.11 h7f8727e_4 does not exist (perhaps a typo or a missing channel); └─ zstd ==1.4.9 haebb681_0 does not exist (perhaps a typo or a missing channel).

PolarBean commented 3 weeks ago

The issue is you have a space in your filenames which the web version is replacing with an underscore. Remove the space and you should be good! Tensorflow 2.15.0 is available as it is very recent. You probably need to use a newer version of python (I think it says here you are using python 3.7.) I should test which versions work and update the readme. Install a newer python and then pip install DeepSlice should work just fine.

TorSolOpp commented 3 weeks ago

Should have known it would be something as simple as a space in the filenames. Thank you!

Regarding the DS-CPU issue, the 3.7 python you're seeing was installed through the DS-GPU environment installed from the yml file, which as mentioned works great, so that's what you're seeing. It's also the same version of python in the DS-CPU yml file, I think (3.7.11). I doublechecked that I was using python version 3.12.4 in the terminal when trying to create the DS-CPU environment, but it still produces the same error I posted above.

Regarding pip install DeepSlice, I verified in a Jupyter Notebok that it was also running python 3.12.4 with (sys.version), but the install still produces an error regarding tensorflow which I've posted at the bottom of the comment. Trying to specify pip install DeepSlice==1.2.4 produces the same error as trying to install tensorflow==2.15.0, which looks like this:

ERROR: Could not find a version that satisfies the requirement tensorflow==2.15.0 (from versions: 2.16.0rc0, 2.16.1, 2.16.2, 2.17.0rc0, 2.17.0rc1, 2.17.0) ERROR: No matching distribution found for tensorflow==2.15.0

Trying to pip install with the whl file gives the same error. Looking at the whl file for 2.15.0 it looks like it is specific to python 3.11? So I guess that could be the issue.

Error from pip install DeepSlice:

Collecting DeepSlice Using cached DeepSlice-1.2.4-py3-none-any.whl.metadata (9.5 kB) Requirement already satisfied: numpy in c:\users\tor-s\anaconda3\lib\site-packages (from DeepSlice) (1.26.4) Requirement already satisfied: scikit-learn in c:\users\tor-s\anaconda3\lib\site-packages (from DeepSlice) (1.4.2) Requirement already satisfied: scikit-image in c:\users\tor-s\anaconda3\lib\site-packages (from DeepSlice) (0.23.2) INFO: pip is looking at multiple versions of deepslice to determine which version is compatible with other requirements. This could take a while. Using cached DeepSlice-1.2.3-py3-none-any.whl.metadata (9.4 kB) Using cached DeepSlice-1.2.2-py3-none-any.whl.metadata (9.4 kB) Using cached DeepSlice-1.2.1-py3-none-any.whl.metadata (9.4 kB) Using cached DeepSlice-1.2-py3-none-any.whl.metadata (9.4 kB) Using cached DeepSlice-1.1.7-py3-none-any.whl.metadata (9.5 kB) Using cached DeepSlice-1.1.6-py3-none-any.whl.metadata (9.5 kB) Using cached DeepSlice-1.1.5-py3-none-any.whl.metadata (8.3 kB) INFO: pip is still looking at multiple versions of deepslice to determine which version is compatible with other requirements. This could take a while. Using cached DeepSlice-1.1.4-py3-none-any.whl.metadata (8.2 kB) Using cached DeepSlice-1.1.3-py3-none-any.whl.metadata (8.2 kB) Using cached DeepSlice-1.1.2-py3-none-any.whl.metadata (8.2 kB) Using cached DeepSlice-1.1.1-py3-none-any.whl.metadata (8.2 kB) Using cached DeepSlice-1.1.0-py3-none-any.whl.metadata (8.2 kB) INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C. Using cached DeepSlice-1.0.11-py3-none-any.whl.metadata (8.1 kB) Using cached DeepSlice-1.0.6-py3-none-any.whl.metadata (8.1 kB) Using cached DeepSlice-1.0.5.tar.gz (31 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using cached DeepSlice-1.0.4.tar.gz (27 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using cached DeepSlice-1.0.3.tar.gz (26 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using cached DeepSlice-1.0.2.tar.gz (26 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using cached DeepSlice-1.0.1.tar.gz (16 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using cached DeepSlice-1.0.0.tar.gz (16 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done'

The conflict is caused by: deepslice 1.2.4 depends on tensorflow<=2.15.0 deepslice 1.2.3 depends on tensorflow<=2.15.0 deepslice 1.2.2 depends on tensorflow<=2.15.0 deepslice 1.2.1 depends on tensorflow<=2.15.0 deepslice 1.2 depends on tensorflow<=2.15.0 deepslice 1.1.7 depends on tensorflow==1.15.0 deepslice 1.1.6 depends on tensorflow==1.15.0 deepslice 1.1.5 depends on tensorflow==1.15.0 deepslice 1.1.4 depends on tensorflow==1.15.0 deepslice 1.1.3 depends on tensorflow==1.15.0 deepslice 1.1.2 depends on tensorflow==1.15.0 deepslice 1.1.1 depends on tensorflow==1.15.0 deepslice 1.1.0 depends on tensorflow==1.15.0 deepslice 1.0.11 depends on tensorflow==1.15.0 deepslice 1.0.6 depends on tensorflow==1.15.0 deepslice 1.0.5 depends on tensorflow==1.15.0 deepslice 1.0.4 depends on tensorflow==1.15.0 deepslice 1.0.3 depends on tensorflow==1.15.0 deepslice 1.0.2 depends on tensorflow==1.15.0 deepslice 1.0.1 depends on tensorflow==1.15.0 deepslice 1.0.0 depends on tensorflow==1.15.0

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip to attempt to solve the dependency conflict

Note: you may need to restart the kernel to use updated packages. ERROR: Cannot install deepslice==1.0.0, deepslice==1.0.1, deepslice==1.0.11, deepslice==1.0.2, deepslice==1.0.3, deepslice==1.0.4, deepslice==1.0.5, deepslice==1.0.6, deepslice==1.1.0, deepslice==1.1.1, deepslice==1.1.2, deepslice==1.1.3, deepslice==1.1.4, deepslice==1.1.5, deepslice==1.1.6, deepslice==1.1.7, deepslice==1.2, deepslice==1.2.1, deepslice==1.2.2, deepslice==1.2.3 and deepslice==1.2.4 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

PolarBean commented 3 weeks ago

the DS-CPU and GPU files are quite old and install an older version of DeepSlice, I should remove them. Ok i replicated your problem it seems it is because of python 3.12 not supporting tensorflow 2.15.0. please use Python 3.11. Ill add it to the README