View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001455 | Slicer4 | Core: CLI infrastructure | public | 2011-09-25 18:51 | 2012-09-05 07:56 |
Reporter | fedorov | Assigned To | jcfr | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | Slicer 4.0.0 | ||||
Target Version | Slicer 4.2.0 | Fixed in Version | Slicer 4.2.0 | ||
Summary | 0001455: Launching CLI modules from command line | ||||
Description | It would be nice if CLI modules could be invoked without specifying the full path, like it was possible in Slicer3: Slicer4 --launch Module Right now it can only be done this way: Slicer4 --launch ./plugins/Module | ||||
Tags | No tags attached. | ||||
The reason I would like this functionality to be there is I would like to launch a CLI plugin from another plugin written in C++. If Slicer knows about plugin paths, I can just do system(<plugin_name>), otherwise I don't know how to find that location, assuming user does not have to set Slicer_DIR. Let me know if there is a better way to do this ... |
|||
Could you clarify what do you mean by "system(<plugin_name>)". I understood you talk about the following command: http://www.cplusplus.com/reference/clibrary/cstdlib/system/ But I am not sure to understand what do you mean by <plugin_name>. Considering the Threshold executable, does it means: 6) works Just to make sure, by an "other plugin written in C++", you mean an other CLI executable or a loadable module ? |
|||
By <plugin_name> I would like to have your option (1). My usage scheme:
|
|||
Try to change line depicted by [1] into: <APPLAUNCHER_DIR>/${Slicer_CLIMODULES_BIN_DIR}/<CMAKE_CFG_INTDIR> Note: I just noticed that SlicerINSTALL should also be changed into Slicer_ in [2] and [3] [1] https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockCTKAppLauncherSettings.cmake#L160 [2] https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockCTKAppLauncherSettings.cmake#L94 [3] https://github.com/Slicer/Slicer/blob/master/CMake/SlicerBlockCTKAppLauncherSettings.cmake#L100 |
|||
JC, did the changes as you instructed: Index: CMake/SlicerBlockCTKAppLauncherSettings.cmake--- CMake/SlicerBlockCTKAppLauncherSettings.cmake (revision 18179) if(Slicer_BUILD_CLI)
@@ -157,7 +157,7 @@ if(Slicer_BUILD_CLI)
Recompiled (make from Slicer-build). When I look in Slicer-build/SlicerLauncherSettings.ini, there is this section now: [Paths] However, the module is still not resolved: [fedorov@bear Slicer-build] ls -la lib/Slicer-4.0/cli-modules/BRAINSFit Options |
|||
1) Regarding the LIBRARY_PATHS:
Looking at this more closely ... on linux, having the "_INSTALL" qualifier doesn't change anything. 2) Your test doesn't match the use case you previously described. Indeed, the launcher doesn't search the path. The use case described assumes you run a CLI either from Slicer or using "Slicer --launch /path/to/cli" and that given CLI executable will attempt to run an other cli using "system()" 3) Using system() from within a CLI executable should work if system() search the PATH. Does system() search the PATH env ? 4) We could also provide some utility function to return the full path of a given executable by searching the PATH. This could be done in the CTK launcher itself so that "Slicer --launch <CLIExecutableName>" works. And could also be done to retrieve the path of a cli executable before your execute system("CLIExecutableName") |
|||
(1) you are right (2) you are correct again -- I took a shortcut to test this. system("CLIExecutableName") now works, my problem is resolved. Can you confirm the fix is committed to the trunk? (4) I think for the future it would be nice to have "Slicer --launch "CLIExecutableName" working, to maintain backwards compatibility with Slicer3 batch scripts for one thing. But this is not in my critical path, not urgent. Thanks a lot for the help! |
|||
fixed by JC in http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=18230 |
|||
This does not work in packaged Slicer (as tested on Mac). To reproduce: 1) load any 2 volumes into binary packaged Slicer 2) run the following from python console
Error in the log: ERROR: In /Users/fedorov/Slicer/Slicer4/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx, line 1466 sh: BRAINSDemonWarp: command not found ERROR: In /Users/fedorov/Slicer/Slicer4/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx, line 1492 Corresponding code from the DemonsSegmentationMetric that does not work: |
|||
Doesn't work in revision 18672. Fixing this would make nipype support more robust. For more details see https://github.com/nipy/nipype/pull/218#issuecomment-2706681 |
|||
from email to ChrisG Jan 11: Hi Chris, I talked to JC about this yesterday. He says for certain reasons implementing "Slicer4 --launch <module Note that some modules are loaded as dynamic libraries, so you may from Slicer python console:
So then you can put name as the last component of the path, and pass Would this solution work for you? Maybe somewhere in Nipype internally, if the user tries to call Slicer |
|||
Fixed in https://github.com/jcfr/AppLauncher/commit/a02b1a3cacdd0a40f795547c792768659161 |
|||
Fixed in https://github.com/jcfr/AppLauncher/commit/a02b1a3cacdd0a40f795547c792768659161 The next release of the Launcher will allow to run program in the PATH using: Slicer --launch foo (or Slicer --launch foo.exe) or Slicer --launch bar/foo On windows, if extension is not specified, it will be automatically appended. |
|||
JC, when is this next release of Launcher going to be integrated with Slicer? |
|||
Fixed in r20684 |
|||
Trying to launch CastScalarVolume (which exists): [fedorov@gridftp-spl Slicer-build]$ ls lib/Slicer-4.1/cli-modules | grep CastScalarVolume directly by "--launch CastScalarVolume" there's error "Application does NOT exists [CastScalarVolume]": [fedorov@gridftp-spl Slicer-build]$ ./Slicer --launch CastScalarVolume --help Options Options If I --launch with the full path, it works: [fedorov@gridftp-spl Slicer-build]$ ./Slicer --launch ./lib/Slicer-4.1/cli-modules/CastScalarVolume --help Options Options USAGE: ./lib/Slicer-4.1/cli-modules/CastScalarVolume [--returnparameterfile Where: --returnparameterfile <std::string> --processinformationaddress <std::string> --xml --echo -t <Char|UnsignedChar|Short|UnsignedShort|Int|UnsignedInt|Float|Double>, --, --ignore_rest |
|||
The problem is understood and captured in the following CTKAppLauncher issue: https://github.com/commontk/AppLauncher/issues/31 |
|||
Solution in the work: https://github.com/jcfr/AppLauncher/commit/fadfd458952aaeffa07834ee61cdd661e3fd90d3 Still need to fix on issue preventing the added test from passing on windows. |
|||
New launcher released (0.1.8), fixed in r20925 |
|||
I confirmed the issues is resolved on all platforms. A related issue is that there is no console output on Windows. |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2011-09-25 18:51 | fedorov | New Issue | |
2011-09-25 18:53 | finetjul | Status | new => assigned |
2011-09-25 18:53 | finetjul | Assigned To | => jcfr |
2011-09-26 13:38 | fedorov | Note Added: 0003119 | |
2011-09-28 14:34 | jcfr | Note Added: 0003131 | |
2011-09-28 14:39 | fedorov | Note Added: 0003132 | |
2011-09-28 14:49 | jcfr | Note Added: 0003133 | |
2011-09-28 15:32 | fedorov | Note Added: 0003134 | |
2011-09-28 16:18 | jcfr | Note Added: 0003135 | |
2011-09-28 16:40 | fedorov | Note Added: 0003136 | |
2011-09-30 17:54 | fedorov | Note Added: 0003152 | |
2011-09-30 17:54 | fedorov | Status | assigned => closed |
2011-09-30 17:54 | fedorov | Resolution | open => fixed |
2011-11-10 13:18 | fedorov | Note Added: 0003303 | |
2011-11-10 13:18 | fedorov | Status | closed => feedback |
2011-11-10 13:18 | fedorov | Resolution | fixed => reopened |
2011-11-11 05:24 | ChrisG | Note Added: 0003306 | |
2012-02-25 07:55 | fedorov | Note Added: 0003726 | |
2012-04-25 17:38 | jcfr | Note Added: 0004080 | |
2012-04-26 13:17 | jcfr | Status | feedback => assigned |
2012-07-17 21:03 | jcfr | Note Added: 0005184 | |
2012-07-17 21:03 | jcfr | Note Added: 0005185 | |
2012-07-17 21:05 | jcfr | Note Edited: 0005185 | |
2012-07-21 16:27 | fedorov | Note Added: 0005213 | |
2012-07-24 19:35 | jcfr | Target Version | => Slicer 4.2.0 - October 1st 2012 |
2012-07-24 19:36 | jcfr | Note Added: 0005229 | |
2012-07-24 19:36 | jcfr | Status | assigned => resolved |
2012-07-24 19:36 | jcfr | Fixed in Version | => Slicer 4.2.0 - October 1st 2012 |
2012-07-24 19:36 | jcfr | Resolution | reopened => fixed |
2012-07-25 05:12 | fedorov | Note Added: 0005232 | |
2012-07-25 05:12 | fedorov | Status | resolved => feedback |
2012-07-25 05:12 | fedorov | Resolution | fixed => reopened |
2012-07-27 15:16 | jcfr | Note Added: 0005289 | |
2012-07-27 15:16 | jcfr | Status | feedback => assigned |
2012-09-04 10:13 | jcfr | Note Added: 0005950 | |
2012-09-04 13:53 | jcfr | Note Added: 0005963 | |
2012-09-04 13:53 | jcfr | Status | assigned => resolved |
2012-09-04 13:53 | jcfr | Resolution | reopened => fixed |
2012-09-05 07:56 | fedorov | Note Added: 0005972 | |
2012-09-05 07:56 | fedorov | Status | resolved => closed |