ExperimentManager script class  1.1.0.1
The Experiment Manager script class reference.
Public Types | Public Slots | Public Member Functions | List of all members
ImageProcessor Class Reference

The ImageProcessor class. More...

Inherits QObject, and QScriptable.

Public Types

enum  ScalingMethod { ScalingMethod_MonoColored = 0, ScalingMethod_SmoothGreyColored = 1, ScalingMethod_SmoothMonoColored = 2, ScalingMethod_SmoothMonoColoredCustomThreshold = 3 }
 

Public Slots

bool ConcatenateDatFiles (const QStringList &sourceImagePaths, const QString &destinationPath, const bool bOverwrite=false)
 Concatenates one or more DAT image(s) (*.dat) to one CDAT (*.cdat) file. More...
 
bool ConvertDatToPngFile (QString strSource, QString strDestination, bool bOverwrite=false)
 Converts and saves a custom Dat (*.dat) file to a Png (*.png) file format. More...
 
bool ConvertPngToDatFile (QString strSource, QString strDestination, bool bOverwrite=false)
 Converts and saves a Png (*.png) file to the custom Dat (*.dat) file format. More...
 
bool CreateMeanImageFromPngFiles (const QStringList &sourceImagePaths, const QString &destinationPath, const bool bOverwrite=false)
 Creates a mean Png image (*.png) from one or more Png (*.png) images. More...
 
int getCDATFileNrOfSubFrames (const QString &sourcePath)
 Returns the amount of sub-images a specified CDAT (*.cdat) file contains. More...
 
QImage getImageFromCDATFile (const QString &sourcePath, const int &nIndex=0)
 Returns a specified QImage from a CDAT (*.cdat) file. More...
 
bool ScalePngFile (QString strSource, QString strDestination, int nRatio=1, int nMethod=0, int nColorThreshold=255, bool bOverwrite=false, bool bSmoothFiltering=false)
 Scales a a Png (*.png) file by a specified Ratio. More...
 
bool ScalePngFileBySize (QString strSource, QString strDestination, int nXPixels, int nYPixels, int nMethod=0, int nColorThreshold=255, bool bOverwrite=false, bool bSmoothFiltering=false)
 Scales a a Png (*.png) file by a specified Size. More...
 
int SplitCDatFile (const QString &sourceImagePath, const QString &destinationPath, const QString &destPreFileName, const bool bOverwrite=false)
 Splits a CDAT (*.cdat) file into one or more DAT (*.dat) image file(s). More...
 

Public Member Functions

 ImageProcessor (QObject *parent=NULL)
 The ImageProcessor constructor. More...
 
 ~ImageProcessor ()
 The ImageProcessor destructor. More...
 

Detailed Description

The ImageProcessor class.

The Image Processor can be used to edit Png (*.png) and custom Dat (*.dat) files.

Member Enumeration Documentation

The enum ScalingMethod holds a Scaling Method for the ImageProcessor object

Enumerator
ScalingMethod_MonoColored 

default, Mono Colored.

ScalingMethod_SmoothGreyColored 

Smoothed (Grey value Colored).

ScalingMethod_SmoothMonoColored 

Smoothed and converted to a Mono Color values, threshold value = 255.

ScalingMethod_SmoothMonoColoredCustomThreshold 

Smoothed and converted to a Mono Color values, custom threshold value.

Constructor & Destructor Documentation

ImageProcessor::ImageProcessor ( QObject *  parent = NULL)

The ImageProcessor constructor.

You do not need to specify the parent object. The BrainStim script engine automatically retrieves the parent role

ImageProcessor::~ImageProcessor ( )

The ImageProcessor destructor.

You do not need call the destructor. The BrainStim script engine automatically performs the garbage collection after you set the object to NULL and the script ends

Member Function Documentation

bool ImageProcessor::ConcatenateDatFiles ( const QStringList &  sourceImagePaths,
const QString &  destinationPath,
const bool  bOverwrite = false 
)
slot

Concatenates one or more DAT image(s) (*.dat) to one CDAT (*.cdat) file.

This function Concatenates one or more DAT (*.dat) image file(s) to one CDAT (*.cdat) file specified by a source list and destination directory path.

Parameters
sourceImagePathsa StringList containing the path(s) to the source DAT (*.dat) file(s).
destinationPatha String containing the path to destination concatenated CDAT (*.cdat) file.
bOverwritea boolean value determining whether the destination file should be automatically overwritten when it already exists.
Returns
a Boolean value representing whether the concatenated destination file could be saved.
bool ImageProcessor::ConvertDatToPngFile ( QString  strSource,
QString  strDestination,
bool  bOverwrite = false 
)
slot

Converts and saves a custom Dat (*.dat) file to a Png (*.png) file format.

This function Converts and saves a custom Dat (*.dat) file to a Png (*.png) file format.

Parameters
strSourcea String containing the path to the source Dat (*.dat) file.
strDestinationa String containing the path to destination Png (*.png) file.
bOverwritea Boolean value determing whether the destination file should be automatically overwritten when it already exists.
Returns
a Boolean value representing whether the target file could be saved.
bool ImageProcessor::ConvertPngToDatFile ( QString  strSource,
QString  strDestination,
bool  bOverwrite = false 
)
slot

Converts and saves a Png (*.png) file to the custom Dat (*.dat) file format.

This function Converts and saves a Png (*.png) file to the custom Dat (*.dat) file format.

Parameters
strSourcea String containing the path to the source Png (*.png) file.
strDestinationa String containing the path to destination Dat (*.dat) file.
bOverwritea Boolean value determing whether the destination file should be automatically overwritten when it already exists.
Returns
a Boolean value representing whether the target file could be saved.
bool ImageProcessor::CreateMeanImageFromPngFiles ( const QStringList &  sourceImagePaths,
const QString &  destinationPath,
const bool  bOverwrite = false 
)
slot

Creates a mean Png image (*.png) from one or more Png (*.png) images.

This function Creates a mean Png image (*.png) from one or more Png (*.png) images specified by a source list and destination directory path.

Parameters
sourceImagePathsa StringList containing the path(s) to the source Png (*.png) file(s).
destinationPatha String containing the path to destination mean Image Png (*.png) file.
bOverwritea boolean value determining whether the destination file should be automatically overwritten when it already exists.
Returns
a Boolean value representing whether the mean image destination file could be saved.
int ImageProcessor::getCDATFileNrOfSubFrames ( const QString &  sourcePath)
slot

Returns the amount of sub-images a specified CDAT (*.cdat) file contains.

This function Returns the amount of sub-images a specified CDAT (*.cdat) file contains, specified by a source CDAT (*.cdat) file path.

Parameters
sourcePatha String containing the path to the source CDAT (*.cdat) file.
Returns
a integer containing the number of sub-images, if this function could not execute properly it returns -1.
QImage ImageProcessor::getImageFromCDATFile ( const QString &  sourcePath,
const int &  nIndex = 0 
)
slot

Returns a specified QImage from a CDAT (*.cdat) file.

This function Returns a specified QImage from a CDAT (*.cdat) file, specified by a source CDAT (*.cdat) file path and a image index (0 based).

Parameters
sourcePatha String containing the path to the source CDAT (*.cdat) file.
nIndexa integer containing the index from the requested image in the source CDAT (*.cdat) file.
Returns
a QImage object that contains the requested image data, if this function could not execute properly it return an QImage object with size(w=0,h=0).
bool ImageProcessor::ScalePngFile ( QString  strSource,
QString  strDestination,
int  nRatio = 1,
int  nMethod = 0,
int  nColorThreshold = 255,
bool  bOverwrite = false,
bool  bSmoothFiltering = false 
)
slot

Scales a a Png (*.png) file by a specified Ratio.

This function Scales and saves a Png (*.png) file to a specified destination.

Parameters
strSourcea String containing the path to the source Png (*.png) file.
strDestinationa String containing the path to destination Png (*.png) file.
nRatioan integer value containing Ratio to which the image should be scaled.
nMethodan integer value containing the Scaling Method, see ImageProcessor::ScalingMethod.
nColorThresholdan integer value containing the Threshold value in case the defined Scaling Method is ScalingMethod_SmoothMonoColoredCustomThreshold.
bOverwritea Boolean value determining whether the destination file should be automatically overwritten when it already exists.
bSmoothFilteringa Boolean value determining whether a the resulting image is transformed using bilinear filtering.
Returns
a Boolean value representing whether the target file could be saved.
bool ImageProcessor::ScalePngFileBySize ( QString  strSource,
QString  strDestination,
int  nXPixels,
int  nYPixels,
int  nMethod = 0,
int  nColorThreshold = 255,
bool  bOverwrite = false,
bool  bSmoothFiltering = false 
)
slot

Scales a a Png (*.png) file by a specified Size.

This function Scales and saves a Png (*.png) file to a specified destination.

Parameters
strSourcea String containing the path to the source Png (*.png) file.
strDestinationa String containing the path to destination Png (*.png) file.
nXPixelsan integer value containing the number of pixels (width) to which the image should be scaled.
nYPixelsan integer value containing the number of pixels (height) to which the image should be scaled.
nMethodan integer value containing the Scaling Method, see ImageProcessor::ScalingMethod.
nColorThresholdan integer value containing the Threshold value in case the defined Scaling Method is ScalingMethod_SmoothMonoColoredCustomThreshold.
bOverwritea Boolean value determining whether the destination file should be automatically overwritten when it already exists.
bSmoothFilteringa Boolean value determining whether a the resulting image is transformed using bilinear filtering.
Returns
a Boolean value representing whether the target file could be saved.
int ImageProcessor::SplitCDatFile ( const QString &  sourceImagePath,
const QString &  destinationPath,
const QString &  destPreFileName,
const bool  bOverwrite = false 
)
slot

Splits a CDAT (*.cdat) file into one or more DAT (*.dat) image file(s).

This function Splits a CDAT (*.cdat) file into one or more DAT (*.dat) image file(s), specified by a source and destination directory path.

Parameters
sourceImagePatha String containing the path to the source CDAT (*.cdat) file.
destinationPatha String containing the path to destination directory where the DAT (*.dat) file(s) are saved.
destPreFileNamethe prefix used for saving the split DAT (*.dat) file(s) –> "<destPreFileName>_<0 based DAT file index>.dat", e.g. studyxyz_3.dat.
bOverwritea boolean value determining whether the destination file(s) should be automatically overwritten when it already exists.
Returns
a Boolean value representing whether the split image file(s) could be saved to the destination directory.