Isis Developer Reference
Isis::CubeStretch Class Reference

Stores stretch information for a cube. More...

#include <CubeStretch.h>

Inheritance diagram for Isis::CubeStretch:
Inheritance graph
Collaboration diagram for Isis::CubeStretch:
Collaboration graph

Public Member Functions

 CubeStretch (QString name="DefaultStretch", QString stretchType="Default", int bandNumber=1)
 Constructs a CubeStretch object with default mapping of special pixel values to themselves and a provided name, and a provided stretch type.
 
 CubeStretch (CubeStretch const &stretch)
 Copy constructor for a CubeStretch.
 
 CubeStretch (Stretch const &stretch)
 Constructs a CubeStretch object from a normal Stretch.
 
 CubeStretch (Stretch const &stretch, QString type)
 Constructs a CubeStretch object from a normal Stretch.
 
 CubeStretch (Blob blob)
 Constructs a CubeStretch from a Blob.
 
 ~CubeStretch ()
 
bool operator== (CubeStretch &stretch2)
 Check if the CubeStretches are equal.
 
Isis::Blob toBlob () const
 Serialize the CubeStretch to a Blob.
 
QString getType () const
 Get the Type of Stretch.
 
void setType (QString stretchType)
 Set the type of Stretch.
 
QString getName () const
 Get the Stretch name.
 
void setName (QString name)
 Set the Stretch name.
 
int getBandNumber () const
 Get the band number for the stretch.
 
void setBandNumber (int bandNumber)
 Set the band number for the stretch.
 
void AddPair (const double input, const double output)
 Adds a stretch pair to the list of pairs.
 
void SetNull (const double value)
 Sets the mapping for NULL pixels.
 
void SetLis (const double value)
 Sets the mapping for LIS pixels.
 
void SetLrs (const double value)
 Sets the mapping for LRS pixels.
 
void SetHis (const double value)
 Sets the mapping for HIS pixels.
 
void SetHrs (const double value)
 Sets the mapping for HRS pixels.
 
void SetMinimum (const double value)
 
void SetMaximum (const double value)
 
void Load (Pvl &pvl, QString &grpName)
 Loads the stretch pairs from the pvl file into the Stretch object.
 
void Load (QString &file, QString &grpName)
 Loads the stretch pairs from the pvl file into the Stretch object.
 
void Save (Pvl &pvl, QString &grpName)
 
void Save (QString &file, QString &grpName)
 Saves the stretch pairs in the Stretch object into the given pvl file.
 
double Map (const double value) const
 Maps an input value to an output value based on the stretch pairs and/or special pixel mappings.
 
void Parse (const QString &pairs)
 Parses a string of the form "i1:o1 i2:o2...iN:oN" where each i:o represents an input:output pair.
 
void Parse (const QString &pairs, const Isis::Histogram *hist)
 Parses a string of the form "i1:o1 i2:o2...iN:oN" where each i:o represents an input:output pair where the input is a percentage.
 
QString Text () const
 Converts stretch pair to a string.
 
int Pairs () const
 Returns the number of stretch pairs.
 
double Input (const int index) const
 Returns the value of the input side of the stretch pair at the specified index.
 
double Output (const int index) const
 Returns the value of the output side of the stretch pair at the specified index.
 
void ClearPairs ()
 Clears the stretch pairs.
 
void CopyPairs (const Stretch &other)
 Copies the stretch pairs from another Stretch object, but maintains special pixel values.
 

Detailed Description

Stores stretch information for a cube.

Stores stretch pairs, band number associated with the stretch, and the stretch type from the Advanced Stretch Tool (or 'Default' if not specified)

Author
2020-07-28 Kristin Berry

Constructor & Destructor Documentation

◆ CubeStretch() [1/5]

Isis::CubeStretch::CubeStretch ( QString name = "DefaultStretch",
QString stretchType = "Default",
int bandNumber = 1 )

Constructs a CubeStretch object with default mapping of special pixel values to themselves and a provided name, and a provided stretch type.

Parameters
nameName to use for Stretch
typeType of stretch

◆ CubeStretch() [2/5]

Isis::CubeStretch::CubeStretch ( CubeStretch const & stretch)

Copy constructor for a CubeStretch.

References getBandNumber(), getName(), and getType().

◆ CubeStretch() [3/5]

Isis::CubeStretch::CubeStretch ( Stretch const & stretch)

Constructs a CubeStretch object from a normal Stretch.

Parameters
StretchStretch to construct the CubeStretch from.

◆ CubeStretch() [4/5]

Isis::CubeStretch::CubeStretch ( Stretch const & stretch,
QString stretchType )

Constructs a CubeStretch object from a normal Stretch.

Parameters
StretchStretch to construct the CubeStretch from.

◆ CubeStretch() [5/5]

Isis::CubeStretch::CubeStretch ( Blob blob)

Constructs a CubeStretch from a Blob.

Parameters
blobThe Blob to read data from.

References Isis::Stretch::Parse(), setBandNumber(), setName(), and setType().

◆ ~CubeStretch()

Isis::CubeStretch::~CubeStretch ( )

Member Function Documentation

◆ AddPair()

void Isis::Stretch::AddPair ( const double input,
const double output )
inherited

Adds a stretch pair to the list of pairs.

Note that all input pairs must be in ascending order.

Parameters
inputInput value to map
outputOutput value when the input is mapped
Exceptions
Isis::IException::Programmer- input pairs must be in ascending order

References _FILEINFO_, and Isis::IException::Programmer.

Referenced by Isis::GaussianStretch::GaussianStretch(), Isis::Stretch::Load(), Isis::Stretch::Parse(), Isis::Stretch::Parse(), Isis::VisualDisplay::setPixelData(), Isis::BinaryStretchType::setStretch(), Isis::StretchTool::stretchBand(), and Isis::StretchTool::stretchBuffer().

◆ ClearPairs()

void Isis::Stretch::ClearPairs ( )
inlineinherited

◆ CopyPairs()

void Isis::Stretch::CopyPairs ( const Stretch & other)
inherited

◆ getBandNumber()

int Isis::CubeStretch::getBandNumber ( ) const

Get the band number for the stretch.

Returns
int band number

Referenced by CubeStretch(), operator==(), and toBlob().

◆ getName()

QString Isis::CubeStretch::getName ( ) const

Get the Stretch name.

Returns
QString name of stretch

Referenced by CubeStretch(), operator==(), and toBlob().

◆ getType()

QString Isis::CubeStretch::getType ( ) const

Get the Type of Stretch.

Returns
QString Type of Stretch.

Referenced by CubeStretch(), and toBlob().

◆ Input()

double Isis::Stretch::Input ( const int index) const
inherited

Returns the value of the input side of the stretch pair at the specified index.

If the index number is out of bounds, then the method returns -1

Parameters
indexThe index number to retrieve the input stretch pair value from
Returns
double The input side of the stretch pair at the specified index

Referenced by Isis::Stretch::Save(), Isis::HistogramWidget::setStretch(), Isis::LinearStretchType::setStretch(), and Isis::StretchType::updateTable().

◆ Load() [1/2]

void Isis::Stretch::Load ( Isis::Pvl & pvl,
QString & grpName )
inherited

Loads the stretch pairs from the pvl file into the Stretch object.

The pvl should look similar to this:

Group = Pairs
Input = (0,100,255)
Output = (255,100,0)
EndGroup
double Output(const int index) const
Returns the value of the output side of the stretch pair at the specified index.
Definition Stretch.cpp:302
double Input(const int index) const
Returns the value of the input side of the stretch pair at the specified index.
Definition Stretch.cpp:287
int Pairs() const
Returns the number of stretch pairs.
Definition Stretch.h:162
Parameters
pvl- The pvl containing the stretch pairs
grpName- The group name to get the input and output keywords from

References _FILEINFO_, Isis::Stretch::AddPair(), Isis::toDouble(), Isis::PvlObject::Traverse, and Isis::IException::User.

Referenced by Isis::Stretch::Load().

◆ Load() [2/2]

void Isis::Stretch::Load ( QString & file,
QString & grpName )
inherited

Loads the stretch pairs from the pvl file into the Stretch object.

The file should look similar to this:

Group = Pairs
Input = (0,100,255)
Output = (255,100,0)
EndGroup
Parameters
file- The input file containing the stretch pairs
grpName- The group name to get the input and output keywords from

References Isis::Stretch::Load().

◆ Map()

double Isis::Stretch::Map ( const double value) const
inherited

Maps an input value to an output value based on the stretch pairs and/or special pixel mappings.

Parameters
valueValue to map
Returns
double The mapped output value is returned by this method

References Isis::IsHisPixel(), Isis::IsHrsPixel(), Isis::IsLisPixel(), Isis::IsNullPixel(), and Isis::IsValidPixel().

Referenced by Isis::GaussianStretch::Map(), and Isis::VisualDisplay::paintPixmap().

◆ operator==()

bool Isis::CubeStretch::operator== ( CubeStretch & stretch2)

Check if the CubeStretches are equal.

Parameters
stretch2The stretch to compare with
Returns
bool True if stretches are equal. Else, false.

References getBandNumber(), getName(), and Isis::Stretch::Text().

◆ Output()

double Isis::Stretch::Output ( const int index) const
inherited

Returns the value of the output side of the stretch pair at the specified index.

If the index number is out of bounds, then the method returns -1.

Parameters
indexThe index number to retieve the output stretch pair value from
Returns
double The output side of the stretch pair at the specified index

Referenced by Isis::Stretch::Save(), Isis::HistogramWidget::setStretch(), and Isis::StretchType::updateTable().

◆ Pairs()

◆ Parse() [1/2]

void Isis::Stretch::Parse ( const QString & pairs)
inherited

Parses a string of the form "i1:o1 i2:o2...iN:oN" where each i:o represents an input:output pair.

Therefore, the user can enter a string in this form and this method will parse the string and load the stretch pairs into the object via AddPairs.

Parameters
pairsA string containing stretch pairs for example "0:0 50:0 100:255 255:255"
Exceptions
Isis::IException::User- invalid stretch pair

References _FILEINFO_, Isis::Stretch::AddPair(), and Isis::IException::User.

Referenced by CubeStretch(), Isis::CubeViewport::stretchBlue(), Isis::CubeViewport::stretchGray(), Isis::CubeViewport::stretchGreen(), and Isis::CubeViewport::stretchRed().

◆ Parse() [2/2]

void Isis::Stretch::Parse ( const QString & pairs,
const Isis::Histogram * hist )
inherited

Parses a string of the form "i1:o1 i2:o2...iN:oN" where each i:o represents an input:output pair where the input is a percentage.

Using the Histogram an appropriate dn value will be calculated for each input percentage. Therefore, the user can enter a string in this form and this method will parse the string and load the stretch pairs into the object via AddPairs.

Parameters
pairsA string containing stretch pairs for example "0:0 50:0 100:255"
Exceptions
Isis::IException::User- invalid stretch pair

References _FILEINFO_, Isis::Stretch::AddPair(), and Isis::IException::User.

◆ Save() [1/2]

void Isis::Stretch::Save ( Isis::Pvl & pvl,
QString & grpName )
inherited

◆ Save() [2/2]

void Isis::Stretch::Save ( QString & file,
QString & grpName )
inherited

Saves the stretch pairs in the Stretch object into the given pvl file.

Parameters
file- The file that the stretch pairs will be written to
grpName- The name of the group to create and put the stretch pairs into. The group will contain two keywords, Input, and Output.

References Isis::Stretch::Save().

◆ setBandNumber()

void Isis::CubeStretch::setBandNumber ( int bandNumber)

Set the band number for the stretch.

Parameters
intband number

Referenced by CubeStretch(), and Isis::StretchTool::saveStretchToCube().

◆ SetHis()

void Isis::Stretch::SetHis ( const double value)
inlineinherited

Sets the mapping for HIS pixels.

If not called the HIS pixels will be mapped to HIS. Otherwise you can map HIS to any double value. For example, SetHis(255.0).

Parameters
valueValue to map input HIS

Referenced by Isis::CubeViewport::BandInfo::BandInfo(), Isis::QStretch::QStretch(), and Isis::VisualDisplay::VisualDisplay().

◆ SetHrs()

void Isis::Stretch::SetHrs ( const double value)
inlineinherited

Sets the mapping for HRS pixels.

If not called the HRS pixels will be mapped to HRS. Otherwise you can map HRS to any double value. For example, SetHrs(255.0).

Parameters
valueValue to map input HRS

Referenced by Isis::CubeViewport::BandInfo::BandInfo(), Isis::QStretch::QStretch(), and Isis::VisualDisplay::VisualDisplay().

◆ SetLis()

void Isis::Stretch::SetLis ( const double value)
inlineinherited

Sets the mapping for LIS pixels.

If not called the LIS pixels will be mapped to LIS. Otherwise you can map LIS to any double value. For example, SetLis(0.0).

Parameters
valueValue to map input LIS

Referenced by Isis::CubeViewport::BandInfo::BandInfo(), Isis::QStretch::QStretch(), and Isis::VisualDisplay::VisualDisplay().

◆ SetLrs()

void Isis::Stretch::SetLrs ( const double value)
inlineinherited

Sets the mapping for LRS pixels.

If not called the LRS pixels will be mapped to LRS. Otherwise you can map LRS to any double value. For example, SetLrs(0.0).

Parameters
valueValue to map input LRS

Referenced by Isis::CubeViewport::BandInfo::BandInfo(), Isis::QStretch::QStretch(), and Isis::VisualDisplay::VisualDisplay().

◆ SetMaximum()

void Isis::Stretch::SetMaximum ( const double value)
inlineinherited

◆ SetMinimum()

void Isis::Stretch::SetMinimum ( const double value)
inlineinherited

◆ setName()

void Isis::CubeStretch::setName ( QString name)

Set the Stretch name.

Parameters
QStringname for stretch

Referenced by CubeStretch(), and Isis::StretchTool::saveStretchToCube().

◆ SetNull()

void Isis::Stretch::SetNull ( const double value)
inlineinherited

Sets the mapping for NULL pixels.

If not called the NULL pixels will be mapped to NULL. Otherwise you can map NULLs to any double value. For example, SetNull(0.0).

Parameters
valueValue to map input NULLs

Referenced by Isis::CubeViewport::BandInfo::BandInfo(), Isis::QStretch::QStretch(), and Isis::VisualDisplay::VisualDisplay().

◆ setType()

void Isis::CubeStretch::setType ( QString stretchType)

Set the type of Stretch.

Parameters
QStringType of Stretch.

Referenced by CubeStretch().

◆ Text()

QString Isis::Stretch::Text ( ) const
inherited

Converts stretch pair to a string.

Returns
string The stretch pair as a string

References Isis::toString().

Referenced by operator==(), Isis::BinaryStretchType::setStretch(), Isis::LinearStretchType::setStretch(), Isis::ManualStretchType::setStretch(), and toBlob().

◆ toBlob()

Isis::Blob Isis::CubeStretch::toBlob ( ) const

Serialize the CubeStretch to a Blob.

The stretch will be serialized as a string. See Stretch::Text for more information.

Returns
Blob a Blob containing the stretch data.

References getBandNumber(), getName(), getType(), and Isis::Stretch::Text().

Referenced by Isis::StretchTool::saveStretchToCube().


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