12 #include "IException.h"
27 Enlarge::Enlarge(
Cube *pInCube,
const double sampleScale,
28 const double lineScale) {
36 mdEndLine = mInCube->lineCount();
39 mdSampleScale = sampleScale;
40 mdLineScale = lineScale;
42 miOutputSamples = (int)ceil(mInCube->sampleCount() * mdSampleScale);
43 miOutputLines = (int)ceil(mInCube->lineCount() * mdLineScale);
57 bool Enlarge::Xform(
double &inSample,
double &inLine,
58 const double outSample,
const double outLine) {
59 inSample = (outSample - 0.5) / mdSampleScale + 0.5 + (mdStartSample - 1);
60 inLine = (outLine - 0.5) / mdLineScale + 0.5 + (mdStartLine - 1);
76 void Enlarge::SetInputArea(
double pdStartSample,
double pdEndSample,
77 double pdStartLine,
double pdEndLine) {
79 if (pdStartSample > pdEndSample || pdStartLine > pdEndLine) {
80 string sErrMsg =
"Error in Input Area Dimesions";
81 throw IException(IException::Programmer, sErrMsg, _FILEINFO_);
84 if (pdStartSample >= 1) {
85 mdStartSample = pdStartSample;
87 if (pdEndSample <= mInCube->sampleCount()) {
88 mdEndSample = pdEndSample;
90 if (pdStartLine >= 1) {
91 mdStartLine = pdStartLine;
93 if (pdEndLine <= mInCube->lineCount()) {
94 mdEndLine = pdEndLine;
97 miOutputSamples = (int)ceil((mdEndSample - mdStartSample + 1) * mdSampleScale);
98 miOutputLines = (int)ceil((mdEndLine - mdStartLine + 1) * mdLineScale);
115 int iNumSamples= mInCube->sampleCount();
116 int iNumLines = mInCube->lineCount();
135 subArea.
SetSubArea(mInCube->lineCount(), mInCube->sampleCount(), (
int)mdStartLine, (
int)mdStartSample,
136 (
int)mdEndLine, (
int)mdEndSample, 1.0 / mdLineScale, 1.0 / mdSampleScale);
137 subArea.
UpdateLabel(mInCube, pOutCube, resultsGrp);