Skip to content

Commit

Permalink
Adds initial directory structure for appdata in source and update fro…
Browse files Browse the repository at this point in the history
…m dev (#3724)

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

* Used CK quality for PCK selection in spiceinit (#3716)

* Changed PCK to use CK quality in spiceinit

* Added spiceinit history for change

* 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]>

* Updated kaguyatc2isis to allow ingestion of data provided by JAXA online archive (#3713)

* Updated to allow ingestion of data provided by JAXA online archive

* Listed SLN-L-TC-5-MORNING-MAP-V4.0 as a supported format.

* Added tests + testing data

* Replaced several label parsing tests with cube attribute tests.

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

* Fixes ddd2isis to support updated uvflat files

* Added history comment

* Changed version numbers for 4.1 RC (#3722)

* Add directory structure for appdata in source

Co-authored-by: Jesse Mapel <[email protected]>
Co-authored-by: Stuart Sides <[email protected]>
Co-authored-by: AustinSanders <[email protected]>
Co-authored-by: acpaquette <[email protected]>
  • Loading branch information
5 people authored Mar 3, 2020
1 parent 79e652e commit ce5cd2f
Show file tree
Hide file tree
Showing 35 changed files with 1,021 additions and 323 deletions.
2 changes: 1 addition & 1 deletion isis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(PACKAGE "ISIS")
set(PACKAGE_NAME "USGS ISIS")

# Version number
set(VERSION "4.0.0")
set(VERSION "4.1.0")
set(PACKAGE_VERSION ${VERSION})

# Full name and version number
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added isis/appdata/maps/DELETEME.txt
Empty file.
Empty file.
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
48 changes: 24 additions & 24 deletions isis/src/base/apps/spiceinit/spiceinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

using namespace std;

namespace Isis {
namespace Isis {

void getUserEnteredKernel(UserInterface &ui, const QString &param, Kernel &kernel);
bool tryKernels(Cube *icube, Process &p, UserInterface &ui, Pvl *log,
Expand All @@ -42,16 +42,16 @@ namespace Isis {
* @param ui The Application UI
* @param(out) log The Pvl that attempted kernel sets will be logged to
*/
void spiceinit(UserInterface &ui, Pvl *log) {
void spiceinit(UserInterface &ui, Pvl *log) {
// Open the input cube
Process p;

CubeAttributeInput cai;
Cube *icube = p.SetInputCube(ui.GetFileName("FROM"), cai, ReadWrite);
spiceinit(icube, ui, log);
p.EndProcess();
}


/**
* Spiceinit a Cube
Expand All @@ -76,7 +76,7 @@ namespace Isis {
QString msg = "At least one SPK quality must be selected";
throw IException(IException::User, msg, _FILEINFO_);
}

// Make sure it is not projected
Projection *proj = NULL;
try {
Expand All @@ -92,7 +92,7 @@ namespace Isis {
}

Pvl lab = *icube->label();

// if cube has existing polygon delete it
if (icube->label()->hasObject("Polygon")) {
icube->label()->deleteObject("Polygon");
Expand Down Expand Up @@ -144,15 +144,15 @@ namespace Isis {
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);
iak = baseKernels.instrumentAddendum(lab);
fk = ckKernels.frame(lab);
ck = ckKernels.spacecraftPointing(lab);
spk = spkKernels.spacecraftPosition(lab);

if (ui.GetBoolean("CKNADIR")) {
// Only add nadir if no spacecraft pointing found, so we will set (priority) type to 0.
QStringList nadirCk;
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace Isis {
_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 @@ -209,10 +209,10 @@ namespace Isis {
emptyKernelQueue.push(Kernel());
ck.push_back(emptyKernelQueue);
}

// 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 @@ -236,13 +236,13 @@ namespace Isis {
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 @@ -267,14 +267,14 @@ namespace Isis {
}

/**
* 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(UserInterface &ui, const QString &param, Kernel &kernel) {
if (ui.WasEntered(param)) {
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace Isis {
// Get rid of old keywords from previously inited cubes
if (currentKernels.hasKeyword("Source"))
currentKernels.deleteKeyword("Source");

if (currentKernels.hasKeyword("SpacecraftPointing"))
currentKernels.deleteKeyword("SpacecraftPointing");

Expand Down Expand Up @@ -450,7 +450,7 @@ namespace Isis {
try {
cam = icube->camera();
currentKernels = icube->group("Kernels");

PvlKeyword source("Source");

if (cam->isUsingAle()) {
Expand All @@ -461,11 +461,11 @@ namespace Isis {
}

currentKernels += source;
icube->putGroup(currentKernels);
icube->putGroup(currentKernels);
if (log){
log->addGroup(currentKernels);
}
}

}
catch(IException &e) {
Pvl errPvl = e.toPvl();
Expand Down Expand Up @@ -665,7 +665,7 @@ namespace Isis {
continue;
}
}

if (log) {
log->addGroup(logGrp);
}
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


Loading

0 comments on commit ce5cd2f

Please sign in to comment.