Commit c249a7a9 authored by cyrush's avatar cyrush

added ability to retain the original spatial extents in shapelet decomposition...

added ability to retain the original spatial extents in shapelet decomposition and reconstruction results

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@4434 18c085ea-50e0-402c-830e-de6fd14e8384
parent d7da6317
......@@ -120,6 +120,10 @@ avtShapeletDecompositionQuery::PreExecute(void)
// Programmer: Cyrus Harrison
// Creation: December 14, 2007
//
// Modifications:
// Cyrus Harrison, Wed Jun 11 15:29:15 PDT 2008
// Added original data extents to the MapNode for GetQueryOutputObject().
//
// ****************************************************************************
void
......@@ -149,12 +153,13 @@ avtShapeletDecompositionQuery::PostExecute(void)
// return more info using QueryXmlResult
MapNode result_node;
result_node["beta"] = decompResult->Beta();
result_node["nmax"] = decompResult->NMax();
result_node["width"] = decompResult->Width();
result_node["height"] = decompResult->Height();
result_node["coeffs"] = decompResult->Coefficients();
result_node["error"] = recompError;
result_node["beta"] = decompResult->Beta();
result_node["nmax"] = decompResult->NMax();
result_node["width"] = decompResult->Width();
result_node["height"] = decompResult->Height();
result_node["extents"] = decompResult->Extents();
result_node["coeffs"] = decompResult->Coefficients();
result_node["error"] = recompError;
SetXmlResult(result_node.ToXML());
if(decompOutputFileName!="")
......
......@@ -50,16 +50,22 @@ using namespace std;
// Programmer: Cyrus Harrison
// Creation: December 12, 2007
//
// Modifications:
// Cyrus Harrison, Wed Jun 11 15:29:15 PDT 2008
// Added support to retain the original data extents.
//
// ****************************************************************************
avtShapeletDecompResult::avtShapeletDecompResult(double beta,
int nmax,
int width,
int height,
const doubleVector &extents,
const doubleVector &coeffs)
: beta(beta),
nmax(nmax),
width(width), height(height),
extents(extents),
coeffs(coeffs)
{;}
......
......@@ -52,6 +52,8 @@
// Creation: December 12, 2007
//
// Modifications:
// Cyrus Harrison, Wed Jun 11 15:29:15 PDT 2008
// Added support to retain the original data extents.
//
// ****************************************************************************
......@@ -62,18 +64,21 @@ class AVTSHAPELETS_API avtShapeletDecompResult
int nmax,
int width,
int height,
const doubleVector& extents,
const doubleVector& coeffs);
avtShapeletDecompResult(const avtShapeletDecompResult&);
avtShapeletDecompResult &operator=(const avtShapeletDecompResult&);
virtual ~avtShapeletDecompResult();
double Beta() const { return beta;}
int NMax() const { return nmax;}
int Width() const { return width;}
int Height() const { return height;}
double Beta() const { return beta;}
int NMax() const { return nmax;}
int Width() const { return width;}
int Height() const { return height;}
const doubleVector &Extents() const { return extents;}
const doubleVector &Coefficients() const { return coeffs;}
double Coefficient(int,int) const;
// pretty print
std::string ToString() const;
......@@ -83,6 +88,7 @@ class AVTSHAPELETS_API avtShapeletDecompResult
int nmax;
int width;
int height;
doubleVector extents;
doubleVector coeffs;
};
......
......@@ -80,6 +80,10 @@ avtShapeletDecompose::~avtShapeletDecompose()
// Programmer: Cyrus Harrison
// Creation: December 6, 2007
//
// Modifications:
// Cyrus Harrison, Wed Jun 11 15:29:15 PDT 2008
// Added support to retain the original data extents.
//
// ****************************************************************************
avtShapeletDecompResult *
......@@ -92,8 +96,18 @@ avtShapeletDecompose::Execute(vtkRectilinearGrid *rgrid,
int width = basis_set->Width();
int height = basis_set->Height();
int data_length = width * height;
doubleVector extents;
doubleVector coeffs;
// get original data extents
double gbounds[6];
rgrid->GetBounds(gbounds);
extents.resize(4);
extents[0] = gbounds[0];
extents[1] = gbounds[1];
extents[2] = gbounds[2];
extents[3] = gbounds[3];
vtkDataArray *var_arr = rgrid->GetCellData()->GetArray(var_name.c_str());
if(!var_arr)
......@@ -123,6 +137,7 @@ avtShapeletDecompose::Execute(vtkRectilinearGrid *rgrid,
nmax,
width,
height,
extents,
coeffs);
return decomp;
}
......
......@@ -81,6 +81,10 @@ avtShapeletReconstruct::~avtShapeletReconstruct()
// Programmer: Cyrus Harrison
// Creation: December 13, 2007
//
// Modifications:
// Cyrus Harrison, Wed Jun 11 15:29:15 PDT 2008
// Added support to retain the original data extents.
//
// ****************************************************************************
vtkRectilinearGrid *
......@@ -88,19 +92,34 @@ avtShapeletReconstruct::Execute(avtShapeletDecompResult *decomp,
const string &var_name,
avtShapeletBasisSet *basis_set)
{
int nmax = decomp->NMax();
int width = decomp->Width();
int height = decomp->Height();
int nmax = decomp->NMax();
int width = decomp->Width();
int height = decomp->Height();
doubleVector extents = decomp->Extents();
int data_length = width * height;
// create a rectlinear grid to hold the result
vtkDoubleArray *x_coords = vtkDoubleArray::New();
vtkDoubleArray *y_coords = vtkDoubleArray::New();
vtkDoubleArray *z_coords = vtkDoubleArray::New();
double sx = extents[0];
double sy = extents[2];
double dx = (extents[1] - extents[0])/((float)width);
double dy = (extents[3] - extents[2])/((float)height);
double curr = sx;
for(int i=0; i<=width; i++)
x_coords->InsertNextValue(i);
{
x_coords->InsertNextValue(curr);
curr +=dx;
}
curr = sy;
for(int i=0; i<=height; i++)
y_coords->InsertNextValue(i);
{
y_coords->InsertNextValue(curr);
curr +=dy;
}
z_coords->InsertNextValue(0.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment