VivoQuant
Public Member Functions | Protected Attributes | Friends | List of all members
DataManager Class Reference

Object for managing and querying all image data and meta-information in VivoQuant. More...

Public Member Functions

bool openDat (int type, Array< string > fileNames, bool forcePlanar=false, bool embedSliceDefault=false)
 Load a new image into VivoQuant from a list of filenames. More...
 
int numROIs ()
 Get number of regions of interest currently specified, including background Always greater than 1. More...
 
int getDimX (Index idx)
 Get the number of sagittal slices ("X" dimension) in an image. More...
 
int getDimY (Index idx)
 Get the number of coronal slices ("Y" dimension) in an image. More...
 
int getDimZ (Index idx)
 Get the number of transverse/axial slices ("Z" dimension) in an image. More...
 
int getDim (int id, Index idx)
 Get number of slices in an image along specified dimension. More...
 
int getSize (Index idx)
 Get total number of voxels in an image. More...
 
float getValue (int x, int y, int z, Index idx)
 Return the raw pixel value at provided voxel/pixel location. More...
 
float getMin (Index idx)
 Get minimum raw voxel/pixel value of an image. More...
 
float getMax (Index idx)
 Get maximum raw voxel/pixel value of an image. More...
 
void setDynamicActive (Index idx, int activeId)
 Set the activated index for dynamic data. More...
 
int getDynamicActive (Index idx)
 Get the activated child index for dynamic data. More...
 
bool copyAsNewSeries (Index idx)
 Copy a given data set timepoint from a dynamic collapsed data set. More...
 
float getMinCached (Index idx)
 Get the cached min intensity value of an image. More...
 
float getMaxCached (Index idx)
 Get the cached max intensity value of an image. More...
 
void setMinMaxCache (Index idx, float min, float max)
 Set the cached min/max intensity value of an image. More...
 
float getLevelCached (Index idx)
 Get the cached window level itensity value of an image. More...
 
float getWidthCached (Index idx)
 Get the cached window width itensity value of an image. More...
 
void setLevelWidthCache (Index idx, float level, float width)
 Set the cached window level/width intensity value of an image. More...
 
bool isPlanar (Index idx)
 Check if a given data set is planar or not. More...
 
string getDataTypeString (Index idx)
 Get a string containing the data type of a given data set. More...
 
float voxelSizeDim (int dim, Index idx)
 Get the voxel size of a given data set for a given dimension. More...
 
float voxelSizeX (Index idx)
 Get the X voxel size of a given data set. More...
 
float voxelSizeY (Index idx)
 Get the Y voxel size of a given data set. More...
 
float voxelSizeXY (Index idx)
 Get the XY voxel size of a given data set. More...
 
float voxelSizeZ (Index idx)
 Get the Z voxel size of a given data set. More...
 
string getDesc (Index idx, string key)
 Get a DICOM tag value from a given data set. More...
 
void setDesc (Index idx, string key, string val)
 Set a DICOM tag value to a given data set. More...
 
void setDescs (Index idx, Array< string > keys, Array< string > vals)
 Set a list of DICOM tag value to a given data set. More...
 
double getSUL (Index idx)
 Get the SUL value of a given data set. More...
 
string getDcmString (Index idx, string key)
 Get a DICOM tag string value from a given data set. More...
 
string getSOPUID (Index idx)
 Get the SOP UID of a given data set. More...
 
string getSeriesUID (Index idx)
 Get the Series ID of a given data set. More...
 
string getStudyUID (Index idx)
 Get the Study ID of a given data set. More...
 
void setUniqueStudyID (Index idx)
 Set a unique Study ID to a given data set. More...
 
void setUniqueStudyID (Index idx, string id)
 Set the given unique Study ID to a given data set. More...
 
Index getParentImageIndex (DcmDataset *childImageHeader)
 Finds the index in the DataManager for a possible parent image to a dependent DICOM, for example the original image an RTSTRUCT would have been drawn on. We can match on either of the following: More...
 
string getDataDetailsString (Index idx)
 Return a string with image details (original vs loaded for current voxel sizes, dimensions, and direction cosines matrix.) More...
 
string getHeaderSummary (Index idx)
 Return a string with the header summary ( modality, patient name, and series description) More...
 
int size ()
 Return number of data in first level.
 
int count (Index parent=Index())
 Return number of dynamic data set contained at given index. More...
 
int maxVis ()
 Return the maximum number size that can be visualized.
 
bool hasValid (Index idx)
 Check if the Data Manager holds valid data at the given index. More...
 
void setPaletteParameters (Index idx, float param1, float param2)
 Set the palette values for the given data in Data Manager This function independent of the palette type. More...
 
void setPaletteFromTo (Index idx, float from, float to)
 Set the palette "from" and "to" value for the given data in Data Manager. More...
 
void setPaletteFrom (Index idx, float from)
 Set the palette "from" value for the given data in Data Manager. More...
 
void setPaletteTo (Index idx, float to)
 Set the palette "to" value for the given data in Data Manager. More...
 
void setPaletteLevel (Index idx, float level)
 Set the palette "level" value for the given data in Data Manager. More...
 
void setPaletteWidth (Index idx, float width)
 Set the palette "width" value for the given data in Data Manager. More...
 
void setPalette (Index idx, string name)
 Set the palette for the given data in Data Manager. More...
 
void invertPalette (Index idx)
 Invert the palette for the given data in Data Manager. More...
 
void saveDataPaletteParameter (string name)
 Save palette parameter to disk. More...
 
void loadDataPaletteParameter (string name)
 load palette parameter from file More...
 
float getPaletteFrom (Index idx)
 Get the palette "from" value for the given data in Data Manager. More...
 
float getPaletteTo (Index idx)
 Get the palette "to" value for the given data in Data Manager. More...
 
float getPaletteLevel (Index idx)
 Get the palette window "level" value for the given data in Data Manager. More...
 
float getPaletteWidth (Index idx)
 Get the palette window "width" value for the given data in Data Manager. More...
 
string getPaletteName (Index idx)
 Get the palette name for the given data in Data Manager. More...
 
bool isPaletteInverted (Index idx)
 Get the inverted status of the palette for the given data in Data Manager. More...
 
void unloadData (Index idx, int num=1)
 Unloads data. More...
 
void unloadData (Array< Index > indices)
 Unloads a list of data. More...
 
void swapData (Index a, Index b)
 Swap the position of two data set in the Data Manager. More...
 
void moveData (Array< Index > list, int dst)
 Move data set in the Data Manager. More...
 
bool mergeData (Array< Index > list, bool quiet=true)
 Create a collapsed data set with the selected data. More...
 
void removeTag (Index idx, string key)
 Remove a DICOM tag or sequence item from a given data set. More...
 
void stackData (Array< int > &list, bool quiet=true)
 Create and append an image using multiple single-slice images and unload the images it was created from. More...
 
void stackDataMultiple (QList< Variant > &list, bool quiet=true)
 Create and append images using multiple single-slice images and unload the images they were created from. More...
 

Protected Attributes

QVector< TPointAndMode > m_paths
 list of annotation graphs
 

Friends

class ImageSelectorWidget
 

Detailed Description

Object for managing and querying all image data and meta-information in VivoQuant.

This object can be used to query meta-information from an image, including the DICOM header. It can also be used to open/append new images into VQ and remove/unload images that are currently loaded.

Image data are indexed starting at zero. See also ScriptMaster::dataManager() to obtain this object.

Member Function Documentation

◆ copyAsNewSeries()

bool copyAsNewSeries ( Index  idx)

Copy a given data set timepoint from a dynamic collapsed data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ count()

int count ( Index  parent = Index())

Return number of dynamic data set contained at given index.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getDataDetailsString()

string getDataDetailsString ( Index  idx)

Return a string with image details (original vs loaded for current voxel sizes, dimensions, and direction cosines matrix.)

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getDataTypeString()

string getDataTypeString ( Index  idx)

Get a string containing the data type of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getDcmString()

string getDcmString ( Index  idx,
string  key 
)

Get a DICOM tag string value from a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
For all non-dynamic tag, use the top level parent index, only dynamic tags should be used with child index.

◆ getDesc()

string getDesc ( Index  idx,
string  key 
)

Get a DICOM tag value from a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
keysThe tag/key
valsThe value
Note
For all non-dynamic tag, use the top level parent index, only dynamic tags should be used with child index.

◆ getDim()

int getDim ( int  id,
Index  idx 
)

Get number of slices in an image along specified dimension.

Parameters
idPlane/dimension to query: 0=Sagittal, 1=Coronal, 2=Transverse/Axial
idxIndex of data (see ScriptMaster::index())
Returns
Dimension size, zero if no data are loaded at position i
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getDimX()

int getDimX ( Index  idx)

Get the number of sagittal slices ("X" dimension) in an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Number of sagittal slices, zero if no data are loaded at position i
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getDimY()

int getDimY ( Index  idx)

Get the number of coronal slices ("Y" dimension) in an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Number of coronal slices, zero if no data are loaded at position i
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getDimZ()

int getDimZ ( Index  idx)

Get the number of transverse/axial slices ("Z" dimension) in an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Number of transverse/axial slices, zero if no data are loaded at position i
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getDynamicActive()

int getDynamicActive ( Index  idx)

Get the activated child index for dynamic data.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Child index if any, -1 otherwise

◆ getHeaderSummary()

string getHeaderSummary ( Index  idx)

Return a string with the header summary ( modality, patient name, and series description)

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getLevelCached()

float getLevelCached ( Index  idx)

Get the cached window level itensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getMax()

float getMax ( Index  idx)

Get maximum raw voxel/pixel value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Maximum or NaN if no image exists at provided index, in native data units

◆ getMaxCached()

float getMaxCached ( Index  idx)

Get the cached max intensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getMin()

float getMin ( Index  idx)

Get minimum raw voxel/pixel value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Minimum or NaN if no image exists at provided index, in native data units

◆ getMinCached()

float getMinCached ( Index  idx)

Get the cached min intensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getPaletteFrom()

float getPaletteFrom ( Index  idx)

Get the palette "from" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getPaletteLevel()

float getPaletteLevel ( Index  idx)

Get the palette window "level" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getPaletteName()

string getPaletteName ( Index  idx)

Get the palette name for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getPaletteTo()

float getPaletteTo ( Index  idx)

Get the palette "to" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getPaletteWidth()

float getPaletteWidth ( Index  idx)

Get the palette window "width" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getParentImageIndex()

Index getParentImageIndex ( DcmDataset *  childImageHeader)

Finds the index in the DataManager for a possible parent image to a dependent DICOM, for example the original image an RTSTRUCT would have been drawn on. We can match on either of the following:

  1. ReferencedSOPInstanceUID child string including a SOPInstanceUID parent string
  2. Same study ID
Parameters
childImageHeaderthe DICOM header for the child image
Returns
-1 if image not found, otherwise the index of a matching image in the DataManager.

◆ getSeriesUID()

string getSeriesUID ( Index  idx)

Get the Series ID of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getSize()

int getSize ( Index  idx)

Get total number of voxels in an image.

Parameters
idxIndex of data (see ScriptMaster::index())
Returns
Dimension size, zero if no data are loaded at position i
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ getSOPUID()

string getSOPUID ( Index  idx)

Get the SOP UID of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getStudyUID()

string getStudyUID ( Index  idx)

Get the Study ID of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getSUL()

double getSUL ( Index  idx)

Get the SUL value of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ getValue()

float getValue ( int  x,
int  y,
int  z,
Index  idx 
)

Return the raw pixel value at provided voxel/pixel location.

Parameters
xSagittal slice index
yCoronal slice index
zTransverse/Axial slice index
idxIndex of data (see ScriptMaster::index())
Returns
Dimension size, zero if no data are loaded at the given index position

◆ getWidthCached()

float getWidthCached ( Index  idx)

Get the cached window width itensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ hasValid()

bool hasValid ( Index  idx)
inline

Check if the Data Manager holds valid data at the given index.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ invertPalette()

void invertPalette ( Index  idx)

Invert the palette for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ isPaletteInverted()

bool isPaletteInverted ( Index  idx)

Get the inverted status of the palette for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ isPlanar()

bool isPlanar ( Index  idx)

Check if a given data set is planar or not.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ loadDataPaletteParameter()

void loadDataPaletteParameter ( string  name)

load palette parameter from file

Parameters
pathwith file name(*.txt)

◆ mergeData()

bool mergeData ( Array< Index >  list,
bool  quiet = true 
)

Create a collapsed data set with the selected data.

Parameters
listList of data index to be grouped (see ScriptMaster::index())

◆ moveData()

void moveData ( Array< Index >  list,
int  dst 
)

Move data set in the Data Manager.

Parameters
aList of data index to moved (see ScriptMaster::index())
bIndex of the parent destination to be moved.
Note
When using dynamic data, only parent index can be moved and used as a destination.

◆ numROIs()

int numROIs ( )

Get number of regions of interest currently specified, including background Always greater than 1.

Returns
Number of ROIs

◆ openDat()

bool openDat ( int  type,
Array< string >  fileNames,
bool  forcePlanar = false,
bool  embedSliceDefault = false 
)

Load a new image into VivoQuant from a list of filenames.

Parameters
typePosition where image will be loaded into the list. 0=Reference, 1=Input 1, etc.
fileNamesArray of filenames containing full paths or path relative to current working directory where VQ was started from
forcePlanar(Optional) Indicates whether image should be forced into "Planar" mode upon loading https://www.vivoquant.com/cgi-bin/manual.cgi?config-data.html
embedSliceDefault(Optional) Indicates whether default values for embed slice (embedded in the center of the reference data) should be used or a dialog prompt will appear to define it. Only applies for plannar data.
Returns
true if data is loaded successfully, otherwise returns false

◆ removeTag()

void removeTag ( Index  idx,
string  key 
)

Remove a DICOM tag or sequence item from a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
keyThe tag/key

◆ saveDataPaletteParameter()

void saveDataPaletteParameter ( string  name)

Save palette parameter to disk.

Parameters
outputpath with file name(*.txt)

◆ setDesc()

void setDesc ( Index  idx,
string  key,
string  val 
)

Set a DICOM tag value to a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
keysThe tag/key
valsThe value
Note
For all non-dynamic tag, use the top level parent index, only dynamic tags should be used with child index.

◆ setDescs()

void setDescs ( Index  idx,
Array< string >  keys,
Array< string >  vals 
)

Set a list of DICOM tag value to a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
keysThe list of tags/keys
valsThe list of values
Note
For all non-dynamic tag, use the top level parent index, only dynamic tags should be used with child index.

◆ setDynamicActive()

void setDynamicActive ( Index  idx,
int  activeId 
)

Set the activated index for dynamic data.

Parameters
idxIndex of data (see ScriptMaster::index())
activeIdindicate the number of child to be displayed.

◆ setLevelWidthCache()

void setLevelWidthCache ( Index  idx,
float  level,
float  width 
)

Set the cached window level/width intensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())
levelWindow level or center
widthWindow width

◆ setMinMaxCache()

void setMinMaxCache ( Index  idx,
float  min,
float  max 
)

Set the cached min/max intensity value of an image.

Parameters
idxIndex of data (see ScriptMaster::index())
levelWindow min
widthWindow max

◆ setPalette()

void setPalette ( Index  idx,
string  name 
)

Set the palette for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
nameName of the palette

◆ setPaletteFrom()

void setPaletteFrom ( Index  idx,
float  from 
)

Set the palette "from" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
fromFrom parameter value from 0-1.0

◆ setPaletteFromTo()

void setPaletteFromTo ( Index  idx,
float  from,
float  to 
)

Set the palette "from" and "to" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
fromFrom parameter value from 0-1.0
tofor right parameter from 0-1.0

◆ setPaletteLevel()

void setPaletteLevel ( Index  idx,
float  level 
)

Set the palette "level" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
levelLevel parameter value from 0-1.0

◆ setPaletteParameters()

void setPaletteParameters ( Index  idx,
float  param1,
float  param2 
)

Set the palette values for the given data in Data Manager This function independent of the palette type.

Parameters
idxIndex of data (see ScriptMaster::index())
param1First parameter value from 0-1.0
param2Second parameter value from 0-1.0
Note
If the palette type is Min/Max the param1 and param2 are expected to be from and to respectively. If the palette type is Window Width/Level the param1 and param2 are expected to be width and level respectively.

◆ setPaletteTo()

void setPaletteTo ( Index  idx,
float  to 
)

Set the palette "to" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
toTo parameter value from 0-1.0

◆ setPaletteWidth()

void setPaletteWidth ( Index  idx,
float  width 
)

Set the palette "width" value for the given data in Data Manager.

Parameters
idxIndex of data (see ScriptMaster::index())
widthWidth parameter value from 0-1.0

◆ setUniqueStudyID() [1/2]

void setUniqueStudyID ( Index  idx)

Set a unique Study ID to a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ setUniqueStudyID() [2/2]

void setUniqueStudyID ( Index  idx,
string  id 
)

Set the given unique Study ID to a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())

◆ stackData()

void stackData ( Array< int > &  list,
bool  quiet = true 
)

Create and append an image using multiple single-slice images and unload the images it was created from.

Parameters
listThe indices of the data to be stacked
quiet(optional) If true, warnings are displayed in a UI popup, if false they are printed to the debug output.

◆ stackDataMultiple()

void stackDataMultiple ( QList< Variant > &  list,
bool  quiet = true 
)

Create and append images using multiple single-slice images and unload the images they were created from.

Parameters
listA list of lists, where each list contains indices of data that will be stacked into one image
quiet(optional) If true, warnings are displayed in a UI popup, if false they are printed to the debug output.

◆ swapData()

void swapData ( Index  a,
Index  b 
)

Swap the position of two data set in the Data Manager.

Parameters
aFrist data index to swap (see ScriptMaster::index())
bSecond data index to swap (see ScriptMaster::index())
Note
When using dynamic data, only parent index can be swapped

◆ unloadData() [1/2]

void unloadData ( Array< Index >  indices)

Unloads a list of data.

Parameters
indicesA list containing the indices to unload (see ScriptMaster::index())

◆ unloadData() [2/2]

void unloadData ( Index  idx,
int  num = 1 
)

Unloads data.

Parameters
fromIndex at which to start unloading (see ScriptMaster::index())
numNumber of consecutive datasets to unload at the same level, starting with and including startIndex

◆ voxelSizeDim()

float voxelSizeDim ( int  dim,
Index  idx 
)

Get the voxel size of a given data set for a given dimension.

Parameters
dimthe Dimension (x:0, y:1, z:2)
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ voxelSizeX()

float voxelSizeX ( Index  idx)

Get the X voxel size of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ voxelSizeXY()

float voxelSizeXY ( Index  idx)

Get the XY voxel size of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ voxelSizeY()

float voxelSizeY ( Index  idx)

Get the Y voxel size of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set

◆ voxelSizeZ()

float voxelSizeZ ( Index  idx)

Get the Z voxel size of a given data set.

Parameters
idxIndex of data (see ScriptMaster::index())
Note
The index parameter is optional. If not specified, it will return the value for the first data set