Commit 4803aaf6 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

ISBI_Generator, Added output dir parameter.

parent 40aadecf
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -22,29 +22,30 @@ ActiveMesh mesh;
std::vector< std::vector<int> > tipOffsets;

bool LoadNewMesh(const char* path,const int ID,const int fileNo);
int  RenderMesh(int fileNo);
int  RenderMesh(const char* path,int fileNo);

int main(int argc,char **argv)
{
	if (argc != 3 && argc != 4)
	if (argc != 4 && argc != 5)
	{
		//I'm executed with no params, provide help
		std::cout << "ADD SOME HEADER INFORMATION HERE\n\n";
		std::cout << "params:  path_to_datasets  dataset_ID  [time_point]\n\n";
		std::cout << "params:  path_to_VTKs path_to_output  dataset_ID  [time_point] [no_of_time_points]\n\n";
		std::cout << "The program will try to load object files (cell body volumetric mesh and\n"
                   "filopodia skeleton definition) iteratively (starting from 0th time point)\n"
                   "until it fails loading cell body file. Filopodia files for the current time\n"
                   "point are tried from the index 1. If the optional time_point parameter is\n"
                   "given, it will start loading objects from this time point.\n";
                   "given, it will start loading objects from this time point. If the second optional\n"
						 "parameter is given, maximum of no_of_time_points is processed.\n";
		return(-1);
	}

	//determine the first time point to start with
	int i=0;
	if (argc == 4) i=atoi(argv[3]);
	if (argc == 5) i=atoi(argv[4]);

	//get dataset ID
	int ID=atoi(argv[2]);
	int ID=atoi(argv[3]);

	//I'm called as generator/simulator, init the situation...
	ParamsSetup();
@@ -75,7 +76,7 @@ int main(int argc,char **argv)
			std::cout << f << ": normals   #: " << mesh.Ftree[f].norm.size() << "\n";
		}

		RenderMesh(i);
		RenderMesh(argv[2],i);
		++i;
	}

@@ -204,7 +205,7 @@ bool LoadNewMesh(const char* path,const int ID,const int fileNo)

#define DO_PHASE_II_AND_III
#define DO_ANISOTROPIC_OUTPUT
int RenderMesh(int fileNo)
int RenderMesh(const char* path,int fileNo)
{
	//setup isotropic(!) image for mask-output of the simulated cell
	i3d::Image3d<i3d::GRAY16> mask;
@@ -226,7 +227,7 @@ int RenderMesh(int fileNo)

	std::cout << "exporting isotropic mask #" << fileNo << "\n";
	char fileName[1024];
	sprintf(fileName,"ISOmask_t%03d.tif",fileNo);
	sprintf(fileName,"%s/ISOmask_t%03d.tif",path,fileNo);
	mask.SaveImage(fileName);

	//updates the texture fl. points
@@ -279,11 +280,11 @@ int RenderMesh(int fileNo)
/*
		//uncomment if you want to see the FF for the cell body
		char n[1024];
		sprintf(n,"new_vx_%03d.ics",fileNo);
		sprintf(n,"%s/new_vx_%03d.ics",path,fileNo);
		FF.x->SaveImage(n);
		sprintf(n,"new_vy_%03d.ics",fileNo);
		sprintf(n,"%s/new_vy_%03d.ics",path,fileNo);
		FF.y->SaveImage(n);
		sprintf(n,"new_vz_%03d.ics",fileNo);
		sprintf(n,"%s/new_vz_%03d.ics",path,fileNo);
		FF.z->SaveImage(n);
*/

@@ -311,7 +312,7 @@ int RenderMesh(int fileNo)
	//i3d::Image3d<i3d::GRAY16> texture;
	//mesh.RenderOneTimeTexture(mask,texture);

	sprintf(fileName,"phantom_t%03d.tif",fileNo);
	sprintf(fileName,"%s/phantom_t%03d.tif",path,fileNo);
	texture.SaveImage(fileName);

#ifdef DO_PHASE_II_AND_III
@@ -336,12 +337,12 @@ int RenderMesh(int fileNo)

	//save the texture and that's it for texture image
	std::cout << "exporting texture #" << fileNo << "\n";
	sprintf(fileName,"texture_t%03d.tif",fileNo);
	sprintf(fileName,"%s/texture_t%03d.tif",path,fileNo);
	texture.SaveImage(fileName);


	std::cout << "exporting mask #" << fileNo << "\n";
	sprintf(fileName,"mask_t%03d.tif",fileNo);
	sprintf(fileName,"%s/mask_t%03d.tif",path,fileNo);
#ifdef DO_PHASE_II_AND_III
 #ifdef DO_ANISOTROPIC_OUTPUT
	//re-render (!, instead of resampling) also the mask before exporting