Commit f35e0515 authored by Curtis Rose's avatar Curtis Rose
Browse files

Finished updating photomet to allow users to trim images based on...

Finished updating photomet to allow users to trim images based on dem/ellipsoid and calculate photometric angles based on dem/ellipsoid. The trimming and calculating are separate, requiring the use of the usedem parameter. Fixes #4180.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7212 41f8697f-d340-4b68-9986-7bafba869bb8
parent 89f015dd
Loading
Loading
Loading
Loading
+22 −11
Original line number Diff line number Diff line
@@ -1886,7 +1886,6 @@ void photomet(Buffer &in, Buffer &out) {

    // otherwise, compute angle values
    else {

      bool success = true;
      if (angleSource == "CENTER_FROM_IMAGE" ||
          angleSource == "CENTER_FROM_LABEL" ||
@@ -1918,22 +1917,34 @@ void photomet(Buffer &in, Buffer &out) {
      if(!success) {
        out[i] = NULL8;
      }
      else if(deminc >= 90.0 || demema >= 90.0) {
        out[i] = NULL8;
      // otherwise, do photometric correction
      else {
        pho->Compute(ellipsoidpha, ellipsoidinc, ellipsoidema, deminc, demema, in[i], out[i], mult, base);
      }
      // if angles greater than max allowed by user, set to null
      else if(usedem && (deminc > maxinc || demema > maxema)) {
        out[i] = NULL8;
    }
      else if(!usedem && (ellipsoidinc > maxinc || ellipsoidema > maxema)) {
  }
  // Trim
  if (!usedem) {
    cam->IgnoreElevationModel(true);
  }
  double trimInc = 0, trimEma = 0;
  //bool success = true;
  for (int i = 0; i < in.size(); i++) {
    // if off the target, set to null
    if(!cam->SetImage(in.Sample(i), in.Line(i))) {
      out[i] = NULL8;
      //success = false;
    }
      // otherwise, do photometric correction
    else {
        pho->Compute(ellipsoidpha, ellipsoidinc, ellipsoidema, deminc, demema, in[i], out[i], mult, base);
      trimInc = cam->IncidenceAngle();
      trimEma = cam->EmissionAngle();
    }
    
    if(trimInc > maxinc || trimEma > maxema) {
        out[i] = NULL8;
    }
  }
  cam->IgnoreElevationModel(false);
}

/**
+462 −388
Original line number Diff line number Diff line
@@ -1135,10 +1135,22 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
          <item>FALSE</item>
        </default>
        <description>
          <p>
            This specifies if the image will be trimmed based on the photometric 
	  angles obtained from the DEM surface or the ellipsoid. If this parameter 
	  is set to false, then the photometric angles will be obtained from the
          ellipsoidal surface. 
            angles obtained from the ellipsoid (default) or the DEM surface. 
          </p>
           <p>
            The ellipsoid is retrieved from the IAU/NAIF target body file, 
            which is defined within the cube's kernel group as the TargetAttitudeShape. 
            If this parameter is set to false, then the photometric angles will be obtained 
            from the ellipsoidal surface.
          </p>
          <p>
            The photometric angles obtained from the DEM surface (shape model)
            for each pixel are obtained using an ellipsoid 
            defined by the radius obtained from the DEM shape model.
            <i>Note that photomet does not trim using local slopes.</i>
          </p>
        </description>
      </parameter>
    </group>
@@ -1159,15 +1171,15 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
          <dl>
          <dt><b>ELLIPSOID (default)</b></dt>
          <dd>
            The photometric angles for each pixel are obtained using the ellipsoid
            shape model.
            The photometric angles for each pixel are obtained using an ellipsoid 
            defined by the radius obtained from the DEM shape model.
          </dd>
          <dt><b>DEM</b></dt>
          <dd>
            The photometric angles for each pixel are obtained using the DEM shape
            model (if one is defined in the image labels).  The surface roughness 
            is taken into account to calculate a surface normal, which is used to 
	    calculate the photometric angles. 
            calculate the photometric angles. i.e. slope, local emission, local incidence.
          </dd>
          <dt><b>CENTER_FROM_IMAGE</b></dt>
          <dd>
@@ -1213,8 +1225,8 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
          <option value="ELLIPSOID">
            <brief>Get angles from ELLIPSOID</brief>
            <description>
              The photometric angles for each pixel are obtained using the ellipsoid
              shape model.
              The photometric angles for each pixel are obtained using an ellipsoid 
              defined by the radius obtained from the DEM surface (shape model).
            </description>
            <exclusions>
              <item>PHASE_ANGLE_FILE</item>
@@ -1228,8 +1240,8 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
          <option value="DEM">
            <brief>Get angles from DEM</brief>
            <description>
              The photometric angles for each pixel are obtained using the DEM shape
              model.
              The photometric angles for each pixel are obtained using the DEM surface (shape
              model).
            </description>
            <exclusions>
              <item>PHASE_ANGLE_FILE</item>
@@ -3134,7 +3146,7 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
      </description>
      <terminalInterface>
        <commandLine>
	 from=EW0131773041G_cal.cub to=EW0131773041G_cal_hapkehen_mixed.cub 
          0131773041G_cal.cub to=EW0131773041G_cal_hapkehen_mixed.cub 
         frompvl=photomG.pvl phtname=hapkehen theta=9 wh=0.218651 hg1=0.178965 
         hg2=0.971493 hh=0.085 b0=2.7 normname=mixed incref=0 incmat=75 
         thresh=30.0 albedo=0.0
@@ -3407,6 +3419,68 @@ incidence</def> and <def link="Emission Angle">emission angles</def>, respective
       </image>
      </outputImages>
    </example>
       <example>
      <brief>Photometric corrections using a three-step approach for MDIM2.1 of Mars</brief>
      <description>
        A multistep process is used to apply photometric correction to Mars images: 
        <ol>
          <li>
            Photomet is run in albedo mode, which decreases brightness variations across 
            the individual image and removes the additive atmospheric contribution, if any; 
          </li>
          <li>
            The output image from step 1 is divided by a low-pass-filtered version of itself, 
            which removes albedo variations if they have broader spatial scales than topographic 
            shading as is often the case; and 
          </li>
          <li>
            Photomet is run again on the output image of step 2 in topography mode, which 
            undoes the albedo normalization of the first pass and then applies the topographic 
            normalization.
          </li>
        </ol> 
        The final result would need to be equalized and  mosaicked together.
      </description>
      <dataFiles>
        <dataFile path="assets/photomet_3_steps_processing.cmd">
          <brief>Sample script</brief>
          <description>
            This script contains the three-step processing sequence of programs that need to 
            be executed for the three test images.
          </description>
          <parameterName>
            Not applicable
          </parameterName>
        </dataFile>
      </dataFiles>
      <outputImages>
        <image src="assets/images/photomet_ex5_3step_process.png" width="1226" height="1334">
          <brief>Collage of images</brief>
          <description>
            The images shown are subareas at 1:1 scale to emphasize the result of the 
            photometric correction at each stage.  There are four rows in the image 
            collage containing the following:<br/>
            <ul>
              <li>
                Row 1 - Calibrated images without photometric correction<br/>
              </li>
              <li>
                Row 2 - Applied Hapkehen photometric model, albedoatm normalization 
                model and an hapkeatm2 atmospheric model<br/>
              </li>
              <li>
                Row 3 - Applied a divide filter
              </li>
              <li>
                Row 4 - Applied Hapkehen photometric model, topoatm normalization 
                model and an hapkeatm2 atmospheric model<br/>
              </li>
            </ul>
         </description>
         <thumbnail src="assets/thumbs/photomet_ex5_3step_process_thumb.png" caption="Input and output images" width="276" height="300"/>
       </image>
      </outputImages>
    </example>
  </examples>
</application>
+50 −0
Original line number Diff line number Diff line
APPNAME = photomet

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/cropped.cub \
	to=$(OUTPUT)/angleSourceDemUsedemFalse.cub \
	maxemission=87.0 \
	anglesource=dem \
	phtname=minnaert \
	k=0.5 \
	normname=albedo \
	incref=0 \
	incmat=80 \
	thresh=30 \
	albedo=1.0 > /dev/null;
	$(APPNAME) from=$(INPUT)/cropped.cub \
	to=$(OUTPUT)/angleSourceEllipsoidUsedemFalse.cub \
	maxemission=87.0 \
	phtname=minnaert \
	k=0.5 \
	normname=albedo \
	incref=0 \
	incmat=80 \
	thresh=30 \
	albedo=1.0 > /dev/null;
	$(APPNAME) from=$(INPUT)/cropped.cub \
	to=$(OUTPUT)/angleSourceEllipsoidUsedemTrue.cub \
	maxemission=87.0 \
	usedem=yes \
	phtname=minnaert \
	k=0.5 \
	normname=albedo \
	incref=0 \
	incmat=80 \
	thresh=30 \
	albedo=1.0 > /dev/null;
	$(APPNAME) from=$(INPUT)/cropped.cub \
	to=$(OUTPUT)/angleSourceDemUsedemTrue.cub \
	maxemission=87.0 \
	anglesource=dem \
	usedem=yes \
	phtname=minnaert \
	k=0.5 \
	normname=albedo \
	incref=0 \
	incmat=80 \
	thresh=30 \
	albedo=1.0 > /dev/null;
	
 No newline at end of file