int main( int argc, char *argv[] )
{
if( argc < 9 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage seedX seedY seedZ lowThreshold highThreshold iterations outputMesh.vtk" << std::endl;
return EXIT_FAILURE;
}
typedef float InternalPixelType;
const unsigned int Dimension = 3;
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() );
ImageType::IndexType index;
index[0] = atoi( argv[2] );
index[1] = atoi( argv[3] );
index[2] = atoi( argv[4] );
CellType::PointType position;
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[5] ) );
CellType::SetChemoAttractantHighThreshold( atof( argv[6] ) );
cellularAggregate->SetEgg( egg, position );
unsigned int numberOfIterations = atoi( argv[7] );
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[8] );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}