VivoQuant 6.3.0
Loading...
Searching...
No Matches
PreProcessing Class Reference

Dialog and controller for configuring and running data pre-processing steps. More...

#include <PreProcessing.h>

Public Slots

void accept ()
 Runs execute() and, if it reports a problem, surfaces the resulting message to the user via a message box.
 
void bedRemovalState (Qt::CheckState state)
 Updates the bed removal UI (label text and enabled state of the transform/bed selectors) to reflect the current cbBedRemoval tri-state check state: Checked = classic bed removal, Partially Checked = advanced bed removal, Unchecked = no bed removal.
 

Public Member Functions

void storeSettings ()
 Save current Preprocessing settings into the VQ settings.
 
void loadSettings ()
 Load current VQ settings for Preprocessing.
 
string settingsToString ()
 Dump current Preprocessing settings to a string.
 
void stringToSettings (string params)
 Apply Preprocessing settings (| - delimited and defined with key=value) to the Preprocessing settings.
 
void setProtocol (string protocol)
 Set values in the PreProcessing Tool based on the provided protocol string.
 
string execute (string protocol=string())
 Set values in the PreProcessing Tool based on the provided protocol string and execute the pre-processing based on these settings.
 
void setComment (string comment)
 Add a comment to the series description of all loaded data. Each image should be marked as updated and will get a DICOM derivation entry on save.
 
void setConvertUnit (string convertUnit)
 Set the target unit for image unit conversions, for example Ci, MBq, SUV, etc. Accepts either the current canonical spelling (e.g. "g/ml") or a recognized legacy alias (e.g. "SUV"); the corresponding unit-type category (Counts, Concentration, Percent, Per Weight/Mass, or SUV) is derived automatically – callers do not need to know about or set the unit-type category separately.
 
string getConvertUnit ()
 Get the current unit images will be converted to.
 
string getConvertUnitType ()
 Get the current unit-type category (Counts, Concentration, Percent, Per Weight/Mass, or SUV) associated with getConvertUnit(). This reflects the category cbUnitType is currently set to; it is derived automatically by setConvertUnit() and does not need to be set independently.
 
string convertUnit (string &outUnit)
 Convert an image's units to another's.
 
string createQCImages (AbstractDicomRepository *rep)
 Generate Quality Control images with the preprocessing tool.
 
void setUptakeParameter (string source, string parameter, Array< string > info, Index idx=Index())
 Change the value of a parameter used for decay correction.
 
void setPreferredUptakeSource (string source, Index idx=Index())
 Change the preferred source to check for decay correction parameters.
 
void setUptakeSourceOrder (Array< string > sourceList, Index idx=Index())
 Change the order in which to check sources for decay correction parameters.
 
void setInjectedDoseValue (string doseValue)
 Set the injected dose value.
 
void setInjectedDoseUnit (string doseUnit)
 Set the injected dose unit.
 
string getImgInjectedDoseValue (Index idx=Index())
 Get the injected dose for a given image's DICOM header.
 
string getImgInjectedDoseUnit (Index idx=Index())
 Get the injected dose for a given image's DICOM header.
 
string getInjectedDoseValue ()
 Get the current injected dose value setting in the preprocessor.
 
string getInjectedDoseUnit ()
 Get the current injected dose unit setting in the preprocessor.
 
void setWeightValue (string weightValue)
 Set the value of the weight value setting in the preprocessor.
 
void setWeightUnit (string weightUnit)
 Set the unit of the weight unit setting in the preprocessor.
 
string getImgWeightValue (Index idx=Index())
 Get the weight value of a loaded image.
 
string getImgWeightUnit (Index idx=Index())
 Get the weight unit of a loaded image.
 
string getWeightValue ()
 Get the current weight value.
 
string getWeightUnit ()
 Get the current weight unit.
 
void updateUptakeParameters ()
 Update uptake information. Should be called after calls to PreProcessing::setUptakeParameter()
 
void setStoreRepository (AbstractDicomRepository *rep)
 Sets the DICOM repository for storage of QC images.
 
bool isValidQCFilename (string filename)
 Checks whether or not the provided filename can be used for saving Quality Control image files.
 
string parseQCFilename (string filename)
 Scans a filename format string and replaces special characters with header key names.
 
string parseQCFilename (ImageData *image, string filename)
 Scans a filename format string and replaces special characters with header values from an image.
 

Static Public Attributes

static Array< string > s_suvModalities
 Modalities eligible for unit conversion (activity/concentration/ ID/SUV, etc.) via convertUnit(), and for automatic weight/dose lookup via UptakeParams. Currently "PT" and "NM"; note that DICOM SUV Type (0054,1006) is a PET-specific concept, so downstream consumers should not assume "NM" images tagged with an SUV-family unit carry the same quantitative calibration guarantees as "PT".
 

Detailed Description

Dialog and controller for configuring and running data pre-processing steps.

PreProcessing coordinates a set of optional, independently toggleable operations that are applied to the data currently loaded in the DataManager, in the following order:

  1. Bed removal (classic or advanced, via CTBedRemoval / AdvancedBedRemovalDialog)
  2. Co-registration of secondary datasets to the first loaded dataset (RegistrationTools)
  3. Auto-cropping (via the active QSliceViewer's CroppingOperator)
  4. Per-modality calibration factor application
  5. Isotropic resampling to a target voxel size (ReorientationOperator)
  6. Unit conversion (e.g. counts, concentration, ID, ID/g, SUV), which may require injected dose and/or patient weight to be supplied or derived from DICOM headers
  7. Series description comment tagging
  8. Quality Control snapshot image generation and storage to a DICOM repository

Settings for each step are persisted to and restored from QSettings under the "Analysis" group (storeSettings() / loadSettings()), and can also be serialized to/from a compact pipe-delimited "protocol" string (settingsToString() / stringToSettings()) so that a full configuration can be captured, shared, or replayed via setProtocol().

Dose and weight values used for unit conversion can be sourced automatically from the loaded image's DICOM header (including decay-corrected dose and lean-body-mass-corrected weight), overridden manually, or restored from previously stored settings; see updateInjectedDose(), updateWeight(), and the associated setters/getters.

The class can be driven interactively as a modal dialog (show() / showDialog()) or invoked non-interactively from VQScript by supplying a protocol string directly to execute(), which runs the entire enabled pipeline and returns a status message.

See also ScriptMaster::PreProcessingTool() to obtain this object.

Member Function Documentation

◆ bedRemovalState

void bedRemovalState ( Qt::CheckState  state)
slot

Updates the bed removal UI (label text and enabled state of the transform/bed selectors) to reflect the current cbBedRemoval tri-state check state: Checked = classic bed removal, Partially Checked = advanced bed removal, Unchecked = no bed removal.

Parameters
statethe new check state of cbBedRemoval

◆ convertUnit()

string convertUnit ( string &  outUnit)

Convert an image's units to another's.

Parameters
outUnitthe unit to convert the image values to
Returns
a string detailing any problems in conversion, if any

◆ createQCImages()

string createQCImages ( AbstractDicomRepository *  rep)

Generate Quality Control images with the preprocessing tool.

Parameters
repa DICOM repository to save to
Returns
a string detailing any problems creating the images, if any

◆ execute()

string execute ( string  protocol = string())

Set values in the PreProcessing Tool based on the provided protocol string and execute the pre-processing based on these settings.

Parameters
protocolThe protocol string
Returns
A message describing the result of executing the protocol

◆ getConvertUnit()

string getConvertUnit ( )

Get the current unit images will be converted to.

Returns
an image unit (Ci, Bq, SUV, etc.) that is the current target for unit conversion.

◆ getConvertUnitType()

string getConvertUnitType ( )

Get the current unit-type category (Counts, Concentration, Percent, Per Weight/Mass, or SUV) associated with getConvertUnit(). This reflects the category cbUnitType is currently set to; it is derived automatically by setConvertUnit() and does not need to be set independently.

Returns
the current unit-type category as displayed in cbUnitType

◆ getImgInjectedDoseUnit()

string getImgInjectedDoseUnit ( Index  idx = Index())

Get the injected dose for a given image's DICOM header.

Parameters
idxThe index of the data. If no index is supplied the first image in the data list will be used.
Returns
The injected dose unit

◆ getImgInjectedDoseValue()

string getImgInjectedDoseValue ( Index  idx = Index())

Get the injected dose for a given image's DICOM header.

Parameters
idxThe index of the data. If no index is supplied the first image in the data list will be used.
Returns
The injected dose value

◆ getImgWeightUnit()

string getImgWeightUnit ( Index  idx = Index())

Get the weight unit of a loaded image.

Parameters
idxThe index of the data. If no index is supplied the first image in the data list will be used.
Returns
The weight unit of the image

◆ getImgWeightValue()

string getImgWeightValue ( Index  idx = Index())

Get the weight value of a loaded image.

Parameters
idxThe index of the data. If no index is supplied the first image in the data list will be used.
Returns
The weight value of the image

◆ isValidQCFilename()

bool isValidQCFilename ( string  filename)

Checks whether or not the provided filename can be used for saving Quality Control image files.

Parameters
filenamethe filename that will be used to save the image
Returns
true if valid, false otherwise

◆ parseQCFilename() [1/2]

string parseQCFilename ( ImageData *  image,
string  filename 
)

Scans a filename format string and replaces special characters with header values from an image.

Parameters
imagethe image to read
filenamethe format string, i.e. qc-i-I
Returns
a string with any matching special characters replaced with values from an image's header

◆ parseQCFilename() [2/2]

string parseQCFilename ( string  filename)

Scans a filename format string and replaces special characters with header key names.

Parameters
filenamethe format string, i.e. qc-i-I
Returns
a string with any matching special characters replaced with header key names

◆ setComment()

void setComment ( string  comment)

Add a comment to the series description of all loaded data. Each image should be marked as updated and will get a DICOM derivation entry on save.

Parameters
commentthe comment string

◆ setConvertUnit()

void setConvertUnit ( string  convertUnit)

Set the target unit for image unit conversions, for example Ci, MBq, SUV, etc. Accepts either the current canonical spelling (e.g. "g/ml") or a recognized legacy alias (e.g. "SUV"); the corresponding unit-type category (Counts, Concentration, Percent, Per Weight/Mass, or SUV) is derived automatically – callers do not need to know about or set the unit-type category separately.

Parameters
convertUnitthe unit to convert to

◆ setInjectedDoseUnit()

void setInjectedDoseUnit ( string  doseUnit)

Set the injected dose unit.

Parameters
doseUnit

◆ setInjectedDoseValue()

void setInjectedDoseValue ( string  doseValue)

Set the injected dose value.

Parameters
doseValue

◆ setPreferredUptakeSource()

void setPreferredUptakeSource ( string  source,
Index  idx = Index() 
)

Change the preferred source to check for decay correction parameters.

Parameters
sourceThe source of the info (DCM, Manual, or IPACS)
idxThe index of the data to modify

◆ setProtocol()

void setProtocol ( string  protocol)

Set values in the PreProcessing Tool based on the provided protocol string.

Parameters
protocolThe protocol string, which is of the form "<preprocessingstep0>=<value0>|<preprocessingstep1>=<value1>|...|<preprocessingstepN>=<valueN>" An example protocol string can be generated by clicking the "Protocol" button in the PreProcessing Tool dialog.

◆ setStoreRepository()

void setStoreRepository ( AbstractDicomRepository *  rep)

Sets the DICOM repository for storage of QC images.

Parameters
repThe DICOM repository

◆ settingsToString()

string settingsToString ( )

Dump current Preprocessing settings to a string.

Returns
a string with the current settings

◆ setUptakeParameter()

void setUptakeParameter ( string  source,
string  parameter,
Array< string >  info,
Index  idx = Index() 
)

Change the value of a parameter used for decay correction.

Parameters
sourceThe source of the info (DCM, Manual, or IPACS)
parameterThe name of the parameter
infoThe parameter's value - either a list containing a single number or a list containing datapoint information
idxThe index of the data to modify

◆ setUptakeSourceOrder()

void setUptakeSourceOrder ( Array< string >  sourceList,
Index  idx = Index() 
)

Change the order in which to check sources for decay correction parameters.

Parameters
sourceListThe list of sources (DCM, Manual, or IPACS)
idxThe index of the data to modify

◆ setWeightUnit()

void setWeightUnit ( string  weightUnit)

Set the unit of the weight unit setting in the preprocessor.

Parameters
weightUnit

◆ setWeightValue()

void setWeightValue ( string  weightValue)

Set the value of the weight value setting in the preprocessor.

Parameters
weightValue

◆ stringToSettings()

void stringToSettings ( string  params)

Apply Preprocessing settings (| - delimited and defined with key=value) to the Preprocessing settings.

Parameters
paramsone or more pipe delimited key=value pairs of settings