Skip to content

Commit

Permalink
Port changes from Dev to 3.X for 3.11 release (#3723)
Browse files Browse the repository at this point in the history
* Fix for QMOS not updating lat/lon ranges correctly.  (#3714)

* qqqqqqmoooooosssssss

* added doc string

* Hand ported #3716 from dev to 3.10

* Adds the ability to save and restore a greyscale stretch to/from a Cube (#3717)

* Update meta.yaml to rename conda package to isis from isis3

* Initial stretch attempt

* Now will write a single stretch with a name and type to the cube

* Stretch updated to inherit from Blob, re-loading a saved stretch works but only if Linear right now

* Clean up Stretch class

* Completely move stretchTypes into stretch class, and some minor cleanup

* Fixed combo-box not updating bug and more cleanup

* Further cleanup of propagated earlier changes with types and names being removed from unnecessary classes

* Removed added unneeded member variables from StretchType

* Cleanup StretchTool class

* Update enter-text dialogs to drop down selection options

* Wrapped some long strings

* Initial commit to address most of review comments

* Removed buttons in case of RGB stretch and add a 'Color' PvlKeyword to Stretch output

Co-authored-by: Stuart Sides <[email protected]>

* Pinned opencv

* Ported #3713 to ISIS3

* Fixes ddd2isis to support updated uvflat files (#3719)

* Fixes ddd2isis to support updated uvflat files

* Added history comment

* Ticked to 3.11_RC1

* changed kaguyatc2isis outputcube call

Co-authored-by: Kelvin Rodriguez <[email protected]>
Co-authored-by: Kristin <[email protected]>
Co-authored-by: Stuart Sides <[email protected]>
Co-authored-by: acpaquette <[email protected]>
  • Loading branch information
5 people authored Mar 3, 2020
1 parent 2c9fbf1 commit f657c42
Show file tree
Hide file tree
Showing 29 changed files with 549 additions and 75 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies:
- ninja==1.7.2
- conda-forge/label/gcc7::nn
- openblas==0.2.19
- opencv
- opencv==3.2.0
- openssl==1.0.2n
- pcl==1.8.1
- pip==9.0.1
Expand Down
2 changes: 1 addition & 1 deletion environment_gcc4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- ninja==1.7.2
- nn==1.86.0
- openblas==0.2.19
- opencv
- opencv==3.2.0
- openssl==1.0.2n
- pcl==1.8.1
- pip==9.0.1
Expand Down
4 changes: 2 additions & 2 deletions isis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ set(PACKAGE "ISIS")
set(PACKAGE_NAME "USGS ISIS")

# Version number
set(VERSION "3.10.0")
set(VERSION "3.11.0")
set(PACKAGE_VERSION ${VERSION})

# Full name and version number
set(PACKAGE_STRING "${PACKAGE_NAME} ${VERSION}")

# Other release information
string(TIMESTAMP VERSION_DATE "%Y-%m-%d" UTC)
set(RELEASE_STAGE "stable") # (alpha, beta, stable)
set(RELEASE_STAGE "beta") # (alpha, beta, stable)

# Define to the address where bug reports for this package should be sent.
set(PACKAGE_BUGREPORT "https://github.com/USGS-Astrogeology/ISIS3/issues")
Expand Down
4 changes: 4 additions & 0 deletions isis/src/base/apps/ddd2isis/ddd2isis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
bands. Removed the internal default of the output parameter set to None so
that an output file is now requried. Fixes #703.
</change>
<change name="Adam Paquette" date="2020-02-28">
Updated the dataTypes QMap with a new mapping (32, 4) to handle ingesting
the updated uvflat files from malin. Fixes #3715.
</change>
</history>

<category>
Expand Down
7 changes: 7 additions & 0 deletions isis/src/base/apps/ddd2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void IsisMain() {
dataTypes.insert(1450903360, 8);
dataTypes.insert(8, 1);
dataTypes.insert(16, 2);
dataTypes.insert(32, 4);
dataTypes.insert(48, 2);

// Read bytes 16-19 to get the bit type
Expand Down Expand Up @@ -130,6 +131,12 @@ void IsisMain() {
nOffset = 1024;
}

if (dataTypeBytes == 0) {
string msg = "The value totalBandBits [" + to_string(totalBandBits) + "] does not map " +
"to any byte size in the dataTypes table.";
throw IException(IException::Programmer, msg, _FILEINFO_);
}

fin.close();

PvlGroup results("FileInfo");
Expand Down
24 changes: 24 additions & 0 deletions isis/src/base/apps/ddd2isis/tsts/badBandBit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
APPNAME = ddd2isis

include $(ISISROOT)/make/isismake.tsts

commands:
# TEST: Throws an error when trying to open the file
if [ `$(APPNAME) \
FROM=$(INPUT)/bad_flat.ddd \
TO=$(OUTPUT)/bad_flat.cub \
2> $(OUTPUT)/temp.txt > /dev/null` ]; \
then true; \
fi;
# TEST: Throws an error when trying to read from a cub instead of ddd
if [ `$(APPNAME) \
FROM=$(INPUT)/bad_flat.cub \
TO=$(OUTPUT)/bad_flat.cub \
2>> $(OUTPUT)/temp.txt > /dev/null` ]; \
then true; \
fi;
# Removes input file path up until input
$(SED) 's+\[.*/input+[input+' $(OUTPUT)/temp.txt > $(OUTPUT)/errorTruth.txt;
$(RM) $(OUTPUT)/temp.txt
24 changes: 12 additions & 12 deletions isis/src/base/apps/spiceinit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void IsisMain() {
Kernel lk, pck, targetSpk, fk, ik, sclk, spk, iak, dem, exk;
QList< priority_queue<Kernel> > ck;
lk = baseKernels.leapSecond(lab);
pck = baseKernels.targetAttitudeShape(lab);
pck = ckKernels.targetAttitudeShape(lab);
targetSpk = baseKernels.targetPosition(lab);
ik = baseKernels.instrument(lab);
sclk = baseKernels.spacecraftClock(lab);
Expand Down Expand Up @@ -175,7 +175,7 @@ void IsisMain() {
_FILEINFO_);
}
else if (ui.WasEntered("CK")) {
// if user entered ck
// if user entered ck
// empty ck queue list found in system
while (ck.size()) {
ck.pop_back();
Expand All @@ -189,7 +189,7 @@ void IsisMain() {

// while the first queue is not empty, loop through it until tryKernels() succeeds
while (ck.at(0).size() != 0 && !kernelSuccess) {
// create an empty kernel
// create an empty kernel
Kernel realCkKernel;
QStringList ckKernelList;

Expand All @@ -213,13 +213,13 @@ void IsisMain() {
Kernel topPriority = ck.at(i).top();
ckKernelList.append(topPriority.kernels());
// set the type to equal the type of the to priority of the first
//queue
realCkKernel.setType(topPriority.type());
//queue
realCkKernel.setType(topPriority.type());
}
}

}
// pop the top priority ck off only the first queue so that the next
// pop the top priority ck off only the first queue so that the next
// iteration will test the next highest priority of the first queue with
// the top priority of each of the other queues.
ck[0].pop();
Expand All @@ -244,14 +244,14 @@ void IsisMain() {
}

/**
* If the user entered the parameter param, then kernel is replaced by the
* If the user entered the parameter param, then kernel is replaced by the
* user's values and quality is reset to 0. Otherwise, the kernels loaded by the
* KernelDb class will be kept.
*
* @param param Name of the kernel input parameter
*
* @param kernel Kernel object to be overwritten if the specified user parameter
* was entered.
*
* @param kernel Kernel object to be overwritten if the specified user parameter
* was entered.
*/
void getUserEnteredKernel(const QString &param, Kernel &kernel) {
UserInterface &ui = Application::GetUserInterface();
Expand All @@ -264,10 +264,10 @@ void getUserEnteredKernel(const QString &param, Kernel &kernel) {
}
}

/**
/**
* This fuction now also adds any ShapeModel information specified in a
* preferences file to the Kernels group.
*/
*/
bool tryKernels(Cube *icube, Process &p,
Kernel lk, Kernel pck,
Kernel targetSpk, Kernel ck,
Expand Down
17 changes: 11 additions & 6 deletions isis/src/base/apps/spiceinit/spiceinit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
not have their paths expanded. This is to allow variables like $msg/ to work correctly.
</p>
<p>
The spiceinit program will also add the RayTraceEngine, OnError, and Tolerance keywords to the Kernels
group if specified in the IsisPreferences file. If included, these keywords specify the ray-tracing engine to use and how to use it for shapemodels.
Please see the IsisPreferences file for more details.
The spiceinit program will also add the RayTraceEngine, OnError, and Tolerance keywords to the Kernels
group if specified in the IsisPreferences file. If included, these keywords specify the ray-tracing engine to use and how to use it for shapemodels.
Please see the IsisPreferences file for more details.

</p>
<p><b>Troubleshooting:</b> If spiceinit is failing with the error
Expand Down Expand Up @@ -279,17 +279,22 @@
</change>
<change name="Kristin Berry" date="2017-06-06">
Updated spiceinit to retain ShapeModel-related keywords set by the ShapeModelFactory and add them to the kernel
group. Like other keywords in the kernels group, if they are present at the beginning of a spiceinit run (if we are re-spiceiniting)
they are removed.
group. Like other keywords in the kernels group, if they are present at the beginning of a spiceinit run (if we are re-spiceiniting)
they are removed.
</change>
<change name="Kristin Berry" date="2017-08-06">
Updated spiceinit to remove code dealing with the CubeSupported Pvl Keyword, from the ShapeModel group in the IsisPreferences file,
Updated spiceinit to remove code dealing with the CubeSupported Pvl Keyword, from the ShapeModel group in the IsisPreferences file,
which has been removed.
</change>
<change name="Christopher Combs" date="2018-01-11">
Made change to camera construction error throw for better reporting on uninstantiated cameras.
Fixes #5163.
</change>
<change name="Jesse Mapel" date="2020-02-26">
Changed PCK selection to use the same qualities as CK so that target body parameters
derived from bundle adjustment can be used alongside CKs derived from bundle adjustment.
Fixes #3669.
</change>
</history>

<oldName>
Expand Down
106 changes: 105 additions & 1 deletion isis/src/base/objs/Stretch/Stretch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Isis {
* Constructs a Stretch object with default mapping of special pixel values to
* themselves.
*/
Stretch::Stretch() {
Stretch::Stretch() : Blob("ImageStretch", "Stretch") {
p_null = Isis::NULL8;
p_lis = Isis::LOW_INSTR_SAT8;
p_lrs = Isis::LOW_REPR_SAT8;
Expand All @@ -47,8 +47,29 @@ namespace Isis {
p_minimum = p_lrs;
p_maximum = p_hrs;
p_pairs = 0;
p_type = "None";
}


/**
* Constructs a Stretch object with default mapping of special pixel values to
* themselves and a provided name.
*
* @param name Name to use for Stretch
*/
Stretch::Stretch(QString name) : Blob(name, "Stretch") {
p_null = Isis::NULL8;
p_lis = Isis::LOW_INSTR_SAT8;
p_lrs = Isis::LOW_REPR_SAT8;
p_his = Isis::HIGH_INSTR_SAT8;
p_hrs = Isis::HIGH_REPR_SAT8;
p_minimum = p_lrs;
p_maximum = p_hrs;
p_pairs = 0;
p_type = "None";
}


/**
* Adds a stretch pair to the list of pairs. Note that all input pairs must be
* in ascending order.
Expand Down Expand Up @@ -410,6 +431,89 @@ namespace Isis {
this->p_output = other.p_output;
}


/**
* Read saved Stretch data from a Cube into this object.
*
* This is called by Blob::Read() and is the actual data reading function
* ultimately called when running something like cube->read(stretch);
*
* @param is input stream containing the saved Stretch information
*/
void Stretch::ReadData(std::istream &is) {
// Set the Stretch Type
p_type = p_blobPvl["StretchType"][0];

// Read in the Stretch Pairs
streampos sbyte = p_startByte - 1;
is.seekg(sbyte, std::ios::beg);
if (!is.good()) {
QString msg = "Error preparing to read data from " + p_type +
" [" + p_blobName + "]";
throw IException(IException::Io, msg, _FILEINFO_);
}

char *buf = new char[p_nbytes+1];
memset(buf, 0, p_nbytes + 1);

is.read(buf, p_nbytes);

// Read buffer data into a QString so we can call Parse()
std::string stringFromBuffer(buf);
QString qStringFromBuffer = QString::fromStdString(stringFromBuffer);
Parse(qStringFromBuffer);

delete [] buf;

if (!is.good()) {
QString msg = "Error reading data from " + p_type + " [" +
p_blobName + "]";
throw IException(IException::Io, msg, _FILEINFO_);
}
}


/**
* Get the Type of Stretch. This is only used by the AdvancedStretchTool.
*
* @return QString Type of Stretch.
*/
QString Stretch::getType(){
return p_type;
}


/**
* Set the Type of Stretch. This is only used by the AdvancedStretchTool.
*
* @param stretchType The type of stretch.
*/
void Stretch::setType(QString stretchType){
// check to see if valid input
p_type = stretchType;
}


/**
* Initializes for writing stretch to cube blob
*/
void Stretch::WriteInit() {
p_nbytes = Text().toStdString().size();
}


/**
* Writes the stretch information to a cube.
*
* This is called by Blob::write() and is ultimately the function
* called when running something like cube->write(stretch);
*
* @param os output stream to write the stretch data to.
*/
void Stretch::WriteData(std::fstream &os) {
os.write(Text().toStdString().c_str(), p_nbytes);
}

} // end namespace isis


17 changes: 15 additions & 2 deletions isis/src/base/objs/Stretch/Stretch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <string>
#include "Pvl.h"
#include "Histogram.h"
#include "Blob.h"

namespace Isis {
/**
Expand Down Expand Up @@ -67,9 +68,10 @@ namespace Isis {
* Created second Parse method for handling pairs where the
* input side is a perentage. Fixed Input and Output getters
* to check both sides of boundry condition for valid data
*
* @history 2020-02-27 Kristin Berry - Updated to inherit from Blob so Stretches can be
* saved and restored from cubes.
*/
class Stretch {
class Stretch : public Isis::Blob {
private:
std::vector<double> p_input; //!< Array for input side of stretch pairs
std::vector<double> p_output; //!< Array for output side of stretch pairs
Expand All @@ -88,10 +90,13 @@ namespace Isis {
double p_minimum; //!<By default this value is set to p_lrs
double p_maximum; //!<By default this value is set to p_hrs

QString p_type; //! Type of stretch. This is only currently used in the AdvancedStretchTool.

std::pair<double, double> NextPair(QString &pairs);

public:
Stretch();
Stretch(QString name);

//! Destroys the Stretch object
~Stretch() {};
Expand Down Expand Up @@ -177,6 +182,9 @@ namespace Isis {
return p_pairs;
};

QString getType();
void setType(QString type);

double Input(const int index) const;
double Output(const int index) const;

Expand All @@ -188,6 +196,11 @@ namespace Isis {
};

void CopyPairs(const Stretch &other);

protected:
void WriteInit();
void ReadData(std::istream &is);
void WriteData(std::fstream &os);
};
};

Expand Down
Loading

0 comments on commit f657c42

Please sign in to comment.