Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "cmtkImageOperationDownsample.h"
00032
00033 cmtk::UniformVolume::SmartPtr
00034 cmtk::ImageOperationDownsample
00035 ::Apply( cmtk::UniformVolume::SmartPtr& volume )
00036 {
00037 const int factors[3] = { this->m_FactorX, this->m_FactorY, this->m_FactorZ };
00038 return cmtk::UniformVolume::SmartPtr( volume->GetDownsampledAndAveraged( factors ) );
00039 }
00040
00041 void
00042 cmtk::ImageOperationDownsample
00043 ::New( const char* arg )
00044 {
00045 int factorsX = 1;
00046 int factorsY = 1;
00047 int factorsZ = 1;
00048
00049 const size_t nFactors = sscanf( arg, "%d,%d,%d", &factorsX, &factorsY, &factorsZ );
00050 if ( nFactors == 1 )
00051 {
00052 factorsZ = factorsY = factorsX;
00053 }
00054 else
00055 {
00056 if ( nFactors != 3 )
00057 {
00058 cmtk::StdErr << "ERROR: downsampling factors must either be three integers, x,y,z, or a single integer\n";
00059 exit( 1 );
00060 }
00061 }
00062 ImageOperation::m_ImageOperationList.push_back( SmartPtr( new ImageOperationDownsample( factorsX, factorsY, factorsZ ) ) );
00063 }
00064