예제 #1
0
/*
 *  Create the WormAnalysisDataStruct
 *  Initialize Memory Storage
 *  Set all Pointers to Null.
 *  Run CvCreate Sequence
 *
 *  Note this does not allocate memory for images because the user may not know
 *  what size image is wanted yet.
 *
 *  To do that use LoadWormColorOriginal()
 *
 */
WormAnalysisData* CreateWormAnalysisDataStruct(){
	WormAnalysisData* WormPtr;
	WormPtr=(WormAnalysisData*) malloc(sizeof(WormAnalysisData));


	/*** Set Everythingm To NULL ***/
	WormPtr->Head=NULL;
	WormPtr->Tail=NULL;
	WormPtr->HeadIndex=0;
	WormPtr->TailIndex=0;
	WormPtr->ImgOrig =NULL;
	WormPtr->ImgSmooth =NULL;
	WormPtr->ImgThresh =NULL;

	WormPtr->frameNum=0;
	WormPtr->frameNumCamInternal=0;


	WormPtr->SizeOfImage.height = 0;
	WormPtr->SizeOfImage.width= 0;

	WormPtr->timestamp=0;

	/*** Initialze Worm Memory Storage***/
	InitializeWormMemStorage(WormPtr);

	/**** Allocate Memory for CvSeq ***/
	WormPtr->Boundary=cvCreateSeq(CV_SEQ_ELTYPE_POINT,sizeof(CvSeq),sizeof(CvPoint),WormPtr->MemStorage);
	WormPtr->Centerline=cvCreateSeq(CV_SEQ_ELTYPE_POINT,sizeof(CvSeq),sizeof(CvPoint),WormPtr->MemStorage);



	/*** Create Segmented Worm Object ***/
	WormPtr->Segmented= CreateSegmentedWormStruct();

	/** Create Time Evolution Worm Object **/
	WormPtr->TimeEvolution= CreateWormTimeEvolution();

	/** Position on plate information **/
	WormPtr->stageVelocity=cvPoint(0,0);

	return WormPtr;
}
예제 #2
0
/*
 * This function allocates images and frames
 * And a Worm Object
 *
 * And a Parameter Object
 * For internal manipulation
 *
 *
 */
void InitializeExperiment(Experiment* exp) {

	/*** Create IplImage **/
	IplImage* SubSampled = cvCreateImage(cvSize(NSIZEX / 2, NSIZEY / 2),
			IPL_DEPTH_8U, 1);
	IplImage* HUDS = cvCreateImage(cvSize(NSIZEX, NSIZEY), IPL_DEPTH_8U, 1);


	exp->CurrentSelectedImg= cvCreateImage(cvSize(NSIZEX,NSIZEY), IPL_DEPTH_8U,1);

	exp->SubSampled = SubSampled;
	exp->HUDS = HUDS;

	/*** Create Frames **/
	Frame* fromCCD = CreateFrame(cvSize(NSIZEX, NSIZEY));
	Frame* forDLP = CreateFrame(cvSize(NSIZEX, NSIZEY));
	Frame* IlluminationFrame = CreateFrame(cvSize(NSIZEX, NSIZEY));

	exp->fromCCD = fromCCD;
	exp->forDLP = forDLP;
	exp->IlluminationFrame = IlluminationFrame;

	/** Create Worm Data Struct and Worm Parameter Struct **/
	WormAnalysisData* Worm = CreateWormAnalysisDataStruct();
	WormAnalysisParam* Params = CreateWormAnalysisParam();
	InitializeEmptyWormImages(Worm, cvSize(NSIZEX, NSIZEY));
	InitializeWormMemStorage(Worm);

	/** Create SegWormDLP object using memory from the worm object **/
	exp->segWormDLP = CreateSegmentedWormStruct();

	exp->Worm = Worm;
	exp->Params = Params;

	/** Setup Previous Worm **/
	WormGeom* PrevWorm = CreateWormGeom();
	exp->PrevWorm = PrevWorm;

}