#ifndef _DEF_UniformScaleLevelSet_TXX #define _DEF_UniformScaleLevelSet_TXX #include "Def_UniformScaleLevelSet.h" namespace mial { // constructor: template Def_UniformScaleLevelSet ::Def_UniformScaleLevelSet() { this->name = "Def_UniformScale"; } template bool Def_UniformScaleLevelSet ::run(typename Deformation::deformationIn* i,typename Deformation::DefArgSet* org, std::stringstream *s) { DefArgSet* orgUp = reinterpret_cast(org); typename deformationIn::Pointer in; if(i !=NULL && s != NULL) { Error e; e.msg = "Only one of struct or stream input may be provided."; e.name = "Def_UniformScaleLevelSet"; throw e; } else if(i !=NULL) in = reinterpret_cast(i); //Typecast the input to its desired form else if( s!= NULL) { in = deformationIn::New(); in->fillFromStream(*s); } else { Error e; e.msg = "Either struct or stream input must be provided."; e.name = "Def_UniformScaleLevelSet"; throw e; } //Add the scale factor to each pixel in the distance image IteratorType phiIt( orgUp->distanceImg, orgUp->distanceImg->GetRequestedRegion() ); DataType sc = in->scaleAmount; for ( phiIt.GoToBegin(); !phiIt.IsAtEnd(); ++phiIt) { phiIt.Set( phiIt.Get() + sc); } return false; } } // end namespace mial #endif