-
Notifications
You must be signed in to change notification settings - Fork 246
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
SlicerPhotogrammetry Experimental #2139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The installation of segment-anything is requiring a local git dependency that regular users might not have. This should be switched to install from the zip format of the source code pulled down like TotalSegmentator does here. https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/8bbb4e7d847e0904e9d8c5955801f8bd5ff0e7de/Photogrammetry/Photogrammetry.py#L855
- There is further a dependency on git to clone a repo? https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/8bbb4e7d847e0904e9d8c5955801f8bd5ff0e7de/Photogrammetry/Photogrammetry.py#L2320-L2327
- Is there a reason to force a specific older computation backend? If users have a newer Nvidia driver they could have compatibility with the CUDA 12.x versions of PyTorch. https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/8bbb4e7d847e0904e9d8c5955801f8bd5ff0e7de/Photogrammetry/Photogrammetry.py#L823
https://github.com/SlicerMorph/SlicerPhotogrammetry?tab=readme-ov-file#running-locally:
Currently only mode of operation supported is to launch the OpenDroneMap server locally. This requires having docker (and optionally Nvidia Container toolkit if you are planning to use a Nvidia GPU) installed and that the user running Slicer is authorized to launch docker images.
Is this extension generally useful to the Slicer community to be installed by regular Slicer users on their systems? Or is this specific to MorphoCloud usage? If so, it would seem MorphoCloud should install the extension directly rather than going through the Slicer Extensions Index. Especially since this appears to contain only scripted loadable modules without a real need to actually compile anything as the factory build machines might otherwise provide. The extension could be loaded through additional module paths which can also be done by dropping the extension zip into the main window area to load.
For both of these we can switch to unpacking the zip files. Thanks for the example. @oothomas can you please make the changes?
Yes, because with 12.X versions light the torch bring a very old version of the torchvision library that breaks SAM (we have reported this separately as an issue). In our experiments forcing version 11.8 did provide a recent version of the torchvision
Initially we want to deploy this on the Linux (and yes on the MorphoCloud), and then on Windows and Mac) I can't speak if the extension is generally useful for all the Slicer community, but it is quite useful and requested for SlicerMorph users, hence we want to have it in the extension catalogue. |
The Slicer Extensions Index doesn't currently provide a way to specify that an extension be available for only one of the platforms. Since this is a scripted loadable module there won't be a build error on Windows or macOS that would otherwise prevent it on those platforms. You could potentially throw a error if it is building on Windows or macOS in the CMakeLists.txt of the extension https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/master/CMakeLists.txt. This would help prevent the extension from showing up for regular Slicer users on these platforms. The extension isn't really "ready" for these users. This extension appears to be set up for easy use strictly through MorphoCloud where all the dependencies are already available. |
Co-authored-by: James Butler <[email protected]>
just checking to see if I understand the problem: @muratmaga and @jamesobutler would adding the .zip files to the resource folder and doing the following solve the problem? |
No don’t upload the zipped source code to your repo. Install using the download zip link to latest code or a specific commit like TotalSegmentator does here. - slicer.util.pip_install("git+https://github.com/facebookresearch/segment-anything.git")
+ slicer.util.pip_install("https://github.com/facebookresearch/segment-anything/archive/refs/heads/main.zip") |
@oothomas I confirm it works well for a fresh install. Can you add a logic to the CMakeList.txt so that the build will fail for non-Linux OS? That way extension will not show up on the Mac/Windows extension list until we are ready to deploy it on those platforms? |
nevermind, I figured it out. |
@oothomas please do not post screen captures, but copy/paste the lines or link the actual line number. Also if this is the change, I am not sure if the build names are correct. I don't think there is a win32 build of Slicer. And the way it is develop, wouldn't this simply display with the message and proceed with the rest of the cmake file? |
Thanks @jamesobutler I made that change. Is the use of return() here okay? I assume this will end the make process and only coninue if UNIX. if(APPLE OR WIN32)
message(FATAL_ERROR "SlicerPhotogrammetry is only supported on Linux. Skipping build on this platform.")
return()
endif() |
The FATAL_ERROR message will cause the configure to exit with a failure and not proceed to building so the |
@jamesobutler can this be merged? |
Thanks @jamesobutler for the review 🙏 |
@oothomas When you have chance, I suggest you also address: |
@jamesobutler Since you have been reviewing this extension, I will let you move forward with its integration 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Regarding the CMakeLists.txt logic to throw the error on configure, I would probably recommend putting that after the CMake minimum statement and project name and possibly after extension metadata fields.
-
Have you thought about an extension icon? This is what users will see when they go to install it from the Extensions Manager. Nearly every existing extension has a unique icon and does not use the template provided extension icon.
https://raw.githubusercontent.com/SlicerMorph/SlicerPhotogrammetry/master/SlicerPhotogrammetry.png -
A usual review provided by @lassoan is that the extension should be named without the "Slicer" prefix so that not all extensions start with that when browsing the extensions manager in the application. The GitHub repo should have the "Slicer" prefix though.
https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/6a8a51c688b0ad2cbfac0c07869e8adba655bc68/CMakeLists.txt#L6 should be updated to just "Photogrammetry" as the extension name and other logging/dialog messages to the user should indicate to install the "Photogrammetry" extension. Getting the name right before integration will be important so that it doesn't get uploaded into the Stable extension manager and served up as both names following a rename which would require manual deletion of the original name package. -
When entering Photogrammetry for the first time I observed it took a long time to enter. This is because it is automatically trying to install all the python package dependencies. Before doing this action I would suggest a dialog to the user asking to confirm whether they want to do this process now since it takes several minutes to complete (like this). It gives the user an out. Same goes for the "Recursive Spectral Clustering" module which has the same experience.
"Have you thought about an extension icon? This is what users will see when they go to install it from the Extensions Manager. Nearly every existing extension has a unique icon and does not use the template provided extension icon." I'll add icons for both modules asap. Can we proceed without it for testing purposes? |
We will have a proper icon for the Photogrammetry in next couple weeks (it is being designed), but for the time being we can use the generic one. |
I think all but the icon have been addressed. Just let me know if there are any other issues @jamesobutler and @muratmaga. |
I am not seeing any commits or the changes @jamesobutler requested to correct extension name. Please provide a commit link? |
Hi @jamesobutler and @jcfr Here are more specifics regarding the changes you recommended. "Regarding the CMakeLists.txt logic to throw the error on configure, I would probably recommend putting that after the CMake minimum statement and project name and possibly after extension metadata fields." "A usual review provided by @lassoan is that the extension should be named without the "Slicer" prefix so that not all extensions start with that when browsing the extensions manager in the application. The GitHub repo should have the "Slicer" prefix though." "When entering Photogrammetry for the first time I observed it took a long time to enter. This is because it is automatically trying to install all the python package dependencies. Before doing this action I would suggest a dialog to the user asking to confirm whether they want to do this process now since it takes several minutes to complete (like this). It gives the user an out. Same goes for the "Recursive Spectral Clustering" module which has the same experience." https://github.com/SlicerMorph/SlicerPhotogrammetry/blob/master/ClusterPhotos/ClusterPhotos.py#L21 "When you have chance, I suggest you also address: I'm actively refining the extension for the extension catalog, so I welcome any pointers and suggestions on how to improve it. Just let me know if there are any other issues delaying approval. |
New extension
Tier 1
Any extension that is listed in the Extensions Catalog must fulfill these requirements.
3d-slicer-extension
GitHub topic so that it is listed here. To edit topics, click the settings icon in the right side of "About" section header and enter3d-slicer-extension
in "Topics" and click "Save changes". To learn more about topics, read https://help.github.com/en/articles/about-topicsSettings
and in repository settings uncheckWiki
,Projects
, andDiscussions
(if they are currently not used).About
in the top-right corner of the repository main page and uncheckReleases
andPackages
(if they are currently not used)