//===== // Don't edit this file. This file is generated from xml description.. //===== #include "bbvtkRescaleSlopeIntercept.h" #include "bbvtkPackage.h" namespace bbvtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,RescaleSlopeIntercept) BBTK_BLACK_BOX_IMPLEMENTATION(RescaleSlopeIntercept,bbtk::AtomicBlackBox); //===== // Don't edit this file. This file is generated from xml description.. //===== void RescaleSlopeIntercept::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <GetScalarType(); else if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; imageoutput->Initialize(); imageoutput->SetScalarType( outputformat ); bbGetInputIn()->GetScalarRange(range); bbGetInputIn()->GetSpacing(spc); imageoutput->SetSpacing( spc ); bbGetInputIn()->GetWholeExtent(ext); dim[0]=ext[1]-ext[0]+1; dim[1]=ext[3]-ext[2]+1; dim[2]=ext[5]-ext[4]+1; imageoutput->SetDimensions( dim[0] , dim[1], dim[2] ); imageoutput->AllocateScalars(); double range0plusrange1 = range[0]+range[1]; double difrange = range[1]-range[0]; double newdifrange = B-A; int i,j,k; for (i=0; iGetScalarComponentAsDouble(i,j,k,0); if (bbGetInputType()==0) // Rescale Slope/Intercept { newValue = value*A+B; } // if type 0 if (bbGetInputType()==1) // Invert { newValue = value*(-1) + (range0plusrange1); } // if type 1 if (bbGetInputType()==2) // Redimension { newValue = ((value-range[0])/difrange)*newdifrange + A; } // if type 2 if (bbGetInputType()==3) // Invert redimension { newValue = ((value*(-1)+range[1])/difrange)*newdifrange + A; } // if type 3 imageoutput->SetScalarComponentFromDouble (i,j,k, 0, newValue); } // for k } // for j } // for i bbSetOutputOut(imageoutput); } // if } //===== // Don't edit this file. This file is generated from xml description.. //===== void RescaleSlopeIntercept::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputIn(NULL); bbSetInputType(0); bbSetInputA(1); bbSetInputB(0); bbSetInputOutputFormat("SAME"); imageoutput=NULL; } //===== // Don't edit this file. This file is generated from xml description.. //===== void RescaleSlopeIntercept::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any imageoutput = vtkImageData::New(); } //===== // Don't edit this file. This file is generated from xml description.. //===== void RescaleSlopeIntercept::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbvtk