SimpleITK
2.0.0
|
Display an image in an external viewer (Fiji by default) More...
#include <sitkImageViewer.h>
Public Member Functions | |
void | Execute (const Image &image) |
Launch the viewing application to display the given image. More... | |
const std::string & | 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 std::string &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< std::string > &path) |
Set/Get the search path used to find the viewing application. More... | |
static const std::vector< std::string > & | GetGlobalDefaultSearchPath () |
Set/Get the search path used to find the viewing application. More... | |
static void | SetGlobalDefaultExecutableNames (const std::vector< std::string > &names) |
Set/Get name list used to find the viewing application. More... | |
static const std::vector< std::string > & | 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 std::string &app) |
Set/Get the default application used in the command string. More... | |
static const std::string & | 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... | |
Static Private Member Functions | |
static std::string | FindViewingApplication () |
static void | initializeDefaults () |
Private Attributes | |
std::string | m_Application |
std::string | m_CustomCommand |
std::string | m_FileExtension |
std::string | m_Title |
std::string | m_ViewCommand |
Static Private Attributes | |
static bool | m_GlobalAreDefaultsInitialized |
static std::string | m_GlobalDefaultApplication |
static bool | m_GlobalDefaultDebug |
static std::vector< std::string > | m_GlobalDefaultExecutableNames |
static std::string | m_GlobalDefaultFileExtension |
static std::vector< std::string > | m_GlobalDefaultSearchPath |
static std::string | m_GlobalDefaultViewCommand |
static unsigned int | m_GlobalProcessDelay |
static int | m_GlobalViewerImageCount |
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 ( https://fiji.sc ) 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 52 of file sitkImageViewer.h.
itk::simple::ImageViewer::ImageViewer | ( | ) |
void itk::simple::ImageViewer::Execute | ( | const Image & | image | ) |
Launch the viewing application to display the given image.
|
staticprivate |
const std::string& 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.
|
staticprivate |
void itk::simple::ImageViewer::SetApplication | ( | const std::string & | app, |
const std::string & | command = "%a %f" |
||
) |
Set the full path to the viewing application used in the command string.
The SetApplication method expects a full path name.
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 223 of file sitkImageViewer.h.
|
private |
Definition at line 221 of file sitkImageViewer.h.
|
private |
Definition at line 225 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 206 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 215 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 218 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 210 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 214 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 209 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 213 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 211 of file sitkImageViewer.h.
|
staticprivate |
Definition at line 205 of file sitkImageViewer.h.
|
private |
Definition at line 227 of file sitkImageViewer.h.
|
private |
Definition at line 220 of file sitkImageViewer.h.