Isis 3 Programmer Reference
|
Manipulate and parse attributes of output cube filenames. More...
#include <CubeAttribute.h>
Public Member Functions | |
CubeAttributeOutput () | |
Constructs an empty CubeAttributeOutput. More... | |
CubeAttributeOutput (const FileName &fileName) | |
Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter. More... | |
~CubeAttributeOutput () | |
Destroys the object. More... | |
bool | propagatePixelType () const |
Return true if the pixel type is to be propagated from an input cube. More... | |
bool | propagateMinimumMaximum () const |
Return true if the min/max are to be propagated from an input cube. More... | |
Cube::Format | fileFormat () const |
Return the file format an Cube::Format. More... | |
QString | fileFormatString () const |
Return the file format as a string. More... | |
void | setFileFormat (Cube::Format fmt) |
Set the format to the fmt parameter. More... | |
ByteOrder | byteOrder () const |
Return the byte order as an Isis::ByteOrder. More... | |
QString | byteOrderString () const |
Return the byte order as a string. More... | |
void | setByteOrder (ByteOrder order) |
Set the order according to the parameter order. More... | |
double | minimum () const |
Return the output cube attribute minimum. More... | |
double | maximum () const |
Return the output cube attribute maximum. More... | |
void | setMinimum (double min) |
Set the output cube attribute minimum. More... | |
void | setMaximum (double max) |
Set the output cube attribute maximum. More... | |
PixelType | pixelType () const |
Return the pixel type as an Isis::PixelType. More... | |
void | setPixelType (PixelType type) |
Set the pixel type to that given by the parameter. More... | |
void | setLabelAttachment (LabelAttachment attachment) |
Set the label attachment type to the parameter value. More... | |
LabelAttachment | labelAttachment () const |
QString | toString () const |
Return a string-representation of this cube attributes. More... | |
void | addAttribute (QString attribute) |
Add a single attribute to these attributes. More... | |
void | addAttributes (const FileName &fileNameWithAtts) |
Append the attributes found in the filename to these cube attributes. More... | |
void | addAttributes (const char *attributesString) |
Append the attributes in the string to these cube attributes. More... | |
void | addAttributes (const QString &attributesString) |
Append the attributes in the string to these cube attributes. More... | |
void | setAttributes (const FileName &fileName) |
Replaces the current attributes with the attributes in the given file name. More... | |
Protected Member Functions | |
QStringList | attributeList (bool(CubeAttributeOutput ::*tester)(QString) const) const |
Get a list of attributes that the tester returns true on. More... | |
void | setAttribute (QString newValue, bool(CubeAttributeOutput ::*tester)(QString) const) |
Set the attribute(s) for which tester returns true to newValue. More... | |
Private Types | |
enum | RangeType { PropagateRange, RangeSet } |
Output cube range tracker. More... | |
Static Private Member Functions | |
static QString | toString (Cube::Format) |
static QList< bool(CubeAttributeOutput::*)(QString) const > | testers () |
Manipulate and parse attributes of output cube filenames.
This class provides parsing and manipulation of attributes associated with output cube filenames. Output cube filenames can have an attributes of "minimum:maximum", "pixel type", "file format", "byte order", and "label placement"
2003-07-29 Stuart Sides - Separated the input and output attributes into two separated class deriving off a base class, instead of one class for all cases.
2003-10-03 Stuart Sides - Added members HasPixelType. It was needed by the IsisCube so it could do an easy check. Added IsMsb, IsLsb, HasOrder, ByteOrderStr, ByteOrderType, Order and Order. These were needed to allow users to specify a byte order for output cubes.
2004-02-03 Stuart Sides - Refactor for IsisProcess and cube changes
2004-03-03 Stuart Sides - Modified IsisCubeAttributeOutput::Write so min and max don't get written when the pixel type is real.
2012-07-02 Steven Lambright and Stuart Sides - Uses a refactored CubeAttribute parent class now. Updated to match current coding standards. Added the "+External+ attribute. Added safety checks for unrecognized attributes. References #961.
2018-07-27 Kaitlyn Lee - Added unsigned/signed integer handling.
Definition at line 489 of file CubeAttribute.h.
|
private |
Output cube range tracker.
This enumeration and its functions are for the output range of a cube.
Enumerator | |
---|---|
PropagateRange | Propagate the range from an input cube. |
RangeSet | The range has been set. |
Definition at line 580 of file CubeAttribute.h.
Isis::CubeAttributeOutput::CubeAttributeOutput | ( | ) |
Constructs an empty CubeAttributeOutput.
Definition at line 168 of file CubeAttribute.cpp.
Isis::CubeAttributeOutput::CubeAttributeOutput | ( | const FileName & | fileName | ) |
Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter.
The string is parased to obtain any min/max, pixel type, byte order, file format or label placement. Any attribute information that is not valie for an output cube will throw an error.
att | A string containing the file attributes. All characters before the first "+" are assumed to be the filename and are ignored. |
Definition at line 172 of file CubeAttribute.cpp.
Isis::CubeAttributeOutput::~CubeAttributeOutput | ( | ) |
Destroys the object.
Definition at line 177 of file CubeAttribute.cpp.
|
inlineinherited |
Add a single attribute to these attributes.
This attribute should NOT have a '+' in it. For example, if you wanted to add BandSequential to the CubeAttributeOutput class, you could call addAttribute("BSQ") or addAttribute("BandSequential") or any valid deviation of that string. This will preserve existing attributes unless it's of the same type (if Tile was already set, then this will overwrite Tile). If the attribute is unrecognized or ambiguous, then an exception will be thrown.
attribute | The attribute we're adding to the current cube attributes |
Definition at line 194 of file CubeAttribute.h.
|
inlineinherited |
Append the attributes found in the filename to these cube attributes.
This will call addAttribute() for every attribute found in the file name.
fileNameWithAtts | A filename with attributes appended, for example FileName("out.cub+Bsq") |
Definition at line 238 of file CubeAttribute.h.
|
inlineinherited |
Append the attributes in the string to these cube attributes.
This will call addAttribute() for every attribute in the string. The initial "+" is not expected but allowed. This should NOT be called with a file name.
attributesString | A string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real" |
Definition at line 251 of file CubeAttribute.h.
|
inlineinherited |
Append the attributes in the string to these cube attributes.
attributesString | A string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real" |
Definition at line 264 of file CubeAttribute.h.
|
inlineprotectedinherited |
Get a list of attributes that the tester returns true on.
This is helpful for accessing the values of existing attributes. The strings will always be the UPPER CASE version of the attribute, i.e. not Bsq but BSQ. The returned attributes do not contain delimiters.
tester | A method that determines whether the attribute should be returned/is relevant |
Definition at line 296 of file CubeAttribute.h.
Referenced by byteOrder(), fileFormat(), maximum(), minimum(), pixelType(), propagateMinimumMaximum(), and propagatePixelType().
ByteOrder Isis::CubeAttributeOutput::byteOrder | ( | ) | const |
Return the byte order as an Isis::ByteOrder.
Definition at line 471 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), and Isis::IsLsb().
Referenced by byteOrderString(), Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), and Isis::Process::SetOutputCube().
QString Isis::CubeAttributeOutput::byteOrderString | ( | ) | const |
Return the byte order as a string.
Definition at line 485 of file CubeAttribute.cpp.
References byteOrder().
Cube::Format Isis::CubeAttributeOutput::fileFormat | ( | ) | const |
Return the file format an Cube::Format.
Definition at line 283 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Cube::Bsq, and Isis::Cube::Tile.
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), fileFormatString(), and Isis::Process::SetOutputCube().
QString Isis::CubeAttributeOutput::fileFormatString | ( | ) | const |
Return the file format as a string.
Definition at line 299 of file CubeAttribute.cpp.
References fileFormat(), and Isis::CubeAttribute< CubeAttributeOutput >::toString().
double Isis::CubeAttributeOutput::maximum | ( | ) | const |
Return the output cube attribute maximum.
Definition at line 325 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), setMinimum(), and Isis::Process::SetOutputCube().
double Isis::CubeAttributeOutput::minimum | ( | ) | const |
Return the output cube attribute minimum.
Definition at line 310 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), setMaximum(), and Isis::Process::SetOutputCube().
PixelType Isis::CubeAttributeOutput::pixelType | ( | ) | const |
Return the pixel type as an Isis::PixelType.
Definition at line 376 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), and propagatePixelType().
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), and Isis::Process::SetOutputCube().
bool Isis::CubeAttributeOutput::propagateMinimumMaximum | ( | ) | const |
Return true if the min/max are to be propagated from an input cube.
Definition at line 193 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), maximum(), minimum(), Isis::ProcessImport::SetOutputCube(), and Isis::Process::SetOutputCube().
bool Isis::CubeAttributeOutput::propagatePixelType | ( | ) | const |
Return true if the pixel type is to be propagated from an input cube.
Definition at line 181 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().
Referenced by Isis::Cube::copy(), Isis::FileTool::copyCubeDetails(), Isis::Cube::create(), pixelType(), Isis::GuiCubeParameter::SelectAttribute(), Isis::ProcessImport::SetOutputCube(), and Isis::Process::SetOutputCube().
|
inlineprotectedinherited |
Set the attribute(s) for which tester returns true to newValue.
If multiple attributes match (tester returns true on them), only the first one is preserved and it's value becomes newValue. Subsequent matching attributes are removed/deleted. This is done to simplify the resulting attribute string to be minimal with this particular attribute.
newValue | The string to set the attribute to... tester(newValue) really ought to return true. |
tester | A method that determines if an attribute is of the same type of newValue, so that existing attributes can be overwritten. |
Definition at line 321 of file CubeAttribute.h.
Referenced by setByteOrder(), setFileFormat(), setLabelAttachment(), setMaximum(), setMinimum(), and setPixelType().
|
inlineinherited |
Replaces the current attributes with the attributes in the given file name.
This will call addAttribute() for every attribute in the file name.
fileName | A file name with (or without) attributes on the end, for example FileName("out.cub+Bsq") |
Definition at line 278 of file CubeAttribute.h.
void Isis::CubeAttributeOutput::setByteOrder | ( | ByteOrder | order | ) |
Set the order according to the parameter order.
Definition at line 490 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
void Isis::CubeAttributeOutput::setFileFormat | ( | Cube::Format | fmt | ) |
Set the format to the fmt parameter.
Definition at line 304 of file CubeAttribute.cpp.
References Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::Cube::Tile.
void Isis::CubeAttributeOutput::setLabelAttachment | ( | LabelAttachment | attachment | ) |
Set the label attachment type to the parameter value.
Definition at line 411 of file CubeAttribute.cpp.
References Isis::LabelAttachmentName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
void Isis::CubeAttributeOutput::setMaximum | ( | double | max | ) |
Set the output cube attribute maximum.
Definition at line 358 of file CubeAttribute.cpp.
References Isis::IsSpecial(), minimum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().
Referenced by Isis::ProcessImport::SetOutputCube().
void Isis::CubeAttributeOutput::setMinimum | ( | double | min | ) |
Set the output cube attribute minimum.
Definition at line 340 of file CubeAttribute.cpp.
References Isis::IsSpecial(), maximum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().
Referenced by Isis::ProcessImport::SetOutputCube().
void Isis::CubeAttributeOutput::setPixelType | ( | PixelType | type | ) |
Set the pixel type to that given by the parameter.
Definition at line 406 of file CubeAttribute.cpp.
References Isis::PixelTypeName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().
Referenced by Isis::ProcessImport::SetOutputCube().
|
inlineinherited |
Return a string-representation of this cube attributes.
This will typically be exactl the string passed in if you used setAttributes(...). This can be an empty string ("") or if there are attributes then it will be +att1+att2+... The result of this method could be used to re-create this instance.
Definition at line 174 of file CubeAttribute.h.
Referenced by fileFormatString().