Open postnubilaphoebus opened 10 months ago
Hi Laurids, thanks for your message and great to hear that the Windows version is working for you (at least partly :-) ). For the Linux version it's most likely only resolvable by recompiling it from the sources on your system. If you want to go forward with this and need some assistance on the way, just let me know.
For the current issue you're mentioning: at least it seems like XPIWIT itself is working properly and it's most likely related to the GPU/CUDA/Pytorch part that is used for the Cellpose3D. It's a bit hard to debug without more information. Could you try to look at the generated log-file (.txt file that should be placed in the "results" subfolder inside the selected output folder). Maybe there are more information displayed to track down the error. Moreover, you could check if the CMD window that also pops up when opening XPIWITGUI shows any errors.
Best, Johannes
Hi Johannes,
Thank you for the swift reply.
The Console in the GUI outputs
C:/path/to/destination/item_0011_GradientVectorFlowTrackingImageFilter/SyntheticMembranes_GradientVectorFlowTrackingImageFilter_Out1.tif does not exist yet
The log-file output is as follows:
Executing Process Object: IMAGEREADER...
Updating reader took: 0.084
Updating intensity window filter took: 0.009
Updating image wrapper took: 0
+ Execution of IMAGEREADER finished.
- Duration: 0.097 seconds.
+ Settings:
- WriteResult: 1
- WriteMetaData: 1
- MaxThreads: -1
- Compression: 1
- Precision: 16
- UseSeriesReader: 0
- SeriesMinIndex: 0
- SeriesMaxIndex: 499
- SeriesIncrement: 1
- SpacingX: 1
- SpacingY: 1
- SpacingZ: 1
- InputMinimumValue: 0
- InputMaximumValue: 65535
-----------------------------------------------------------------------------------------------
Executing Process Object: CASTIMAGEFILTER...
- Cast image: (float -> unsigned short)
Rescale flag: 1
- Windowing image: [0, 1] -> [0, 65535]
+ Execution of CASTIMAGEFILTER finished.
- Duration: 0.012 seconds.
-----------------------------------------------------------------------------------------------
Executing Process Object: IMAGEWRITER...
+ Execution of IMAGEWRITER finished.
- Duration: 0.578 seconds.
+ Settings:
- WriteResult: 1
- WriteMetaData: 1
- MaxThreads: -1
- Compression: 1
- Precision: 16
- Precision: 16
- Compression: 1
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
Initialize Process Object: RESCALEINTENSITYIMAGEFILTER...
-----------------------------------------------------------------------------------------------
Executing Process Object: RESCALEINTENSITYIMAGEFILTER...
+ Execution of RESCALEINTENSITYIMAGEFILTER finished.
- Duration: 0.091 seconds.
+ Settings:
- WriteResult: 1
- WriteMetaData: 1
- MaxThreads: 12
- Compression: 1
- Precision: 16
-----------------------------------------------------------------------------------------------
Executing Process Object: CASTIMAGEFILTER...
- Cast image: (float -> unsigned short)
Rescale flag: 1
- Windowing image: [0, 1] -> [0, 65535]
+ Execution of CASTIMAGEFILTER finished.
- Duration: 0.009 seconds.
-----------------------------------------------------------------------------------------------
Executing Process Object: IMAGEWRITER...
+ Execution of IMAGEWRITER finished.
- Duration: 0.544 seconds.
+ Settings:
- WriteResult: 1
- WriteMetaData: 1
- MaxThreads: -1
- Compression: 1
- Precision: 16
- Precision: 16
- Compression: 1
-----------------------------------------------------------------------------------------------
Executing Process Object: TORCHMODEL...
-----------------------------------------------------------------------------------------------
Initialize Process Object: TORCHMODEL...
-----------------------------------------------------------------------------------------------
It indeed looks like torch/cuda is the problem.
Best, Laurids
Oki jop that indeed looks like there's a problem with the torch/cuda version the executable was compiled with. Guess in that case the only solution would be to recompile the sources on your machine (either on Windows or on Linux). Let me know if you need some help with that or are getting stuck somewhere on the way.
Another alternative would be to directly use the python implementation (which is also more flexible in case you need to modify something): https://github.com/stegmaierj/Cellpose3D .
A version of our Cellpose3D is also included in MorphographX 2.0 (https://morphographx.org/ ). Not sure about the Cuda version they compiled into it, but this could potentially be a more recent one.
Ok, as I'm interested in running the pretrained models, could you help me with recompiling it from source on Linux? If you have a list of instructions I could follow that would be very helpful. Thank you!
Sure, here's an extensive documentation. Most important for you would be section 5.2.
tl;dr: Prerequisites:
Download and install a recent version of CMake-GUI
Download and compile a recent version of ITK (https://docs.itk.org/en/latest/download.html). Make sure to enable ITK_USE_64_BIT_IDS (advanced checkbox needs to be ticked), enable ITK_Review. Release build should be sufficient if you only want to apply the software.
Install Qt5 (including development tools). Should hopefully just work with something like (sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools)
Download and install pytorch for C++ (https://pytorch.org/). Make sure to select the CUDA version that matches your installed drivers or for the start you can also resort to the CPU version to see if it runs at all.
Get the latest version of XPIWIT sources from https://bitbucket.org/jstegmaier/xpiwit/src/master/
Build the CmakeLists.txt files you'll find in the "Project" subfolder. CMakeQt5 is for the XPIWIT executable and CMakeQt5GUI is for the GUI.
If CMake complains about missing Qt, Torch or ITK, specify the folders manually in the Cmake Gui settings.
Build both the GUI and the main Executable.
If that all works properly you should then have the binaries in the folder Bin/XPIWIT and Bin/XPIWITGUI and can continue as with the binary packages you initially downloaded from bitbucket.
Just let me know if you're stuck somewhere :-).
Best,
Johannes
Thank you for the instructions. Unfortunately, I have some issues with ITK. Cmake-gui cannot find the path, and if I specify it (itk/cmake), I get
Could not find a package configuration file provided by "ITK" with any of
the following names:
ITKConfig.cmake
itk-config.cmake
The file resembling what it's looking for is ITKConfig.cmake.in
, but even after manually changing the file ending by removing .in, it doesn't work. Maybe an older version of ITK is better? I currently have the latest stable release installed via Git.
Best, Laurids
Hi again, I think for the ITK compiling you'd need to directly select the ITK root folder. Everything else should be figured out by CMake itself.
However, in the meantime I also compiled another version for Ubuntu 22.04.03 in a virtual machine and you can download the package here.
I already tested it with the Cellpose3D and seemed to work fine on the virtual machine. It only contains the CPU version of torch, however, so not a bit slower than the GPU version but maybe sufficient for an initial test. Let me know if this works for you and if you want to continue building it yourself, happy to assist. Guess if you'd indeed want to use the GPU version it would have to be built on your own as this is relatively picky w.r.t. the CUDA versions etc.
Best,
Johannes
Thank for recompiling it, but it does not seem to work.
From the console:
- Error loading the model! Segmentation fault (core dumped)
I also tried using the ITK root folder for cmake-gui (home/user_name/ITK) but that did not work either.
At least it seems XPIWIT is working on Ubuntu now, right? So the error presumably appears when trying to execute the pipeline? Did you adjust the modelpath in the TorchModel filter?
This part of the readme: "Filter TorchModel, Parameter ModelPath: Absolute path to the model to use for prediction. This should be a *.pt file containing a pretrained model suitable for the selected segmentation task. A demo model for Cellpose3D that was trained on confocal microscopy images of membrane labeled A. thaliana are provided next to the XPIWIT pipeline files in this repository."
To do this, select the TorchModel filter in the GUI and then look at the parameter ModelPath as mentioned above. The path should then be something like /this/is/the/path/to/Cellpose3D/Cellpose3D.pt
Regarding ITK, that's strange I also downloaded the latest version just a couple of minutes ago and compiled everything without issues. Here are the individual steps I performed:
At least it seems XPIWIT is working on Ubuntu now, right? So the error presumably appears when trying to execute the pipeline? Did you adjust the modelpath in the TorchModel filter?
This part of the readme: "Filter TorchModel, Parameter ModelPath: Absolute path to the model to use for prediction. This should be a *.pt file containing a pretrained model suitable for the selected segmentation task. A demo model for Cellpose3D that was trained on confocal microscopy images of membrane labeled A. thaliana are provided next to the XPIWIT pipeline files in this repository."
To do this, select the TorchModel filter in the GUI and then look at the parameter ModelPath as mentioned above. The path should then be something like /this/is/the/path/to/Cellpose3D/Cellpose3D.pt
I had done so in Windows but forgot on Ubuntu, thanks for reminding me. The version you compiled now does work with the path provided for the model weights. Thank you!
Oki great :-)! Actually, I also had the same issue when using the older binaries from 2021 on our 22.04.03 system. Seems there were some changes in basic libraries that caused this and good to have an updated version now.
Greetings, What is the recommended Ubuntu version to do the building from the source. I try to this in a container with Ubuntu base image. I tried to install the XPIWIT software on a HPC system as well, however I ran into all sorts of errors during building from the source. It would be very nice to have specific versions of the different components mentioned so we can try building this feasibly. For instance, in a successful build process what versions of the following components have been used? -Pytorch -ITK -gcc and openmp -CUDA ... Thanks.
Dear Ahmad,
thanks for your message. The latest Ubuntu version I tried is the one mentioned further above in this thread (22.04.03).
There are some more detailed compilation information in my post from 11.01.2024 further above. Regarding the versions of dependencies: it worked properly with ITK 5.3 (https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.3.0/InsightToolkit-5.3.0.zip) and you'll need qt5 (exact version is probably not relevant and you can just use the one you get from "sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools"). OpenMP should probably be just the system openmp that is installed anyway.
For pytorch: this is still quite experimental and not thoroughly tested. My best advise here would be to first test it with the CPU-only version (last one I tested and that worked was "1.7.1+cpu"). If this one works, you can try to upgrade to the GPU accelerated version that matches the CUDA version of your system. However, we found that if you have large 3D images and a capable multi-core CPU a tile-based processing is not much slower compared to GPU processing regarding the inference time.
Best regards,
Johannes
Hello, thank you for providing Cellpose3d! After trying Cellpose3D on Windows, it worked. However, after initialising the model as in the provided screenshot and supplying an input file, the folder gradientVectorFlowTracking remains empty. This is the case both for the example file as well as for my own data. The other modules do produce output, though. Any suggestions for a fix?