SMILX  1.01
Public Types | Public Slots | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
milxQtDICOMPlugin Class Reference

The interface for the DICOM plugin for milxQt. More...

#include <milxQtDICOMPlugin.h>

Inheritance diagram for milxQtDICOMPlugin:
milxQtPluginInterface milxQtPluginInterface milxQtPluginInterface

Public Types

typedef itk::GDCMImageIO ImageIOType
 
typedef itk::MetaDataDictionary DictionaryType
 
typedef itk::MetaDataObject< std::string > MetaDataStringType
 

Public Slots

virtual void loadExtension ()
 Load the extension. [Implement this in your plugin].
 
virtual void update ()
 Update the plugin. [Implement this in your plugin]. More...
 
virtual void preStartTasks ()
 Tasks to complete before running or starting the thread. [Implement this].
 
virtual void postStartTasks ()
 Tasks to complete after running or starting the thread. [Implement this].
 
void viewTags ()
 View DICOM tags of image series in the manager. More...
 
void openSeries ()
 Open DICOM image series. More...
 
void openStructureSet ()
 Open DICOM RT image series. More...
 
void convert ()
 Convert a DICOM series (or a path to a number of series) to Nifti (*.nii.gz) images. More...
 
void anonymize ()
 
void showRSFileDialog ()
 
void showInputFileDialog ()
 
void showRTInputFileDialog ()
 
void showOutputFileDialog ()
 
void showRTOutputFileDialog ()
 
void showInputFileDialogAnonymize ()
 
void showOutputFileDialogAnonymize ()
 
void affectValues ()
 Function called when the wizard for anonymization is validated It will verify that everything is in order and set a boolean value to true if yes.
 
bool anonymizeDicomImage (const std::string &input, const QString &subject_output_folder, const QString &rel_dir, unsigned int index_subject, unsigned int index_dicom, bool &isFirst)
 Function used to anonymize a single dicom image. More...
 
void makeFilename (const QString &path, ImageIOType::Pointer gdcmImageIO, unsigned int index, std::string &filename, unsigned int index_subject)
 Small helper to make filename from dicom tags. More...
 
void removeForbiddenChar (std::string &str, char *charsToRemove)
 
void writeLog (QString &filename, std::string &output)
 
void getTagValue (ImageIOType::Pointer gdcmImageIO, const std::string &tag, std::string &tag_value)
 Retrieve tag value fromt he gdcmImageIO object. More...
 
virtual void loadExtension ()
 
virtual void update ()
 
virtual void preStartTasks ()
 
virtual void postStartTasks ()
 
void convert ()
 
void anonymize ()
 
virtual void loadExtension ()
 
virtual void update ()
 
virtual void preStartTasks ()
 
virtual void postStartTasks ()
 
void convert ()
 
void anonymize ()
 
void showInputFileDialog ()
 
void showOutputFileDialog ()
 
- Public Slots inherited from milxQtPluginInterface
virtual void loadExtension ()=0
 Load the extension. [Implement this in your plugin].
 
virtual void update ()=0
 Update the plugin. [Implement this in your plugin]. More...
 
virtual void preStartTasks ()=0
 Tasks to complete before running or starting the thread. [Implement this].
 
virtual void postStartTasks ()=0
 Tasks to complete after running or starting the thread. [Implement this].
 

Public Member Functions

 milxQtDICOMPlugin (QObject *theParent=0)
 Default destructor. More...
 
virtual QString name ()
 Get the Name of the plugin. [Implement this in your plugin].
 
virtual bool hasOpenSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString openFileSupport ()
 Get the file support string for opening (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList openExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasSaveSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString saveFileSupport ()
 Get the file support string for saving (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList saveExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasCollectionSupport ()
 Does the plugin support collections (PolyData collection etc.). [Implement this in your plugin].
 
virtual void SetInputCollection (vtkPolyDataCollection *collection, QStringList &filenames)
 Pass a collection to internal plugin class. [Implement this in your plugin].
 
virtual void open (QString filename)
 Open the file using the plugin. [Implement this in your plugin].
 
virtual void save (QString filename)
 Save the result as a file using the plugin. [Implement this in your plugin].
 
virtual milxQtRenderWindowgenericResult ()
 Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtModelmodelResult ()
 Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtImageimageResult ()
 Get the image result. The result can then be displayed in milxQtMain etc.[Implement this in your plugin].
 
virtual QDockWidget * dockWidget ()
 Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
 
virtual Qt::DockWidgetArea dockDefaultArea ()
 Return the default dock widget area (if one is provided by plugin). [Implement this in your plugin].
 
virtual bool isPluginWindow (QWidget *window)
 Is the window provided a plugin generated window? In this case a milxQtShapeModel window. [Implement this in your plugin].
 
 milxQtDICOMPlugin (QObject *theParent=0)
 
virtual QString name ()
 Get the Name of the plugin. [Implement this in your plugin].
 
virtual bool hasOpenSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString openFileSupport ()
 Get the file support string for opening (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList openExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasSaveSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString saveFileSupport ()
 Get the file support string for saving (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList saveExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasCollectionSupport ()
 Does the plugin support collections (PolyData collection etc.). [Implement this in your plugin].
 
virtual void SetInputCollection (vtkPolyDataCollection *collection, QStringList &filenames)
 Pass a collection to internal plugin class. [Implement this in your plugin].
 
virtual void open (QString filename)
 Open the file using the plugin. [Implement this in your plugin].
 
virtual void save (QString filename)
 Save the result as a file using the plugin. [Implement this in your plugin].
 
virtual milxQtRenderWindowgenericResult ()
 Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtModelmodelResult ()
 Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtImageimageResult ()
 Get the image result. The result can then be displayed in milxQtMain etc.[Implement this in your plugin].
 
virtual QDockWidget * dockWidget ()
 Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
 
virtual Qt::DockWidgetArea dockDefaultArea ()
 Return the default dock widget area (if one is provided by plugin). [Implement this in your plugin].
 
virtual bool isPluginWindow (QWidget *window)
 Is the window provided a plugin generated window? In this case a milxQtShapeModel window. [Implement this in your plugin].
 
 milxQtDICOMPlugin (QObject *theParent=0)
 
virtual QString name ()
 Get the Name of the plugin. [Implement this in your plugin].
 
virtual bool hasOpenSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString openFileSupport ()
 Get the file support string for opening (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList openExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasSaveSupport ()
 Does the plugin support opening files? [Implement this in your plugin].
 
virtual QString saveFileSupport ()
 Get the file support string for saving (extension wildcard list). [Implement this in your plugin].
 
virtual QStringList saveExtensions ()
 Get a list of supported file format extensions. [Implement this in your plugin].
 
virtual bool hasCollectionSupport ()
 Does the plugin support collections (PolyData collection etc.). [Implement this in your plugin].
 
virtual void SetInputCollection (vtkPolyDataCollection *collection, QStringList &filenames)
 Pass a collection to internal plugin class. [Implement this in your plugin].
 
virtual void open (QString filename)
 Open the file using the plugin. [Implement this in your plugin].
 
virtual void save (QString filename)
 Save the result as a file using the plugin. [Implement this in your plugin].
 
virtual milxQtRenderWindowgenericResult ()
 Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtModelmodelResult ()
 Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plugin].
 
virtual milxQtImageimageResult ()
 Get the image result. The result can then be displayed in milxQtMain etc.[Implement this in your plugin].
 
virtual QDockWidget * dockWidget ()
 Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
 
virtual Qt::DockWidgetArea dockDefaultArea ()
 Return the default dock widget area (if one is provided by plugin). [Implement this in your plugin].
 
virtual bool isPluginWindow (QWidget *window)
 Is the window provided a plugin generated window? In this case a milxQtShapeModel window. [Implement this in your plugin].
 
- Public Member Functions inherited from milxQtPluginInterface
 milxQtPluginInterface (QObject *theParent=0)
 Default destructor.
 
void setFileName (const QString filename)
 Set the Name of the data. [Don't Reimplement this]. More...
 
void setConsole (milxQtConsole *con)
 Set console to be used by plugins for output. More...
 
bool isThreaded ()
 Is the plugin threaded? [Don't Reimplement this].
 
bool isDockable ()
 Is the plugin a dock window? [Don't Reimplement this].
 
bool isConsole ()
 Is the plugin a console dock window? If so, it will be added to the console dock window. [Don't Reimplement this].
 
bool isExtension ()
 Is the plugin an extension? [Don't Reimplement this].
 
QList< QAction * > addToFileMenu ()
 Actions to add to the file or context menu. [Don't Reimplement this].
 
QList< QMenu * > addToMenuBar ()
 Menus to add to the menu bar. [Don't Reimplement this].
 

Protected Member Functions

void createActions ()
 
void createMenu ()
 
void createWizard ()
 
void createRTWizard ()
 
void createConnections ()
 
void createWizardAnonymise ()
 
void createActions ()
 
void createMenu ()
 
void createConnections ()
 
void createActions ()
 
void createMenu ()
 
void createWizard ()
 
void createConnections ()
 

Static Protected Member Functions

static void trim (std::string &str)
 
template<class TImage >
static void resetImage (typename itk::SmartPointer< TImage > imageSlice)
 
template<class TImage , class TSliceType >
static void mergeImages (typename itk::SmartPointer< TSliceType > tempSlice, typename itk::SmartPointer< TImage > finalImage, int iRequiredSlice)
 

Protected Attributes

QPointer< milxQtMainMainWindow
 
QMenu * menuDICOM
 DICOM menu.
 
QAction * actionOpenSeries
 open series action
 
QAction * actionTags
 open series action
 
QAction * actionConvertStructure
 convert RT action
 
QAction * actionConvert
 convert action
 
QAction * actionAnonymize
 Anonymize action.
 
QWizard wizard
 
QWizard wizardRT
 
QWizard wizardAnonymize
 
QString inputDirectoryname
 
QLineEdit * txtInputName
 
QString outputDirectoryname
 
QLineEdit * txtOutputName
 
QString inputRTDirectoryname
 
QLineEdit * txtRTInputName
 
QString outputRTDirectoryname
 
QLineEdit * txtRTOutputName
 
QString rsFilename
 
QLineEdit * txtRSName
 
QString inputAnonymizeDirectoryname
 
QLineEdit * txtInputAnonymizeName
 
QString outputAnonymizeDirectoryname
 
QLineEdit * txtOutputAnonymizeName
 
QString outputPrefix
 
QLineEdit * txtOutputPrefix
 
int outputInitID
 
QLineEdit * txtOutputInitID
 
QCheckBox * checkboxPreserveFolderArc
 
QCheckBox * checkboxPatientName
 
QCheckBox * checkboxPatientID
 
QCheckBox * checkboxSeriesDate
 
QCheckBox * checkboxSeriesTime
 
QCheckBox * checkboxStudyID
 
QCheckBox * checkboxStudyDesc
 
QCheckBox * checkboxSeriesNumber
 
QCheckBox * checkboxSequenceName
 
QCheckBox * checkboxProtocolName
 
QCheckBox * checkboxSeriesDescription
 
QCheckBox * anonPatientInfo
 
QCheckBox * anonPhysician
 
QCheckBox * anonOperator
 
QCheckBox * anonScanDate
 
milxQtImageimage
 
QPointer< milxQtManagermanager
 Manager widget.
 
QPointer< QDockWidget > dock
 Dock widget.
 
bool valid
 
- Protected Attributes inherited from milxQtPluginInterface
QString pluginName
 
QString dataName
 
bool threaded
 Threaded plugin?
 
bool dockable
 Dockable plugin?
 
bool consoleWindow
 console window?
 
bool extension
 Extension rather than a plugin?
 
QMutex mutex
 
QList< QAction * > fileMenuEntries
 
QList< QMenu * > menuToAdd
 
milxQtConsoleconsole
 console for logging
 

Additional Inherited Members

- Signals inherited from milxQtPluginInterface
void resultAvailable (milxQtRenderWindow *)
 Send signal that Resultant render window is available for showing.
 
void resultAvailable (milxQtModel *)
 Send signal that Resultant model is available for showing.
 
void resultAvailable (milxQtImage *)
 Send signal that Resultant image is available for showing.
 
void resultAvailable (vtkPolyDataCollection *, QStringList &)
 Send signal that Resultant collection is available for showing.
 
void working (int value)
 Send signal that computation is in progress. Value carries the progress,.
 
void done (int value)
 Send signal that computation is done. Value carries the progress,.
 

Detailed Description

The interface for the DICOM plugin for milxQt.

Author

Definition at line 54 of file milxQtDICOMPlugin.h.

Constructor & Destructor Documentation

◆ milxQtDICOMPlugin()

milxQtDICOMPlugin::milxQtDICOMPlugin ( QObject *  theParent = 0)

Default destructor.

Up cast parent to milxQtMain

Definition at line 39 of file milxQtDICOMPlugin.cpp.

Member Function Documentation

◆ anonymize

void milxQtDICOMPlugin::anonymize ( )
slot

Open each series and save

Loop over all the subjects

Retrieve the dicom series

If there are dicom series for the subject Create the subject's output folder

Create the subject's output folder

Loop over the dicom series

Loop over the dicom files and anonymize them

Need to retrieve path relative to subject (in case keep folder architecture)

Anonymize

Definition at line 611 of file milxQtDICOMPlugin.cpp.

◆ anonymizeDicomImage

milxQtDICOMPlugin::anonymizeDicomImage ( const std::string &  input,
const QString &  subject_output_folder,
const QString &  rel_dir,
unsigned int  index_subject,
unsigned int  index_dicom,
bool &  isFirst 
)
slot

Function used to anonymize a single dicom image.

Parameters
inputthe input image
subject_output_folderthe output folder for the subject
rel_dirthe relative path from the of the subject and the initial dicom
index_subjectthe subject id
index_dicomthe id of the current dicom
isFirstis it the first dicom anonymize for the subject?
Returns
true if successfully anonymized

Create the anonymization string - This is the folder of the subject

Create 2 readers –> need two in case of T2 maps

TODO: Again this should be retrieved from the DICOM

First the image need to be read with a random type to able to read the dicom tags

and checkthe image type for saving later one

Write the mapping of the subject's real name to his identifier

Here retrieve real name

And write

If it is a T2 map need change image type / and re-read (unfortunate)

This should be read from the function rather than dicom tags but works as well

List of DICOM tags to strip

Create output directory

Write some debug on the type of images

Change dicom header and re-write file

Definition at line 1232 of file milxQtDICOMPlugin.cpp.

◆ convert

void milxQtDICOMPlugin::convert ( )
slot

Convert a DICOM series (or a path to a number of series) to Nifti (*.nii.gz) images.

The function assumes either the path provided in the wizard is a path containing a DICOM series or that the path provided contains a number of directories each having a DICOM series.

Open each series and save See milxQtFile::openImageSeries() for more relevant code Get UIDs and filenames

Check if input path is a directory of series or just a series

Open each image

Create the subject's output folder

Todo:
handle 4D images here properly

Definition at line 404 of file milxQtDICOMPlugin.cpp.

◆ createWizardAnonymise()

void milxQtDICOMPlugin::createWizardAnonymise ( )
protected

Intro

Page for intput directory (existence will be checked at the end)

Page for output directory (existence will be checked at the end)

Page for choosing prefix (eg. anon)

Page for choosing initial ID (will then increment per subject)

Page for choosing options for anonymization / filenames / folder arch

Definition at line 1034 of file milxQtDICOMPlugin.cpp.

◆ getTagValue

milxQtDICOMPlugin::getTagValue ( ImageIOType::Pointer  gdcmImageIO,
const std::string &  tag,
std::string &  tag_value 
)
slot

Retrieve tag value fromt he gdcmImageIO object.

Parameters
gdcmImageIOthe dicom object
tagthe dicom tag
tag_valuethe tag value

Definition at line 1623 of file milxQtDICOMPlugin.cpp.

◆ makeFilename

milxQtDICOMPlugin::makeFilename ( const QString &  path,
ImageIOType::Pointer  gdcmImageIO,
unsigned int  index,
std::string &  filename,
unsigned int  index_subject 
)
slot

Small helper to make filename from dicom tags.

Small helper to remove unwanted characters under windows.

Parameters
pathoutput directory
gdcmImageIOthe dicom object
indexthe dicom index
indexthe dicom index
filenamereference to the filename
stdstring to strip
charsToRemoveunwanted characters

Definition at line 1492 of file milxQtDICOMPlugin.cpp.

◆ openSeries

milxQtDICOMPlugin::openSeries ( )
slot

Open DICOM image series.

If filenames list is empty ask for them

Get UIDs

Update case list in manager

< Case Browser

< Case Browser

Definition at line 283 of file milxQtDICOMPlugin.cpp.

◆ openStructureSet

milxQtDICOMPlugin::openStructureSet ( )
slot

Open DICOM RT image series.

Get UIDs and filenames

Export Structures

Definition at line 356 of file milxQtDICOMPlugin.cpp.

◆ showRSFileDialog

void milxQtDICOMPlugin::showRSFileDialog ( )
slot

<

Todo:
Check and validate extensions support at Open in Main class

Definition at line 742 of file milxQtDICOMPlugin.cpp.

◆ update

milxQtDICOMPlugin::update ( )
inlinevirtualslot

Update the plugin. [Implement this in your plugin].

This generic call is called after plugin is loaded and is designed to be used to update the plugin internals such as manager displays etc.

Definition at line 192 of file milxQtDICOMPlugin.h.

◆ viewTags

milxQtDICOMPlugin::viewTags ( )
slot

View DICOM tags of image series in the manager.

If filenames list is empty ask for them

Get UIDs

Check if input path is a directory of series or just a series

Update case list in manager

< Case Browser

< Case Browser

Definition at line 188 of file milxQtDICOMPlugin.cpp.


The documentation for this class was generated from the following files: