-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thm2isis now uses out attrs and converted to func #4504
Conversation
CubeAttributeOutput outAttr = ui.GetOutputAttribute("to"); | ||
|
||
if((QString)inst["InstrumentId"] == "THEMIS_VIS") { | ||
Cube *even = new Cube(); | ||
Cube *odd = new Cube(); | ||
|
||
even->setDimensions(p.Samples(), p.Lines(), p.Bands()); | ||
odd->setDimensions(p.Samples(), p.Lines(), p.Bands()); | ||
|
||
// even->setPixelType(Isis::Real); | ||
// odd->setPixelType(Isis::Real); | ||
|
||
QString evenFile = outFile.path() + "/" + outFile.baseName() + ".even.cub"; | ||
QString oddFile = outFile.path() + "/" + outFile.baseName() + ".odd.cub"; | ||
|
||
even->create(evenFile, outAttr); | ||
odd->create(oddFile, outAttr); | ||
|
||
frameletLines = 192 / ((int)inst["SpatialSumming"]); | ||
|
||
outputCubes.push_back(odd); | ||
outputCubes.push_back(even); | ||
} | ||
else { | ||
Cube *outCube = new Cube(); | ||
outCube->setDimensions(p.Samples(), p.Lines(), p.Bands()); | ||
|
||
// outCube->setPixelType(Isis::Real); | ||
|
||
outCube->create(outFile.expanded(), outAttr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically the bug fix (hard to find when you also do an app convert). Output attributes passed into Cube::create
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good! Did you try to replicate the test that I mentioned in the issue?
@acpaquette yeah, I ran the images in the test folders with different pixel types locally and they all worked as expected. |
From writing the GTests for the output attributes. Something about making the pixel type to anything other than
Is this a bug in using output attributes with PDS ingestion apps? The crux of the problem is how the offsets and base are being initiated
I'll keep looking into it but throwing it out in case anyone has an idea of what might be happening |
@Kelvinrr Have you tried with a +8 or +32 and seeing what the output looks like? I agree that this may be an ingestion app problem but I figure the cube attributes "should just propogate" but I don't know |
+8 is also garbage, +32 is fine as +32 = Real. +8 or +16 without setting min and max as well through the output attributes basically gives 0 valid pixels. |
Maybe this wasn't a bug and is actually how the images need to be ingested? The only other thing I can think to try is to ingest some other PDS image, setting the output bit type and seeing what happens |
// Pixels Group | ||
EXPECT_EQ(PixelTypeName(evenCube.pixelType()).toStdString(), "UnsignedByte"); | ||
EXPECT_EQ(ByteOrderName(evenCube.byteOrder()).toStdString(), "Msb"); | ||
EXPECT_DOUBLE_EQ(evenCube.base(), -0.0039525691699605001); | ||
EXPECT_DOUBLE_EQ(evenCube.multiplier(), 0.0039525691699605001); | ||
|
||
std::unique_ptr<Histogram> hist (evenCube.histogram()); | ||
|
||
EXPECT_NEAR(hist->Minimum(), 0.0, 0.0001); | ||
EXPECT_NEAR(hist->Maximum(), 0.0, 0.0001); | ||
EXPECT_NEAR(hist->Average(), 0.0, 0.0001); | ||
EXPECT_NEAR(hist->Sum(), 0.0, .00001); | ||
EXPECT_EQ(hist->ValidPixels(), 188100); | ||
EXPECT_NEAR(hist->StandardDeviation(), 0, .00001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see it here, I set a min and max to avoid all invalid pixels and ended up with 0 pixels only.
Looks like the test image wasn't cropped potentially? |
@acpaquette Sorry, missed that comment on different data sets. I tried 3 different images so far (mix of vis and infrared) and they all output the same. I don't think there is a way to know min/max programmatically, I can look into the logic of how the output attributes are actually being used because I got a feeling it should be doing that and it's not. I didn't crop the one in there as it's already fairly small at ~5mb, but if that seems to big I can go back to seeing how to make it smaller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good! A few things that could be addressed
#include "ProcessByBrick.h" | ||
#include "Brick.h" | ||
#include "OriginalLabel.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this need an #include "thm2isis.h"
?
TEST_F(TempTestingFiles, FunctionalTestThm2isisOutAttributes) { | ||
// tempDir exists if the fixture subclasses TempTestingFiles, which most do | ||
QString outCubeFileName = tempDir.path() + "/test.cub+msb+8bit+0.0012:0.0013"; | ||
QVector<QString> args = {"from=data/thm2isis/V00821003RDR.QUB", "to="+outCubeFileName}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we crop this cube for consistance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
* thm2isis now uses out attrs and converted to func * removed commented code that manually set pixel type * added gtests * better params * IR test added * reordered things * cropped images * cropped image for outattr tests too
* Change measure log name to be case-insensitive (#4441) * Lrowac2pds App and Test Conversion (#4429) * lrowac2pds app conversion * Lrowac2pds App and Test Conversion * Set global variables to static to prevent test failures * Gui Parameters now right aligned (#4507) * Findgaps gtests (#4422) * first few test cases, needs work * two working tests * add test for correlation tolerance * improve test data creation code * updated mapcam makefile (#4498) * merge conflict with 561e21e in changelog * improve grid extend test case (#4506) * fix sample_bits pvl output (#4500) * map2map conversion (#4435) * added code for two tests * test modifications * changed crop input and ouput function * fixed last two tests * added more tests * converted map2map * added conversion code for map2map * bring crop tests up to date with dev * added modifications to map2map and tests * final changes for map2map tests * Converted app and default test * Converted tests * Added histograms to tests. * Rename FunctionalTestsMap2Map.cpp to FunctionalTestsMap2map.cpp Co-authored-by: Amy Stamile <[email protected]> Co-authored-by: Amy Stamile <[email protected]> * thm2isis now uses out attrs and converted to func (#4504) * thm2isis now uses out attrs and converted to func * removed commented code that manually set pixel type * added gtests * better params * IR test added * reordered things * cropped images * cropped image for outattr tests too * added missing changelog lines * Fix caminfo uselabel SegFault (#4402) * conditionally reopen cube to prevent segfault * relocate cube close * version ticks * change log merge conflict * added 5.0.1 bugfixes under a 5.0.1 header in CHANGELOG * removed unreleased portion of the changelog Co-authored-by: Jesse Mapel <[email protected]> Co-authored-by: Amy Stamile <[email protected]> Co-authored-by: Tim Giroux <[email protected]> Co-authored-by: robotprogrammer22 <[email protected]> Co-authored-by: Amy Stamile <[email protected]>
Description
thm2isis now applies output attributes and converted to a func. Still needs gtests.
Related Issue
#4213
Motivation and Context
Before this bug fix, thm2isis would no honor output cube attributes
How Has This Been Tested?
original tests passing.
Screenshots (if appropriate):
Types of changes
Checklist:
Licensing
This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words: