int main( int argc, char *argv[] )
{
if( argc < 8 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage seedX seedY lowThreshold highThreshold iterations outputMesh.vtk" << std::endl;
return EXIT_FAILURE;
}
typedef float InternalPixelType;
typedef CellularAggregateType::BioCellType CellType;
CellularAggregateType::Pointer cellularAggregate
= CellularAggregateType::New();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
std::cout << "Filename = " << argv[1] << std::endl;
try
{
reader->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
cellularAggregate->AddSubstrate( reader->GetOutput() );
index[0] = atoi( argv[2] );
index[1] = atoi( argv[3] );
reader->GetOutput()->TransformIndexToPhysicalPoint( index, position );
std::cout << "Egg position index = " << index << std::endl;
std::cout << "Egg position point = " << position << std::endl;
CellType * egg = CellType::CreateEgg();
CellType::SetChemoAttractantLowThreshold( atof( argv[4] ) );
CellType::SetChemoAttractantHighThreshold( atof( argv[5] ) );
cellularAggregate->SetEgg( egg, position );
unsigned int numberOfIterations = atoi( argv[6] );
std::cout << "numberOfIterations " << numberOfIterations << std::endl;
for(unsigned int i=0; i<numberOfIterations; i++)
{
cellularAggregate->AdvanceTimeStep();
}
std::cout << " Final number of Cells = " << cellularAggregate->GetNumberOfCells() << std::endl;
WriterType::Pointer writer = WriterType::New();
writer->SetInput( cellularAggregate->GetMesh() );
writer->SetFileName( argv[7] );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}