Loading isis/src/base/apps/mask/mask.cpp +34 −17 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #include "ProcessByLine.h" #include "SpecialPixel.h" #include "IException.h" #include "SessionLog.h" #include "Pvl.h" using namespace std; using namespace Isis; Loading @@ -15,14 +17,16 @@ void mask(vector<Buffer *> &in, enum which_special {NONE, NULLP, ALL} spixels; enum range_preserve {INSIDE, OUTSIDE} preserve; double minimum, maximum; bool masked; double g_minimum, g_maximum; bool g_masked; double g_pixelsMasked; void IsisMain() { // We will be processing by line ProcessByLine p; masked = false; g_masked = false; g_pixelsMasked = 0; // Setup the input and output cubes UserInterface &ui = Application::GetUserInterface(); Loading @@ -43,10 +47,10 @@ void IsisMain() { p.SetOutputCube("TO"); // Get min/max info minimum = VALID_MIN8; maximum = VALID_MAX8; if(ui.WasEntered("MINIMUM")) minimum = ui.GetDouble("MINIMUM"); if(ui.WasEntered("MAXIMUM")) maximum = ui.GetDouble("MAXIMUM"); g_minimum = VALID_MIN8; g_maximum = VALID_MAX8; if(ui.WasEntered("MINIMUM")) g_minimum = ui.GetDouble("MINIMUM"); if(ui.WasEntered("MAXIMUM")) g_maximum = ui.GetDouble("MAXIMUM"); // Will we preserve inside or outside of min/max range preserve = INSIDE; Loading @@ -65,13 +69,23 @@ void IsisMain() { p.StartProcess(mask); p.EndProcess(); // Report if no masking occurred if(!masked) { QString message = "No mask was performed-the output file is the same as "; message += "the input file."; throw IException(IException::User, message, _FILEINFO_); // Add an entry to print.prt to indicate whether this file was masked. // Pvl maskedPvl; PvlGroup results("Results"); if(g_masked == true) { results += PvlKeyword("PixelsMasked", toString(g_pixelsMasked)); } else { PvlKeyword pm("PixelsMasked", toString(g_pixelsMasked)); pm.addComment( "No pixels were masked for this image"); results += pm; } // maskedPvl.addGroup(results); Application::Log(results); } // Line processing routine Loading @@ -87,11 +101,13 @@ void mask(vector<Buffer *> &in, if(IsSpecial(mask[i])) { if(spixels == ALL) { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } else if(spixels == NULLP && mask[i] == NULL8) { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } else { outp[i] = inp[i]; Loading @@ -99,13 +115,14 @@ void mask(vector<Buffer *> &in, } else { if(preserve == INSIDE && (mask[i] >= minimum && mask[i] <= maximum)) if(preserve == INSIDE && (mask[i] >= g_minimum && mask[i] <= g_maximum)) outp[i] = inp[i]; else if(preserve == OUTSIDE && (mask[i] < minimum || mask[i] > maximum)) else if(preserve == OUTSIDE && (mask[i] < g_minimum || mask[i] > g_maximum)) outp[i] = inp[i]; else { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } } } Loading isis/src/base/apps/mask/mask.xml +11 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,12 @@ parameters.</li> </ol> </p> <p> Note that due to the way masking works, an output file will be created regardless of whether or not the mask was applied to the corresponding input. To determine the degree to which an input cube was masked, look for the "PixelsMasked" group in print.prt . If no pixels were masked, there will be a comment present which reads "No pixels were masked in this image". </p> </description> <history> <change name="Kris Becker" date="1990-12-03"> Loading Loading @@ -65,6 +71,11 @@ Made default MASK parameter work when FROM cube has multiple bands. Updated Documentation. Added examples. Fixes #1871. </change> <change name="Andrew Stebenne" date="2015-03-22"> Specify that an output cube will be created whether or not the mask was applied. Add an output group to print.prt to indicate how many pixels were masked in the output image. Implements recommendation #898. </change> </history> <category> <categoryItem>Trim and Mask</categoryItem> Loading isis/src/base/apps/mask/tsts/all/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,4 @@ commands: maximum=1000 \ preserve=outside \ spixels=all > /dev/null; isis/src/base/apps/mask/tsts/none/Makefile +1 −1 File changed.Contains only whitespace changes. Show changes Loading
isis/src/base/apps/mask/mask.cpp +34 −17 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #include "ProcessByLine.h" #include "SpecialPixel.h" #include "IException.h" #include "SessionLog.h" #include "Pvl.h" using namespace std; using namespace Isis; Loading @@ -15,14 +17,16 @@ void mask(vector<Buffer *> &in, enum which_special {NONE, NULLP, ALL} spixels; enum range_preserve {INSIDE, OUTSIDE} preserve; double minimum, maximum; bool masked; double g_minimum, g_maximum; bool g_masked; double g_pixelsMasked; void IsisMain() { // We will be processing by line ProcessByLine p; masked = false; g_masked = false; g_pixelsMasked = 0; // Setup the input and output cubes UserInterface &ui = Application::GetUserInterface(); Loading @@ -43,10 +47,10 @@ void IsisMain() { p.SetOutputCube("TO"); // Get min/max info minimum = VALID_MIN8; maximum = VALID_MAX8; if(ui.WasEntered("MINIMUM")) minimum = ui.GetDouble("MINIMUM"); if(ui.WasEntered("MAXIMUM")) maximum = ui.GetDouble("MAXIMUM"); g_minimum = VALID_MIN8; g_maximum = VALID_MAX8; if(ui.WasEntered("MINIMUM")) g_minimum = ui.GetDouble("MINIMUM"); if(ui.WasEntered("MAXIMUM")) g_maximum = ui.GetDouble("MAXIMUM"); // Will we preserve inside or outside of min/max range preserve = INSIDE; Loading @@ -65,13 +69,23 @@ void IsisMain() { p.StartProcess(mask); p.EndProcess(); // Report if no masking occurred if(!masked) { QString message = "No mask was performed-the output file is the same as "; message += "the input file."; throw IException(IException::User, message, _FILEINFO_); // Add an entry to print.prt to indicate whether this file was masked. // Pvl maskedPvl; PvlGroup results("Results"); if(g_masked == true) { results += PvlKeyword("PixelsMasked", toString(g_pixelsMasked)); } else { PvlKeyword pm("PixelsMasked", toString(g_pixelsMasked)); pm.addComment( "No pixels were masked for this image"); results += pm; } // maskedPvl.addGroup(results); Application::Log(results); } // Line processing routine Loading @@ -87,11 +101,13 @@ void mask(vector<Buffer *> &in, if(IsSpecial(mask[i])) { if(spixels == ALL) { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } else if(spixels == NULLP && mask[i] == NULL8) { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } else { outp[i] = inp[i]; Loading @@ -99,13 +115,14 @@ void mask(vector<Buffer *> &in, } else { if(preserve == INSIDE && (mask[i] >= minimum && mask[i] <= maximum)) if(preserve == INSIDE && (mask[i] >= g_minimum && mask[i] <= g_maximum)) outp[i] = inp[i]; else if(preserve == OUTSIDE && (mask[i] < minimum || mask[i] > maximum)) else if(preserve == OUTSIDE && (mask[i] < g_minimum || mask[i] > g_maximum)) outp[i] = inp[i]; else { outp[i] = NULL8; masked = true; g_masked = true; g_pixelsMasked++; } } } Loading
isis/src/base/apps/mask/mask.xml +11 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,12 @@ parameters.</li> </ol> </p> <p> Note that due to the way masking works, an output file will be created regardless of whether or not the mask was applied to the corresponding input. To determine the degree to which an input cube was masked, look for the "PixelsMasked" group in print.prt . If no pixels were masked, there will be a comment present which reads "No pixels were masked in this image". </p> </description> <history> <change name="Kris Becker" date="1990-12-03"> Loading Loading @@ -65,6 +71,11 @@ Made default MASK parameter work when FROM cube has multiple bands. Updated Documentation. Added examples. Fixes #1871. </change> <change name="Andrew Stebenne" date="2015-03-22"> Specify that an output cube will be created whether or not the mask was applied. Add an output group to print.prt to indicate how many pixels were masked in the output image. Implements recommendation #898. </change> </history> <category> <categoryItem>Trim and Mask</categoryItem> Loading
isis/src/base/apps/mask/tsts/all/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -10,3 +10,4 @@ commands: maximum=1000 \ preserve=outside \ spixels=all > /dev/null;
isis/src/base/apps/mask/tsts/none/Makefile +1 −1 File changed.Contains only whitespace changes. Show changes