SimpleITK
|
Display an image in an external viewer (Fiji by default) More...
#include <sitkImageViewer.h>
Display an image in an external viewer (Fiji by default)
The ImageViewer class displays an image with an external image display application. By default the class will search for a Fiji executable. The image is written out to a temporary file and then passed to the application.
When the first ImageViewer object is constructed the following environment variables are queried to set up the external viewer:
SITK_SHOW_EXTENSION: file format extension of the temporary image file. The default is '.mha', the MetaIO file format.
SITK_SHOW_COMMAND: The user can specify an application other than Fiji to view images.
The environment variables are not checked for subsequent ImageViewer objects.
Definition at line 51 of file sitkImageViewer.h.
Public Member Functions | |
void | Execute (const Image &image) |
Launch the viewing application to display the given image. More... | |
const PathType & | GetApplication () const |
Get the full path to the viewing application used in the command string. More... | |
const std::string & | GetCommand () const |
virtual std::string | GetName () const |
ImageViewer () | |
void | SetApplication (const PathType &app, const std::string &command="%a %f") |
Set the full path to the viewing application used in the command string. More... | |
void | SetCommand (const std::string &command) |
Set the command string used to launch the viewing application. More... | |
std::string | ToString () const |
Print ourself out to a string. More... | |
void | SetFileExtension (const std::string &ext) |
Set/Get file extension of the temporary image file (default='.nii') More... | |
const std::string & | GetFileExtension () const |
Set/Get file extension of the temporary image file (default='.nii') More... | |
void | SetTitle (const std::string &t) |
Set/Get Title string on the ImageJ window. More... | |
const std::string & | GetTitle () const |
Set/Get Title string on the ImageJ window. More... | |
Static Public Member Functions | |
static void | SetGlobalDefaultSearchPath (const std::vector< PathType > &path) |
Set/Get the search path used to find the viewing application. More... | |
static const std::vector< PathType > & | GetGlobalDefaultSearchPath () |
Set/Get the search path used to find the viewing application. More... | |
static void | SetGlobalDefaultExecutableNames (const std::vector< PathType > &names) |
Set/Get name list used to find the viewing application. More... | |
static const std::vector< PathType > & | GetGlobalDefaultExecutableNames () |
Set/Get name list used to find the viewing application. More... | |
static void | SetGlobalDefaultFileExtension (const std::string &ext) |
Set/Get the default file extension. More... | |
static const std::string & | GetGlobalDefaultFileExtension () |
Set/Get the default file extension. More... | |
static void | SetGlobalDefaultApplication (const PathType &app) |
Set/Get the default application used in the command string. More... | |
static const PathType & | GetGlobalDefaultApplication () |
Set/Get the default application used in the command string. More... | |
static void | SetGlobalDefaultDebug (const bool dbg) |
Set/Get Debug flag. More... | |
static bool | GetGlobalDefaultDebug () |
Set/Get Debug flag. More... | |
static void | SetGlobalDefaultDebugOn () |
Set/Get Debug flag. More... | |
static void | SetGlobalDefaultDebugOff () |
Set/Get Debug flag. More... | |
static void | SetProcessDelay (const unsigned int delay) |
Set/Get Process delay, the wait time after launching the viewing application. More... | |
static unsigned int | GetProcessDelay () |
Set/Get Process delay, the wait time after launching the viewing application. More... | |
Private Attributes | |
PathType | m_Application |
std::string | m_CustomCommand |
std::string | m_FileExtension |
std::string | m_Title |
std::string | m_ViewCommand |
itk::simple::ImageViewer::ImageViewer | ( | ) |
void itk::simple::ImageViewer::Execute | ( | const Image & | image | ) |
Launch the viewing application to display the given image.
const PathType& itk::simple::ImageViewer::GetApplication | ( | ) | const |
Get the full path to the viewing application used in the command string.
const std::string& itk::simple::ImageViewer::GetCommand | ( | ) | const |
const std::string& itk::simple::ImageViewer::GetFileExtension | ( | ) | const |
Set/Get file extension of the temporary image file (default='.nii')
If the viewing application is Fiji, the default image format is MetaIO, '.mha'.
If the viewing application is ImageJ, the default image format is NifTi, '.nii'. This is because by default ImageJ does not come with the MetaIO plugin.
|
static |
Set/Get the default application used in the command string.
|
static |
Set/Get Debug flag.
Turning on/off the Debug flag produces output showing the command string used to launch the viewing application.
|
static |
Set/Get name list used to find the viewing application.
|
static |
Set/Get the default file extension.
The file extension determines the image file type used when writing out the temporary image file.
|
static |
Set/Get the search path used to find the viewing application.
|
inlinevirtual |
Return the user readable name of the class
Definition at line 59 of file sitkImageViewer.h.
|
static |
Set/Get Process delay, the wait time after launching the viewing application.
On Windows the delay is in seconds, default=1sec. On Mac/Linux the delay is in milli-seconds, default=500ms.
const std::string& itk::simple::ImageViewer::GetTitle | ( | ) | const |
Set/Get Title string on the ImageJ window.
void itk::simple::ImageViewer::SetApplication | ( | const PathType & | app, |
const std::string & | command = "%a %f" |
||
) |
Set the full path to the viewing application used in the command string.
The SetApplication method expects the app parameter to be a full path name to the display application's executable. For instance, on Windows when using Fiji, one would use the full path to the ImageJ-win64.exe such as:
'C:\Users\dave\Fiji.app\ImageJ-win64.exe'
On Linux, app would be set to something like:
'/home/dave/bin/Fiji.app/ImageJ-linux64'
Using this method overrides the default application search.
By default, when this method is called, the command string is set to "%a %f"
which simply means the application path followed by the temporary image file.
void itk::simple::ImageViewer::SetCommand | ( | const std::string & | command | ) |
Set the command string used to launch the viewing application.
This command string may include the following tokens:
'a'
for the image viewing application (Fiji by default) 'f'
for SimpleITK's temporary image fileFor example, the default command string on Linux systems is:
After token substitution it may become:
For another example, the default command string on Mac OS X is:
After token substitution the string may become:
The string after '-eval'
is an ImageJ macro the opens the file and sets the title of the window.
If the 'f'
token is not found in the command string, the temporary file name is automatically appended to the command argument list.
Note: Using the ImageViewer::SetCommand method overrides the default command and/or the SITK_SHOW_COMMAND environment variable.
void itk::simple::ImageViewer::SetFileExtension | ( | const std::string & | ext | ) |
Set/Get file extension of the temporary image file (default='.nii')
If the viewing application is Fiji, the default image format is MetaIO, '.mha'.
If the viewing application is ImageJ, the default image format is NifTi, '.nii'. This is because by default ImageJ does not come with the MetaIO plugin.
|
static |
Set/Get the default application used in the command string.
|
static |
Set/Get Debug flag.
Turning on/off the Debug flag produces output showing the command string used to launch the viewing application.
|
static |
Set/Get Debug flag.
Turning on/off the Debug flag produces output showing the command string used to launch the viewing application.
|
static |
Set/Get Debug flag.
Turning on/off the Debug flag produces output showing the command string used to launch the viewing application.
|
static |
Set/Get name list used to find the viewing application.
|
static |
Set/Get the default file extension.
The file extension determines the image file type used when writing out the temporary image file.
|
static |
Set/Get the search path used to find the viewing application.
|
static |
Set/Get Process delay, the wait time after launching the viewing application.
On Windows the delay is in seconds, default=1sec. On Mac/Linux the delay is in milli-seconds, default=500ms.
void itk::simple::ImageViewer::SetTitle | ( | const std::string & | t | ) |
Set/Get Title string on the ImageJ window.
std::string itk::simple::ImageViewer::ToString | ( | ) | const |
Print ourself out to a string.
|
private |
Definition at line 242 of file sitkImageViewer.h.
|
private |
Definition at line 240 of file sitkImageViewer.h.
|
private |
Definition at line 244 of file sitkImageViewer.h.
|
private |
Definition at line 246 of file sitkImageViewer.h.
|
private |
Definition at line 239 of file sitkImageViewer.h.