コード例 #1
0
ファイル: main.cpp プロジェクト: idvr/fdoct-gpu-code
int main()
{
	bool fileRead = true;

	int frameWidth = 1024;
	int frameHeight =300;
	int framesPerBuffer = 30; //This value needs to be divisble by 3, and a factor of the total number of frames
	int samplingMethod  = 0; //0 for Interpolation, 1 for Fast Cubic, 2 for Pref Cubic
	int volumeFrames = 900; //Useless for this code

//OpenGL ONLY Variables to be transferred
	bool processData = true;  //MUST be true
	bool fundusRender = true; //Can be false or true
	bool volumeRender = false; //Volume render currently does not work with speckle variance in this version of the code
	int fileLen;
	int bufferLen;
	int windowWidth = 1080;
	int windowHeight = 720;

	buffer *h_buffer = new buffer[BUFFNUM];
	int buffCtr = 0;
	unsigned short *h_ProcBuffer;

	bool *registeredHost;

	enum volumeDisplay {DownSize, Crop};
	volumeDisplay volumeMode = Crop;

//CUDA ONLY Variables to be transferred
	int fftLenMult = 2;
	float dispMag = 10;
	float dispVal = -6.5f * pow(0.1f,5);
	float dispValThird = 0;

	//Calculation of lookupLambda Coordinates
	float lambda_Max= LAMBDA_MIN	+	(frameWidth-1) * D_LAMBDA	+
					pow((frameWidth-1.0f),2) * SECOND_ORDER_CORRECTION	+
					pow((frameWidth-1.0f),3) * THIRD_ORDER_CORRECTION	+
					pow((frameWidth-1.0f),4) * FOURTH_ORDER_CORRECTION;
// END OF DEFINING CUDA VARIABLES

	//Define the filename of the file to be used for acquisition simulation
	char *fileName = new char[100];
//	fileName = "c:\\OCTViewer\\SDD\\fullvolume"; 
	dispVal = 2.3f * pow(0.1f,5);
//fileName = "F:\\RightEye(042213)\\WT_Scratchback_PV_R_4-ON---1.unp"; dispVal = 2.3f * pow(0.1f,5);
//fileName = "F:\\SS-OCT\\SS-OCT\\For Robert\\ssdata.dat";
	fileName = "f:\\Jing\\SPIE\\mouse data\\800middle-ON---1";	
	//fileName = "G:\\randow\\09192013\\2500-ON---1.unp";
		//  fileName = "g:\\randow\\SVTest3-ON---1.unp";
//fileName = "c:\\OCTViewer\\SDD\\fullvolume"; dispVal = 2.3f * pow(0.1f,5);


	FILE *file = fopen(fileName, "rb");
	if (file==NULL)
	{	printf("Unable to Open file. Exiting Program...\n"); exit(1);}
	fseek(file, 0, SEEK_END);
	fileLen=ftell(file)/(int)sizeof(unsigned short);
	fclose(file);


	if (fileRead) {
		bufferLen = fileLen;
		volumeFrames = fileLen / (frameWidth*frameHeight);
	} 
	else if (volumeRender || fundusRender) {
		bufferLen = frameWidth*frameHeight*volumeFrames;
	} else {
		bufferLen = frameWidth*frameHeight*framesPerBuffer;
	}

	for (int i=0; i<BUFFNUM; i++) {
		h_buffer[i].data = (unsigned short *)malloc(bufferLen * sizeof(unsigned short));
		h_buffer[i].regHost = false;
	}


//Initiate FileRead Thread
	FileReadThread FileRead;
	FileRead.create();
	FileRead.InitFileRead(fileName, h_buffer, &buffCtr, &bufferLen);

//Initiate the Process Thread
	ProcessThread Proc;
	Proc.create();
	Proc.InitProcess(	h_buffer, &buffCtr, processData, volumeRender, fundusRender,
						frameWidth, frameHeight, framesPerBuffer,volumeFrames, bufferLen, 
						windowWidth, windowHeight, samplingMethod, (int)volumeMode, fftLenMult,
						LAMBDA_MIN, lambda_Max, dispMag, dispVal, dispValThird);
//END OF INITIALIZATION
//Begin Process Thread
	FileRead.start();
	Proc.start();
	FileRead.join();
	Proc.join();

	return 0;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Hyung-Jin/sfu_borg_oct
int main()
{
	bool fileRead = false;

	int frameWidth = 1024;
	int frameHeight = 300;
	int framesPerBuffer = 20;
	int volumeSize = 100;


//OpenGL ONLY Variables to be transferred
	//Process Data MUST be true
	//Display pre-processed data currently does NOT work!!
	bool processData = true;  //MUST be true
	bool fundusRender = true; //Can be false or true
	bool volumeRender = true; //Can be false or true
	int fileLen;
	int bufferLen;
	int windowWidth = 1024;
	int windowHeight = 1024;
	buffer *h_buffer = new buffer[BUFFNUM];
	int buffCtr = 0;
	unsigned short *h_ProcBuffer;
	bool *registeredHost;
	enum volumeDisplay {DownSize, Crop};
	volumeDisplay volumeMode = Crop;

//CUDA ONLY Variables to be transferred
	int fftLenMult = 2;
// END OF DEFINING CUDA VARIABLES

	//Define the filename to be used for file acquisition simulation
	char *fileName = new char[100];
	fileName = "../../../.data/Mouse-Dataset.unp";

	FILE *file = fopen(fileName, "rb");
	if (file==NULL)
	{	printf("Unable to Open file. Exiting Program...\n"); exit(1);}
	fseek(file, 0, SEEK_END);
	fileLen=ftell(file)/(int)sizeof(unsigned short);
	fclose(file);
	
	if (volumeRender || fundusRender) {
		if (fileRead) {
			bufferLen = fileLen;
		} else {
			bufferLen = frameWidth*frameHeight*volumeSize;
		}
	} else {
		bufferLen = frameWidth*frameHeight*framesPerBuffer;
	}

	for (int i=0; i<BUFFNUM; i++) {
		h_buffer[i].data = (unsigned short *)malloc(bufferLen * sizeof(unsigned short));
		h_buffer[i].regHost = false;
	}


//Initiate FileRead Thread
	FileReadThread FileRead;
	FileRead.create();
	FileRead.InitFileRead(fileName, h_buffer, &buffCtr, &bufferLen);

//Initiate the Process Thread
	ProcessThread Proc;
	Proc.create();
	Proc.InitProcess(	h_buffer, &buffCtr, processData, volumeRender, fundusRender, 
						frameWidth, frameHeight, framesPerBuffer, bufferLen, 
						windowWidth, windowHeight, (int)volumeMode, fftLenMult);
//END OF INITIALIZATION
//Begin Process Thread
	FileRead.start();
	Proc.start();
	FileRead.join();
	Proc.join();

	return 0;
}