#define __CTBronchi__Functions__h__
#include <chrono>
-#include <map>
-#include <sstream>
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
typename _TReader::Pointer reader = _TReader::New( );
reader->SetFileName( fname );
double t = MeasureTime( reader );
- std::cout << "Read " << fname << " in " << t << " s" << std::endl;
+ std::cout << "Read \"" << fname << "\" in " << t << " s" << std::endl;
image = reader->GetOutput( );
image->DisconnectPipeline( );
}
// -----------------------------------------------------------------------
- template< class _TImagePtr >
- void WriteImage( const _TImagePtr& image, const std::string& fname )
+ template< class _TImage >
+ void WriteImage( const _TImage* image, const std::string& fname )
{
- typedef typename _TImagePtr::ObjectType _TImage;
typedef itk::ImageFileWriter< _TImage > _TWriter;
typename _TWriter::Pointer writer = _TWriter::New( );
writer->SetFileName( fname );
writer->SetInput( image );
double t = MeasureTime( writer );
- std::cout << "Wrote " << fname << " in " << t << " s" << std::endl;
- }
-
- // -----------------------------------------------------------------------
- bool ParseArgs(
- std::map< std::string, std::string >& args, int argc, char* argv[]
- )
- {
- std::set< std::string > mandatory;
- mandatory.insert( "in" );
- mandatory.insert( "out" );
- mandatory.insert( "seed" );
-
- args[ "mori_minimum_threshold" ] = "-850";
- args[ "mori_signal_kernel_size" ] = "20";
- args[ "mori_signal_threshold" ] = "100";
- args[ "mori_signal_influence" ] = "0.5";
- args[ "mori_lower_threshold" ] = "-1024";
- args[ "mori_upper_threshold" ] = "0";
- args[ "mori_delta_threshold" ] = "1";
- args[ "labelling_upper_threshold" ] = "-600";
- args[ "random_walker_alpha" ] = "1";
- args[ "random_walker_beta" ] = "100";
-
- int i = 1;
- while( i < argc )
- {
- std::string cmd = argv[ i ] + 1;
- if( cmd == "seed" )
- {
- std::stringstream seed;
- seed
- << argv[ i + 1 ] << ";"
- << argv[ i + 2 ] << ";"
- << argv[ i + 3 ];
- args[ cmd ] = seed.str( );
- i += 4;
- }
- else
- {
- args[ cmd ] = argv[ i + 1 ];
- i += 2;
-
- } // fi
-
- } // elihw
-
- bool complete = true;
- for( std::string t: mandatory )
- complete &= ( args.find( t ) != args.end( ) );
-
- if( !complete )
- {
- std::cerr
- << "Usage: " << argv[ 0 ] << std::endl
- << "\t-in filename" << std::endl
- << "\t-out filename" << std::endl
- << "\t-seed x y z" << std::endl
- << "\t[-out_mori filename]" << std::endl
- << "\t[-out_signal filename]" << std::endl
- << "\t[-out_labels filename]" << std::endl
- << "\t[-out_diff filename]" << std::endl
- << "\t[-mori_minimum_threshold value]" << std::endl
- << "\t[-mori_signal_kernel_size value]" << std::endl
- << "\t[-mori_signal_threshold value]" << std::endl
- << "\t[-mori_signal_influence value]" << std::endl
- << "\t[-mori_lower_threshold value]" << std::endl
- << "\t[-mori_upper_threshold value]" << std::endl
- << "\t[-mori_delta_threshold value]" << std::endl
- << "\t[-labelling_upper_threshold value]" << std::endl
- << "\t[-random_walker_alpha value]" << std::endl
- << "\t[-random_walker_beta value]" << std::endl;
- return( false );
-
- } // fi
- return( true );
+ std::cout << "Wrote \"" << fname << "\" in " << t << " s" << std::endl;
}
} // ecapseman