Commit bca83e22 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Fixed issue with alphacube propagation during ifft. noproj no longer...

Fixed issue with alphacube propagation during ifft. noproj no longer propagates the alphacube group. Fixes #4907.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8000 41f8697f-d340-4b68-9986-7bafba869bb8
parent 7eaca94d
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
#include "Isis.h"

#include <complex>

#include "AlphaCube.h"
#include "FourierTransform.h"
#include "ProcessByTile.h"
#include "AlphaCube.h"

using namespace std;
using namespace Isis;
@@ -65,10 +67,26 @@ void IsisMain() {
  sProc.SetInputCube(tmpPhaseFileName, cai);

  // the final output cube is cropped back to the original size
  sProc.SetOutputCube("TO", initSamples, initLines, numBands);
  Cube *outputCube = sProc.SetOutputCube("TO", initSamples, initLines, numBands);

  //Start the sample proccessing
  sProc.ProcessCubes(&IFFT1);

  // Remove the AlphaCube if the alpha and beta dimensions match the output cube dimensions
  // (i.e. remove this group if it didn't exist before running fft).
  int outputSamples = outputCube->sampleCount();
  int outputLines = outputCube->lineCount();
  if (initSamples == outputSamples
      && initLines == outputLines 
      && acube.AlphaSamples() == outputSamples
      && acube.AlphaLines() == outputLines) {
    Pvl *label = outputCube->label();
    PvlObject &isisCube = label->findObject("IsisCube");
    if (isisCube.hasGroup("AlphaCube")) {
      isisCube.deleteGroup("AlphaCube");
    }
  }

  sProc.Finalize();

  remove(tmpMagFileName.toLatin1().data());
+12 −1
Original line number Diff line number Diff line
@@ -5,9 +5,16 @@
  </brief>

  <description>
    <p>
      This program accepts two cubes, most likely acquired from the fft program,
      containing the magnitude and phase angle data of a Fourier transformed 
      image and returns the inverse. 
    </p>
    <p>
      The output cube will contain an AlphaCube group if the input cube to the fft program
      contained one. For exmaple, if a cube was cropped and then run through the fft program,
      the output cube from this program will contain the original AlphaCube group.
    </p>
  </description>

  <category>
@@ -39,6 +46,10 @@
      This program now takes advantage of multiple global
      processing threads.
    </change>
    <change name="Ian Humphrey" date="2017-08-19">
      Now removes the AlphaCube group from the output cube if the fft input cube did not have
      an AlphaCube group. Fixes #4907.
    </change>
  </history>

  <groups>
+18 −0
Original line number Diff line number Diff line
# This tests running ifft on a cube that has been cropped before being run through fft.
# crop -> fft -> ifft
# This is testing that ifft retains the original AlphaCube group from the crop.

# 7.2e-15
ifftTruth.cub.TOLERANCE = .0000000000000072

APPNAME = ifft

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) magnitude=$(INPUT)/PSP_mag.cub \
	  phase=$(INPUT)/PSP_phase.cub \
	  to=$(OUTPUT)/ifftTruth.cub \
	  > /dev/null;
	catlab from=$(OUTPUT)/ifftTruth.cub > $(OUTPUT)/ifftTruth.pvl;
	$(RM) print.prt > /dev/null;
+6 −0
Original line number Diff line number Diff line
@@ -363,6 +363,12 @@ void IsisMain() {
  PvlObject &o = toLabel->findObject("IsisCube");
  o.deleteGroup("OriginalInstrument");
  o.addGroup(fromInst);

  // Remove AlphaCube in output cube since noproj changes image geometries
  // (can't undo a noproj or uncrop a noproj'd image etc)
  if (o.hasGroup("AlphaCube")) {
    o.deleteGroup("AlphaCube");
  }
  toCube.close();
}

+9 −0
Original line number Diff line number Diff line
@@ -7,11 +7,17 @@
  </brief>

  <description>
    <p>
    This program will modify the cube labels for the Ideal camera.
    The original Instrument group is renamed OriginalInstrument and a new
    instrument group is created for the Ideal Camera.  The cube data
    is modified when this program runs cam2cam, creating the noproj'd
    output cube with camera distortions removed.
    </p>
    <p>
    Note that noproj will not propagate AlphaCube groups from the match cube into the output
    cube since noproj is resampling the image.
    </p>
  </description>

  <history>
@@ -55,6 +61,9 @@
      PixelPitch (becomes IDEAL_PIXEL_PITCH), and FocalLength (becomes IDEAL_FOCAL_LENGTH).
      Fixes #1094.
    </change>
    <change name="Ian Humphrey" date="2017-08-19">
      No longer propagates AlphaCube group to output cube. Fixes #4907.
    </change>
  </history>

  <category>
Loading