Ejemplo n.º 1
0
// Loop over layers, creating all: subdirs, scripts, work files.
//
static void ForEachLayer()
{
	int	is0, isN;

	TS.GetLayerLimits( is0 = 0, isN );

	while( isN != -1 ) {

		char	lyrdir[2048];

		CreateLayerDir( lyrdir, TS.vtil[is0].z );

		TS.WriteTileToImage( gtopdir, false, ismrc, is0, isN );

		if( gArgs.NoFolds ) {

			if( ismrc )
				Make_MakeFM( lyrdir, is0, isN );
			else
				Make_fmsame( lyrdir, is0, isN );
		}
		else {
			Make_TileToFM( lyrdir, "TileToFM",  "fm",  is0, isN );
			Make_TileToFM( lyrdir, "TileToFMD", "fmd", is0, isN );
			Make_MakeFM( lyrdir, is0, isN );
		}

		TS.GetLayerLimits( is0 = isN, isN );
	}
}
Ejemplo n.º 2
0
void CSuperscape::FindLayerIndices( int z )
{
	TS.GetLayerLimits( is0 = 0, isN );

	while( isN != -1 && TS.vtil[is0].z != z )
		TS.GetLayerLimits( is0 = isN, isN );
}
Ejemplo n.º 3
0
int main( int argc, char* argv[] )
{
	clock_t		t0 = StartTiming();

/* ------------------ */
/* Parse command line */
/* ------------------ */

	gArgs.SetCmdLine( argc, argv );

	TS.SetLogFile( flog );

	if( !ReadScriptParams( scr, gArgs.script, flog ) )
		goto exit;

	inv_scl = 1.0 / scr.crossscale;

/* ---------------- */
/* Read source data */
/* ---------------- */

	if( gArgs.zb >= 0 && gArgs.za < 0 )
		gArgs.za = gArgs.zb;

	TS.FillFromRgns( gArgs.srcmons, gArgs.idb, gArgs.zb, gArgs.za );

	fprintf( flog, "Got %d images.\n", (int)TS.vtil.size() );

	if( !TS.vtil.size() )
		goto exit;

	TS.SetTileDimsFromImageFile();
	TS.GetTileDims( gW, gH );

	t0 = StopTiming( flog, "ReadFile", t0 );

/* ------------- */
/* Sort by layer */
/* ------------- */

	TS.SortAll_z();

/* ----- */
/* Stuff */
/* ----- */

	ScapeStuff();

/* ---- */
/* Done */
/* ---- */

exit:
	fprintf( flog, "\n" );
	VMStats( flog );
	fclose( flog );

	return 0;
}
Ejemplo n.º 4
0
bool CSuperscape::MakeRasH()
{
// Collect strip tiles

	vector<int>	vid;
	int			w1, w2, h1, h2;

	w1 = int(Bxw * 0.45);
	w2 = Bxc + w1;
	w1 = Bxc - w1;

	h1 = (scr.stripwidth * gH)/2;
	h2 = Byc + h1;
	h1 = Byc - h1;

	for( int i = is0; i < isN; ++i ) {

		const CUTile&	U = TS.vtil[i];

		if( U.T.t[2] + gW > w1 && U.T.t[2] < w2 &&
			U.T.t[5] + gH > h1 && U.T.t[5] < h2 ) {

			vid.push_back( i );
		}
	}

	ras = TS.Scape( ws, hs, x0, y0,
			vid, inv_scl, 1, 0,
			scr.legendremaxorder, scr.rendersdevcnts,
			scr.maskoutresin );

	return (ras != NULL);
}
Ejemplo n.º 5
0
static void FindPairs(
	const vector<BlkZ>		&vZ,
	vector<vector<Pair> >	&P,
	const CSuperscape		&A,
	const CSuperscape		&B )
{
	int		iz = vZ.size() - 1;
	TAffine	Tm = vZ[iz].T;

	for( int ia = 0; ia < gDat.ntil; ++ia ) {

		int				aid = A.vID[ia];
		vector<Pair>	&p  = P[ia];
		TAffine			Ta  = Tm * TS.vtil[aid].T;

		for( int bid = B.is0; bid < B.isN; ++bid ) {

			TAffine	Tab;
			Tab.FromAToB( Ta, TS.vtil[bid].T );

			double	area = TS.ABOlap( aid, bid, &Tab );

			if( area >= kPairMinOlap )
				p.push_back( Pair( area, bid, iz ) );
		}
	}
}
Ejemplo n.º 6
0
bool CSuperscape::MakeRasA()
{
	ras = TS.Scape( ws, hs, x0, y0,
			vID, inv_scl, 1, 0,
			scr.legendremaxorder, scr.rendersdevcnts,
			scr.maskoutresin, scr.blockslots );

	return (ras != NULL);
}
Ejemplo n.º 7
0
bool CSuperscape::MakeWholeRaster()
{
	vector<int>	vid( isN - is0 );

	for( int i = is0; i < isN; ++i )
		vid[i - is0] = i;

	ras = TS.Scape( ws, hs, x0, y0,
			vid, inv_scl, 1, 0,
			scr.legendremaxorder, scr.rendersdevcnts,
			scr.maskoutresin );

	return (ras != NULL);
}
Ejemplo n.º 8
0
static void WriteImageparamsFile()
{
	char	name[2048];
	FILE	*f;
	int		w, h;

	TS.GetTileDims( w, h );

	sprintf( name, "%s/imageparams.txt", gArgs.outdir );

	f = FileOpenOrDie( name, "w", flog );

	fprintf( f, "IDBPATH %s\n", gtopdir );
	fprintf( f, "IMAGESIZE %d %d\n", w, h );

	fclose( f );
}
Ejemplo n.º 9
0
bool CSuperscape::MakeRasB( const DBox &Abb )
{
	vector<int>	vid;
	int			W2 = gW/2, H2 = gH/2;

	for( int i = is0; i < isN; ++i ) {

		const CUTile& U = TS.vtil[i];

		Point	p( W2, H2 );
		U.T.Transform( p );

		if( p.x >= Abb.L && p.x <= Abb.R &&
			p.y >= Abb.B && p.y <= Abb.T ) {

			vid.push_back( i );
		}
	}

	if( vid.size() < 0.05 * gDat.ntil ) {

		fprintf( flog, "Low B tile count [%ld] for z=%d.\n",
		vid.size(), TS.vtil[is0].z );

		return false;
	}

	ras = TS.Scape( ws, hs, x0, y0,
			vid, inv_scl, 1, 0,
			scr.legendremaxorder, scr.rendersdevcnts,
			scr.maskoutresin, scr.blockslots );

	if( !ras ) {

		fprintf( flog, "Empty B scape for z=%d.\n",
		TS.vtil[is0].z );

		return false;
	}

	return (ras != NULL);
}
Ejemplo n.º 10
0
int main( int argc, char* argv[] )
{
/* ------------------ */
/* Parse command line */
/* ------------------ */

	gArgs.SetCmdLine( argc, argv );

	TS.SetLogFile( flog );

/* ---------------- */
/* Read source file */
/* ---------------- */

	int		isrickfile = !FileIsExt( gArgs.infile, ".xml" );

	if( isrickfile )
		TS.FillFromRickFile( gArgs.infile, gArgs.zmin, gArgs.zmax );
	else
		TS.FillFromTrakEM2( gArgs.infile, gArgs.zmin, gArgs.zmax );

	fprintf( flog, "Got %d images.\n", (int)TS.vtil.size() );

	if( !TS.vtil.size() )
		goto exit;

	if( isrickfile )
		TS.SetTileDimsFromImageFile();

	TS.SortAll_z_id();

	ismrc = FileIsExt( TS.vtil[0].name.c_str(), ".mrc" );

	if( ismrc )
		Make_nmrc_paths();

/* ----------- */
/* Diagnostics */
/* ----------- */

	if( isrickfile || ismrc ) {

		TS.WriteTrakEM2_EZ( "PreClicks.xml",
			gArgs.xml_type, gArgs.xml_min, gArgs.xml_max );
	}

	if( gArgs.clk ) {

		TS.ApplyClix( tsClixAffine, gArgs.clk );

		TS.WriteTrakEM2_EZ( "PostClicks.xml",
			gArgs.xml_type, gArgs.xml_min, gArgs.xml_max );
	}

/* ----------------------- */
/* Just make generator xml */
/* ----------------------- */

	if( !gArgs.outdir[0] || !strcmp( gArgs.outdir, "NoSuch" ) )
		goto exit;

/* --------------- */
/* Create dir tree */
/* --------------- */

	CreateTopDir();

	WriteImageparamsFile();
	CopyCropFile();
	CopyLensFile();

	if( !gArgs.NoFolds || ismrc ) {
		WriteSubfmFile();
		WriteReportFile();
	}

	ForEachLayer();

/* ---- */
/* Done */
/* ---- */

exit:
	fprintf( flog, "\n" );
	fclose( flog );

	return 0;
}
Ejemplo n.º 11
0
// Find is0 such that [is0,isN) is whole layer.
//
// Return is0.
//
int CSuperscape::FindLayerIndices( int next_isN )
{
	TS.GetLayerLimitsR( is0, isN = next_isN );
	return is0;
}
Ejemplo n.º 12
0
int main( int argc, char* argv[] )
{
	clock_t		t0 = StartTiming();

/* ------------------ */
/* Parse command line */
/* ------------------ */

	gArgs.SetCmdLine( argc, argv );

	TS.SetLogFile( flog );

	if( !ReadScriptParams( scr, gArgs.script, flog ) )
		exit( 42 );

	if( scr.blockreqdz < 1 )
		scr.blockreqdz == 1;
	else if( scr.blockreqdz > scr.blockmaxdz )
		scr.blockreqdz = scr.blockmaxdz;

	inv_scl = 1.0 / scr.crossscale;

/* --------------- */
/* Read block data */
/* --------------- */

	gDat.ReadFile();

	if( gArgs.abdbg ) {

		if( gArgs.dbgz == -1 )
			gArgs.dbgz = gDat.za - 1;

		gDat.zmin = gArgs.dbgz;
	}

/* ---------------- */
/* Read source data */
/* ---------------- */

	string	idb;

	IDBFromTemp( idb, "../..", flog );

	if( idb.empty() )
		exit( 42 );

	TS.FillFromRgns( gDat.scaf, idb, gDat.zmin, gDat.za );

	fprintf( flog, "Got %d images.\n", (int)TS.vtil.size() );

	if( !TS.vtil.size() )
		goto exit;

	TS.SetTileDimsFromImageFile();
	TS.GetTileDims( gW, gH );

	t0 = StopTiming( flog, "ReadFile", t0 );

/* ------------- */
/* Sort by layer */
/* ------------- */

	TS.SortAll_z();

/* ----- */
/* Stuff */
/* ----- */

	LayerLoop();

/* ---- */
/* Done */
/* ---- */

exit:
	fprintf( flog, "\n" );
	VMStats( flog );
	fclose( flog );

	return 0;
}