Input and output volumes are stored in temporary directory, and i need to transform an input volume into MetaImage format for further processing in plastimatch. How setup correctly the mha file name (without parsing the input volume file name), so it will be saved into the Slicer temporary directory?
In loadable module it’s simple:
QString tmpDirName = qSlicerCoreApplication::application()->temporaryPath();
Does a CLI module have anything like that?
The idea of a CLI is that it can be a stand-alone executable that can run as a process external to Slicer but pass info back and forth by our conventions. But the CLI itself can really be anything. In the past we have had CLIs that link with their own version of Qt and bring up a GUI. So you could also link with QtCore to get the tempdir, or find another cross-platform way for that.
In CLI it is much simpler, since the caller (typically Slicer) passes all input and output filenames as command-line arguments, so your CLI does not have to generate any filenames.