Loading isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp +30 −2 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp: 30 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -210,6 +210,7 @@ namespace Isis { double elat = -DBL_MAX; double slon = DBL_MAX; double elon = -DBL_MAX; bool latlonflag = true; TProjection *proj = NULL; Loading Loading @@ -249,6 +250,11 @@ namespace Isis { if (x > xmax) xmax = x; if (y > ymax) ymax = y; if (projNew->MinimumLatitude() == 0.0 && projNew->MaximumLatitude() == 0.0 && projNew->MinimumLongitude() == 0.0 && projNew->MaximumLongitude() == 0.0) { latlonflag = false; } slat = min(slat, projNew->MinimumLatitude()); elat = max(elat, projNew->MaximumLatitude()); slon = min(slon, projNew->MinimumLongitude()); Loading @@ -263,7 +269,7 @@ namespace Isis { if (proj) delete proj; return SetOutputCube(propagationCubes[0].toString(), xmin, xmax, ymin, ymax, slat, elat, slon, elon, bands, oAtt, mosaicFile); slat, elat, slon, elon, bands, oAtt, mosaicFile, latlonflag); } Loading Loading @@ -357,10 +363,20 @@ namespace Isis { Pvl label; label.read(propagationCubes[0].toString()); PvlGroup mGroup = label.findGroup("Mapping", Pvl::Traverse); // All mosaicking programs use only the upper left x and y to determine where to // place an image into a mosaic. For clarity purposes, the mosaic programs do // not use lat/lon ranges for anything except creating the mosaic. By specifying // the lat/lon range of the mosaic, we compute the upper left x/y of the mosaic. // All map projected cubes must have an upper left x/y and do not require a lat/lon // range. If the current values for the latitude and longitude range are out of // order or equal, then we don't write them to the labels. if (slat < elat && slon < elon) { mGroup.addKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); } if (mGroup.hasKeyword("UpperLeftCornerX")) mGroup.deleteKeyword("UpperLeftCornerX"); Loading Loading @@ -498,16 +514,28 @@ namespace Isis { Isis::Cube *ProcessMapMosaic::SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, CubeAttributeOutput &oAtt, const QString &mosaicFile) { CubeAttributeOutput &oAtt, const QString &mosaicFile, bool latlonflag) { Pvl fileLab(inputFile); PvlGroup &mapping = fileLab.findGroup("Mapping", Pvl::Traverse); mapping["UpperLeftCornerX"] = toString(xmin); mapping["UpperLeftCornerY"] = toString(ymax); // All mosaicking programs use only the upper left x and y to determine where to // place an image into a mosaic. For clarity purposes, the mosaic programs do // not use lat/lon ranges for anything except creating the mosaic. By specifying // the lat/lon range of the mosaic, we compute the upper left x/y of the mosaic. // All map projected cubes must have an upper left x/y and do not require a lat/lon // range. If the current values for the latitude and longitude range are out of // order or equal, then we don't write them to the labels. if (latlonflag) { if (slat < elat && slon < elon) { mapping.addKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); } } Projection *firstProj = ProjectionFactory::CreateFromCube(fileLab); int samps = (int)(ceil(firstProj->ToWorldX(xmax) - firstProj->ToWorldX(xmin)) + 0.5); Loading isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h +7 −1 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -85,6 +85,11 @@ namespace Isis { * @history 2013-11-14 Kimberly Oyama - Modified StartProcess() to account for a negative x * or y from the projection. These x and y values are used to * calculate the outline and outsample. Fixes #1736. * @history 2013-12-27 Janet Barrett - Added additional latlonflag parameter to the * SetOutputCube method so that valid lat/lon values are checked * for in the input files that make up a mosaic. This change was * needed to handle input files that are missing the min/max lat/lon * keywords (such as those that were cropped). Fixes #1500. * * @todo 2005-02-11 Stuart Sides - add coded example and implementation * example to class documentation Loading Loading @@ -119,7 +124,8 @@ namespace Isis { Isis::Cube *SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, CubeAttributeOutput &oAtt, const QString &mosaicFile); CubeAttributeOutput &oAtt, const QString &mosaicFile, bool latlonflag=true); Isis::Cube *RingsSetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, Loading isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.truth +51 −14 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.truth: 51 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -11,10 +11,7 @@ unittest: Mosaicking unitTest2.cub Mosaic label: Object = IsisCube Object = Core StartByte = 65537 Format = Tile TileSamples = 128 TileLines = 128 Group = Dimensions Samples = 124 Loading @@ -24,7 +21,6 @@ Object = IsisCube Group = Pixels Type = UnsignedByte ByteOrder = Lsb Base = 0.0 Multiplier = 1.0 End_Group Loading @@ -51,13 +47,10 @@ Object = IsisCube End_Object Object = Label Bytes = 65536 End_Object Object = History Name = IsisCube StartByte = 81921 Bytes = 3026 End_Object End Testing Mosaic 2 Loading @@ -72,10 +65,7 @@ unittest: Mosaicking unitTest2.cub Mosaic label: Object = IsisCube Object = Core StartByte = 65537 Format = Tile TileSamples = 128 TileLines = 128 Group = Dimensions Samples = 248 Loading @@ -85,7 +75,6 @@ Object = IsisCube Group = Pixels Type = UnsignedByte ByteOrder = Lsb Base = 0.0 Multiplier = 1.0 End_Group Loading @@ -112,13 +101,10 @@ Object = IsisCube End_Object Object = Label Bytes = 65536 End_Object Object = History Name = IsisCube StartByte = 131073 Bytes = 3026 End_Object End Mosaic Data: -1.79769e+308 -1.79769e+308 -1.79769e+308 Loading Loading @@ -566,3 +552,54 @@ Object = OriginalLabel Name = IsisCube End_Object End Testing Mosaic containing cropped image. unittest: Initializing mosaic 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed unittest: Mosaicking unitTest_crop.cub 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed ./unitTest_crop.cub is inside the mosaic unittest: Mosaicking unitTest_nocrop.cub 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed ./unitTest_nocrop.cub is inside the mosaic Mosaic label: Object = IsisCube Object = Core Format = Tile Group = Dimensions Samples = 2215 Lines = 3271 Bands = 1 End_Group Group = Pixels Type = Real Base = 0.0 Multiplier = 1.0 End_Group End_Object Group = Mapping ProjectionName = Sinusoidal CenterLongitude = 227.87092862105 TargetName = Mars EquatorialRadius = 3396190.0 <meters> PolarRadius = 3376200.0 <meters> LatitudeType = Planetocentric LongitudeDirection = PositiveEast LongitudeDomain = 360 UpperLeftCornerX = -475029.8023764 UpperLeftCornerY = 2042714.0507253 PixelResolution = 429.50253379421 <meters/pixel> Scale = 138.00779473796 <pixels/degree> End_Group End_Object Object = Label End_Object Object = History Name = IsisCube End_Object End Loading isis/src/base/objs/ProcessMapMosaic/unitTest.cpp +27 −0 Changes for isis/src/base/objs/ProcessMapMosaic/unitTest.cpp: 27 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -129,7 +129,34 @@ void IsisMain() { remove("./unitTest3.cub"); // Create the temp parent cube FileList cubes_crop; cubes_crop.read("unitTest_crop.lis"); cout << endl << "Testing Mosaic containing cropped image." << endl; ProcessMapMosaic m4; CubeAttributeOutput oAtt3; priority = ProcessMapMosaic::PlaceImagesOnTop; m4.SetBandBinMatch(false); m4.SetOutputCube(cubes_crop, oAtt3, "./unitTest4.cub"); //set priority m4.SetImageOverlay(priority); for(int i = 0; i < cubes_crop.size(); i++) { if(m4.StartProcess(cubes_crop[i].toString())) { cout << cubes_crop[i].toString() << " is inside the mosaic" << endl; } else { cout << cubes_crop[i].toString() << " is outside the mosaic" << endl; } } m4.EndProcess(); cout << "Mosaic label: " << endl; Pvl labels_crop("./unitTest4.cub"); cout << labels_crop << endl; remove("./unitTest4.cub"); } isis/src/base/objs/ProcessMapMosaic/unitTest_crop.lis 0 → 100644 +2 −0 Changes for isis/src/base/objs/ProcessMapMosaic/unitTest_crop.lis: 2 added lines, 0 removed lines. Original line number Diff line number Diff line ./unitTest_crop.cub ./unitTest_nocrop.cub Loading
isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp +30 −2 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.cpp: 30 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -210,6 +210,7 @@ namespace Isis { double elat = -DBL_MAX; double slon = DBL_MAX; double elon = -DBL_MAX; bool latlonflag = true; TProjection *proj = NULL; Loading Loading @@ -249,6 +250,11 @@ namespace Isis { if (x > xmax) xmax = x; if (y > ymax) ymax = y; if (projNew->MinimumLatitude() == 0.0 && projNew->MaximumLatitude() == 0.0 && projNew->MinimumLongitude() == 0.0 && projNew->MaximumLongitude() == 0.0) { latlonflag = false; } slat = min(slat, projNew->MinimumLatitude()); elat = max(elat, projNew->MaximumLatitude()); slon = min(slon, projNew->MinimumLongitude()); Loading @@ -263,7 +269,7 @@ namespace Isis { if (proj) delete proj; return SetOutputCube(propagationCubes[0].toString(), xmin, xmax, ymin, ymax, slat, elat, slon, elon, bands, oAtt, mosaicFile); slat, elat, slon, elon, bands, oAtt, mosaicFile, latlonflag); } Loading Loading @@ -357,10 +363,20 @@ namespace Isis { Pvl label; label.read(propagationCubes[0].toString()); PvlGroup mGroup = label.findGroup("Mapping", Pvl::Traverse); // All mosaicking programs use only the upper left x and y to determine where to // place an image into a mosaic. For clarity purposes, the mosaic programs do // not use lat/lon ranges for anything except creating the mosaic. By specifying // the lat/lon range of the mosaic, we compute the upper left x/y of the mosaic. // All map projected cubes must have an upper left x/y and do not require a lat/lon // range. If the current values for the latitude and longitude range are out of // order or equal, then we don't write them to the labels. if (slat < elat && slon < elon) { mGroup.addKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); mGroup.addKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); } if (mGroup.hasKeyword("UpperLeftCornerX")) mGroup.deleteKeyword("UpperLeftCornerX"); Loading Loading @@ -498,16 +514,28 @@ namespace Isis { Isis::Cube *ProcessMapMosaic::SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, CubeAttributeOutput &oAtt, const QString &mosaicFile) { CubeAttributeOutput &oAtt, const QString &mosaicFile, bool latlonflag) { Pvl fileLab(inputFile); PvlGroup &mapping = fileLab.findGroup("Mapping", Pvl::Traverse); mapping["UpperLeftCornerX"] = toString(xmin); mapping["UpperLeftCornerY"] = toString(ymax); // All mosaicking programs use only the upper left x and y to determine where to // place an image into a mosaic. For clarity purposes, the mosaic programs do // not use lat/lon ranges for anything except creating the mosaic. By specifying // the lat/lon range of the mosaic, we compute the upper left x/y of the mosaic. // All map projected cubes must have an upper left x/y and do not require a lat/lon // range. If the current values for the latitude and longitude range are out of // order or equal, then we don't write them to the labels. if (latlonflag) { if (slat < elat && slon < elon) { mapping.addKeyword(PvlKeyword("MinimumLatitude", toString(slat)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MaximumLatitude", toString(elat)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MinimumLongitude", toString(slon)), Pvl::Replace); mapping.addKeyword(PvlKeyword("MaximumLongitude", toString(elon)), Pvl::Replace); } } Projection *firstProj = ProjectionFactory::CreateFromCube(fileLab); int samps = (int)(ceil(firstProj->ToWorldX(xmax) - firstProj->ToWorldX(xmin)) + 0.5); Loading
isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h +7 −1 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.h: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -85,6 +85,11 @@ namespace Isis { * @history 2013-11-14 Kimberly Oyama - Modified StartProcess() to account for a negative x * or y from the projection. These x and y values are used to * calculate the outline and outsample. Fixes #1736. * @history 2013-12-27 Janet Barrett - Added additional latlonflag parameter to the * SetOutputCube method so that valid lat/lon values are checked * for in the input files that make up a mosaic. This change was * needed to handle input files that are missing the min/max lat/lon * keywords (such as those that were cropped). Fixes #1500. * * @todo 2005-02-11 Stuart Sides - add coded example and implementation * example to class documentation Loading Loading @@ -119,7 +124,8 @@ namespace Isis { Isis::Cube *SetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, double slat, double elat, double slon, double elon, int nbands, CubeAttributeOutput &oAtt, const QString &mosaicFile); CubeAttributeOutput &oAtt, const QString &mosaicFile, bool latlonflag=true); Isis::Cube *RingsSetOutputCube(const QString &inputFile, double xmin, double xmax, double ymin, double ymax, Loading
isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.truth +51 −14 Changes for isis/src/base/objs/ProcessMapMosaic/ProcessMapMosaic.truth: 51 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -11,10 +11,7 @@ unittest: Mosaicking unitTest2.cub Mosaic label: Object = IsisCube Object = Core StartByte = 65537 Format = Tile TileSamples = 128 TileLines = 128 Group = Dimensions Samples = 124 Loading @@ -24,7 +21,6 @@ Object = IsisCube Group = Pixels Type = UnsignedByte ByteOrder = Lsb Base = 0.0 Multiplier = 1.0 End_Group Loading @@ -51,13 +47,10 @@ Object = IsisCube End_Object Object = Label Bytes = 65536 End_Object Object = History Name = IsisCube StartByte = 81921 Bytes = 3026 End_Object End Testing Mosaic 2 Loading @@ -72,10 +65,7 @@ unittest: Mosaicking unitTest2.cub Mosaic label: Object = IsisCube Object = Core StartByte = 65537 Format = Tile TileSamples = 128 TileLines = 128 Group = Dimensions Samples = 248 Loading @@ -85,7 +75,6 @@ Object = IsisCube Group = Pixels Type = UnsignedByte ByteOrder = Lsb Base = 0.0 Multiplier = 1.0 End_Group Loading @@ -112,13 +101,10 @@ Object = IsisCube End_Object Object = Label Bytes = 65536 End_Object Object = History Name = IsisCube StartByte = 131073 Bytes = 3026 End_Object End Mosaic Data: -1.79769e+308 -1.79769e+308 -1.79769e+308 Loading Loading @@ -566,3 +552,54 @@ Object = OriginalLabel Name = IsisCube End_Object End Testing Mosaic containing cropped image. unittest: Initializing mosaic 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed unittest: Mosaicking unitTest_crop.cub 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed ./unitTest_crop.cub is inside the mosaic unittest: Mosaicking unitTest_nocrop.cub 0% Processed10% Processed20% Processed30% Processed40% Processed50% Processed60% Processed70% Processed80% Processed90% Processed100% Processed ./unitTest_nocrop.cub is inside the mosaic Mosaic label: Object = IsisCube Object = Core Format = Tile Group = Dimensions Samples = 2215 Lines = 3271 Bands = 1 End_Group Group = Pixels Type = Real Base = 0.0 Multiplier = 1.0 End_Group End_Object Group = Mapping ProjectionName = Sinusoidal CenterLongitude = 227.87092862105 TargetName = Mars EquatorialRadius = 3396190.0 <meters> PolarRadius = 3376200.0 <meters> LatitudeType = Planetocentric LongitudeDirection = PositiveEast LongitudeDomain = 360 UpperLeftCornerX = -475029.8023764 UpperLeftCornerY = 2042714.0507253 PixelResolution = 429.50253379421 <meters/pixel> Scale = 138.00779473796 <pixels/degree> End_Group End_Object Object = Label End_Object Object = History Name = IsisCube End_Object End Loading
isis/src/base/objs/ProcessMapMosaic/unitTest.cpp +27 −0 Changes for isis/src/base/objs/ProcessMapMosaic/unitTest.cpp: 27 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -129,7 +129,34 @@ void IsisMain() { remove("./unitTest3.cub"); // Create the temp parent cube FileList cubes_crop; cubes_crop.read("unitTest_crop.lis"); cout << endl << "Testing Mosaic containing cropped image." << endl; ProcessMapMosaic m4; CubeAttributeOutput oAtt3; priority = ProcessMapMosaic::PlaceImagesOnTop; m4.SetBandBinMatch(false); m4.SetOutputCube(cubes_crop, oAtt3, "./unitTest4.cub"); //set priority m4.SetImageOverlay(priority); for(int i = 0; i < cubes_crop.size(); i++) { if(m4.StartProcess(cubes_crop[i].toString())) { cout << cubes_crop[i].toString() << " is inside the mosaic" << endl; } else { cout << cubes_crop[i].toString() << " is outside the mosaic" << endl; } } m4.EndProcess(); cout << "Mosaic label: " << endl; Pvl labels_crop("./unitTest4.cub"); cout << labels_crop << endl; remove("./unitTest4.cub"); }
isis/src/base/objs/ProcessMapMosaic/unitTest_crop.lis 0 → 100644 +2 −0 Changes for isis/src/base/objs/ProcessMapMosaic/unitTest_crop.lis: 2 added lines, 0 removed lines. Original line number Diff line number Diff line ./unitTest_crop.cub ./unitTest_nocrop.cub