Help submitting extension Breast DCE-MRI FTV

I just submitted pull request for my new extension to the master branch of Extensions Index.

The attached image says that 1 of the 3 checks failed. Is this something I need to fix? If so, how?

I submitted this pull request to master. Which other branches of ExtensionsIndex do you recommend that I submit pull request to?

Please let me know as soon as possible if there is anything in the SlicerBreast_DCEMRI_FTV repository that needs to be corrected. I really need complete this submission process before Friday.

Thanks!
Rohan

Hi @rohan_n this looks like a great extension and there were just a few comments in the PR. For this one, you can click the “Details” button on the right side of the CI check and it should take you to this page with the issue and suggested change. Thanks for the contribution!

Thanks, I committed the changes suggested by you and James.
When can I expect this to appear in extension manager, and will it be in latest nightly release or latest stable release?

I just merged the s4ext file into the ExtentionIndex master, so that means it should show up tomorrow mid-day as an extension for the Nightly build. If you also want it to be available for the current stable release, you can make a PR against the 4.11 branch, assuming you have tested it there. For a new extension usually you pick either one or the other for first tests, use the nightly if you need new features from the core that aren’t in the latest release or use the release to avoid incompatibilities popping up if the nightly changes. Longer term projects often end up with a stable version of the extension pointing to a release, and a development branch is configured to work with the nightly. You manage this with the branch of your extension repo that is referenced from the s4ext file in the corresponding branches of the ExtensionIndex. (Hope that is all clear).

Thanks for the info. I actually did all of my testing in 4.11 so I just submitted a pull request to the 4.11 branch of the extensions index.

Perfect, it’s merged in both now.

Hello again.
When I install the extension from the Extension Manager, I get the following error

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\rnadkarni\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Python\Lib\imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 618, in _exec
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:/Users/rnadkarni/AppData/Local/NA-MIC/Slicer 4.11.20210226/NA-MIC/Extensions-29738/Breast_DCEMRI_FTV/lib/Slicer-4.11/qt-scripted-modules/DCE_TumorMapProcess.py", line 106, in <module>
    import Breast_DCEMRI_FTV_plugins2
ModuleNotFoundError: No module named 'Breast_DCEMRI_FTV_plugins2'

Would you be able to suggest the changes that would fix this error in a way that I can easily commit them to my Github repository?
I’m guessing that a similar error might occur in DCE_IDandPhaseSelect.py, which imports Breast_DCEMRI_FTV_plugins1.
Sorry about this. I tested the extension on 2 different computers prior to submitting it and did not see this error.

Thanks,
Rohan Nadkarni

Places like linked below are where you’re missing the build process to include your “Lib” type directory of files. To fully make sure your extension will work from being downloaded from the Extensions Manager, you should actually build your extension (not just using the additional-modules flag). Building the extension all the way to the ZIP file and installing it manually into Slicer will confirm it will work. Documentation/Nightly/Developers/FAQ - Slicer Wiki

See this other extension that has a “Lib” type directory for example

I’m sorry to be having so much trouble with this. This is the first time I’ve submitted an extension and I have no experience using CMake.
If I’m trying to build this extension on Mac, I have latest nightly release of Slicer with location
/Applications/Slicer.app, extension installed in location /Users/rohan_nadkarni/Desktop/Breast_DCEMRI_FTV and I just created the folder /Users/rohan_nadkarni/Desktop/Breast_DCEMRI_FTV-build, what is the correct way to modify this command

cmake -DCMAKE_BUILD_TYPE:STRING=Release -DSlicer_DIR:PATH=/path/to/Slicer-Superbuild/Slicer-build ../MyExtension

for my setup? Actually, I’m also confused about this part in the link you shared

MaxOSX : Extension must be configured specifying CMAKE_OSX_* variables matching the one used to configure Slicer:

So if there are any additional commands I need to run besides the cmake and make commands, please let me know.

Thanks,
Rohan

Hi @rohan_n -

Yes, the process can be a bit confusing. These are the scripts I use for building the SlicerDMRI extension on my mac, but they are pretty general purpose for any extension. I believe your extension is pure python so you don’t need the parts about deployment targets or qt and cli modules but they won’t hurt anything.

First is a cmake-cmd.sh that you only need to run once in the build directory:

# run this from within build tree

SLICER_BUILD=/opt/s/Slicer-build

cmake \
        -DCMAKE_BUILD_TYPE:STRING=Debug \
        -DSlicer_DIR:PATH=${SLICER_BUILD} \
        -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 \
        ../SlicerDMRI

Then run make to build the extension.

The second is to run-slicer.sh sets all the paths to the extension’s modules:

#!/bin/zsh

# run this from within build tree

SLICER_BUILD=/opt/s/Slicer-build

LIB_PATH=$(pwd)/inner-build/lib/Slicer-4.13

SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk ${SLICER_BUILD}/Slicer $* \
  --additional-module-paths \
    ${LIB_PATH}/cli-modules ${LIB_PATH}/qt-loadable-modules ${LIB_PATH}/qt-scripted-modules

Thank you. Unfortunately I tried running your first shell script cmake-cmd.sh and got the following error.

CMake Error at CMakeLists.txt:17 (find_package):
  By not providing "FindSlicer.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Slicer", but
  CMake did not find one.

  Could not find a package configuration file provided by "Slicer" with any
  of the following names:

    SlicerConfig.cmake
    slicer-config.cmake

  Add the installation prefix of "Slicer" to CMAKE_PREFIX_PATH or set
  "Slicer_DIR" to a directory containing one of the above files.  If "Slicer"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

I thought at first this error occurred because I don’t have a directory /opt/s/Slicer-build.
But I tried replacing setting SLICER_BUILD=/Applications/Slicer.app and got the same error.
I don’t see SlicerConfig.cmake or slicer-config.cmake anywhere on my computer.

Ah, yes, that’s another important thing: I believe testing the extension building/packaging process locally requires that you have a local version of Slicer built from source. This is a requirement for C++ based extension but it is a pain for Python extensions. A consolation is that building from source on mac is fairly painless, but can take a long time depending on your computer.

Ok. But going back to the error

No module named 'Breast_DCEMRI_FTV_plugins2'

do I have to do anything other than use a text editor to add the type of corrections to the CMakeLists.txt files mentioned in James Butler’s reply? If that’s all I have to do to resolve that error, I won’t bother with building the extension locally for now.

Right, you don’t need to build everything locally to fix the installation issue. You can even edit the files directly on github in the browser. It may take a couple days but you can keep an eye on the nightly builds until you get the right formulation. Basically yes, as @jamesobutler said it’s just a matter of making sure the non-module code is in the Lib directory and that they are listed for install in the CMakeLists.txt file.

Yes, you can do the type of edits as I suggested and check each day to see if the factory machine built the extension successfully and it load properly. This is a iterative process.

If you don’t have the time to make changes, wait for the next day, etc and need the extension to be available and working properly, then building the extension from source using a Slicer build tree (Slicer built from source) you can make sure the extension is building, installing and loading appropriately. This will let you know for sure that everything is working.

I edited the CMakeLists.txt files for both modules on Aug 1 at 2pm pacific time. Feel free to look at the Github again to make sure I did it correctly.
However, the latest nightly build of Slicer doesn’t have my extension at all, and Slicer 4.11.20210226 appears to have the version of my extension from before the edits to the CMakeLists.txt files.

Is there anything that can be done to speed up the process of updating the copy of my extension on extension manager?

Thank you so much,
Rohan

You can review if your extension is having configure/build/test issues on the Slicer CDash dashboard.

CDash results for the Slicer Preview from August 1 to August 4th:
https://slicer.cdash.org/index.php?project=SlicerPreview&begin=2021-08-01&end=2021-08-04&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=Breast_DCEMRI_FTV

CDash results for the latest Slicer Stable from August 1 to August 4th:
https://slicer.cdash.org/index.php?project=Slicer4&begin=2021-08-01&end=2021-08-04&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=Breast_DCEMRI_FTV

It shows starting on August 2nd, the extension began to fail to configure likely due to the changes you made on August 1st. The extensions are built each night. Any updates you make in your repo will be used for the next nightly build and doesn’t require any updates to the Slicer ExtensionsIndex repo as you specified to use the master branch for your repo. Therefore it will use the latest of that branch.

Building the extension locally (requires Slicer built from source) would help you know if your changes resolve the issue with it being available through the Slicer ExtensionsManager. Otherwise you will have to make updates and wait to review the result on the Slicer dashboard from each nightly build. This was mentioned in

See Extension build improvements by jamesobutler · Pull Request #2 · rnadkarni2/SlicerBreast_DCEMRI_FTV · GitHub to help out with building this extension.

1 Like

The version built last night works fine when I download from Extension Manager.
Thank you @pieper and @jamesobutler for your help!

2 Likes

Hi @rohan_n , Thanks for your great work by sharing and submitting the extension of Breast DCE-MRI FTV. I’m interested in this extension and hope that I can use it to do some research about breast cancer. However, errors occured when I tried to install it. It seems that Breast_DCEMRI_FTV is not compatible to the neweast version of 3D slicer (more detailed infomation: error with installing extension Breast_DCEMRI_FTV). I checked the manual of Breast_DCEMRI_FTV and found a picture in the manual which showed you used 3D slicer version 4.11.20200930. But no usable extension of Breast_DCEMRI_FTV can be found for this older version of 3D slicer on the extension manager, nor on the official website. Would you please help me and tell me where can I find the extension of Breast_DCEMRI_FTV compatible for 3D slicer version 4.11.20200930, or would you please help me to fix the problem. I really need to install the extension and start to use it as soon as posible.
Thanks very much!