Пример #1
0
IppStatus PrintOutputImages(const Image2D &image_in, const Image2D &image_bpass, const Image2D &image_localmax,
							const Params &Parameters, const int framenumber, const int stacknumber,
							FIMULTIBITMAP *filt_imagestack, FIMULTIBITMAP *over_imagestack)
{
	IppStatus status;

	Image2D image_out(image_in.get_length(), image_in.get_width());
	Image2D image_overlay(image_in.get_length(), image_in.get_width());
	Image2D centerpoints(image_in.get_length(), image_in.get_width());

	Ipp32f brightness = 75;

	//scale points to brightness
	status = ippiMulC_32f_C1R(image_localmax.get_image2D(), image_localmax.get_stepsize(), brightness,
		centerpoints.get_image2D(), centerpoints.get_stepsize(), image_localmax.get_ROIfull());

	//convert and save files as TIFFs
	status = ippiAdd_32f_C1R(
		image_bpass.get_image2D(), image_bpass.get_stepsize(),
		centerpoints.get_image2D(), centerpoints.get_stepsize(),
		image_out.get_image2D(), image_out.get_stepsize(),
		image_out.get_ROIfull());

	status = ippiAdd_32f_C1R(
		image_in.get_image2D(), image_in.get_stepsize(),
		centerpoints.get_image2D(), centerpoints.get_stepsize(),
		image_overlay.get_image2D(), image_overlay.get_stepsize(),
		image_in.get_ROIfull());

	status = IPP_to_TIFF(image_overlay, over_imagestack);
	status = IPP_to_TIFF(image_out, filt_imagestack);
	return status;
}
Пример #2
0
IppStatus FindLocalMax_2D(Image2D &image_bpass, Image2D &image_bpass_thresh, Image2D &image_subtracted,
						  const int intensity_threshold, const int dilation_radius)
{
	IppStatus status;
	Image2D image_dilated(image_bpass.get_length(), image_bpass.get_width());
	Dilation_Kernel DilationKernel(dilation_radius, image_bpass.get_width(), image_bpass.get_length());

	//Threshold darker pixels in bandpassed image (in preparation for later subtraction)
	RecenterImage(image_bpass);
	status = ippiThreshold_LTVal_32f_C1R(image_bpass.get_image2D(), image_bpass.get_stepsize(),
		image_bpass_thresh.get_image2D(), image_bpass_thresh.get_stepsize(),
		image_bpass.get_ROIfull(), intensity_threshold, intensity_threshold);

	//Dilate Bandpassed image with a circular kernel
	status = ippiSet_32f_C1R(intensity_threshold, image_dilated.get_image2D(), image_dilated.get_stepsize(),
		image_dilated.get_ROIfull());
	status = ippiDilate_32f_C1R(
		//image_bpass.get_image2D() + DilationKernel.get_offset(), image_bpass.get_stepsize(),
		image_bpass_thresh.get_image2D() + DilationKernel.get_offset(), image_bpass_thresh.get_stepsize(),
		image_dilated.get_image2D()+ DilationKernel.get_offset(), image_dilated.get_stepsize(),
		DilationKernel.get_ROI_size(), DilationKernel.get_dilation_kernel(), DilationKernel.get_mask_size(),
		DilationKernel.get_anchor_point());

	//subtract, such that resulting array is negative to zero (for later exponentation)
	status = ippiSub_32f_C1R(
		image_dilated.get_image2D(), image_dilated.get_stepsize(),
		image_bpass.get_image2D(), image_bpass.get_stepsize(),
		image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_bpass.get_ROIfull());

	//exponentiate subtracted array, then threshold
	status = ippiExp_32f_C1IR(image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_subtracted.get_ROIfull());
	status = ippiThreshold_LTValGTVal_32f_C1IR(image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_subtracted.get_ROIfull(), 1-epsilon, 0, 1-epsilon, 1);
	return status;
}
Пример #3
0
IppStatus BandPass_2D(Image2D &image_in, Image2D &image_bandpassed, const int feature_radius, const int hwhm_length)
{
	//set status variable
	IppStatus status;
	Gaussian_Kernel GaussKernel(feature_radius, hwhm_length, image_in.get_width(), image_in.get_length());
	Convolution_Kernel ConvolutionKernels(feature_radius, image_in.get_width(), image_in.get_length());
	Tophat_Kernel TopHatKernel(feature_radius, image_in.get_width(), image_in.get_length());
	int number_of_pixels = image_in.get_numberofpixels();
	int step_size = image_in.get_stepsize();

	//Create and initialize intermediate images
	Image2D image_gauss_col(image_in.get_length(), image_in.get_width());
	Image2D image_gauss_rowcol(image_in.get_length(), image_in.get_width());
	Image2D image_tophat(image_in.get_length(), image_in.get_width());

	//Gaussian kernel convolution
	status = ippiFilterColumn_32f_C1R(image_in.get_image2D() + GaussKernel.get_offset(), step_size,
		image_gauss_col.get_image2D() + GaussKernel.get_offset(), step_size,
		GaussKernel.get_ROI_size(), GaussKernel.get_gaussian_kernel(),
		GaussKernel.get_kernel_length(), GaussKernel.get_anchor_point());
	status = ippiFilterRow_32f_C1R(image_gauss_col.get_image2D() + GaussKernel.get_offset(), step_size,
		image_gauss_rowcol.get_image2D() + GaussKernel.get_offset(), step_size,
		GaussKernel.get_ROI_size(), GaussKernel.get_gaussian_kernel(),
		GaussKernel.get_kernel_length(), GaussKernel.get_anchor_point());

/*
	//tophat kernel convolution/filterbox operation
	status = ippiFilterBox_32f_C1R(image_in.get_image2D() + TopHatKernel.get_offset(), step_size,
		image_tophat.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size(), TopHatKernel.get_mask_size(),
		TopHatKernel.get_anchor_point());
*/

	//change by Eli Sloutskin: take away bias of square filtering kernel
    status = ippiConvValid_32f_C1R(image_in.get_image2D(), step_size, image_in.get_ROIfull(),
            ConvolutionKernels.get_circle_kernel(), ConvolutionKernels.get_kernel_step(), ConvolutionKernels.get_kernel_size(),
            image_tophat.get_image2D() + ConvolutionKernels.get_offset(), step_size);

    ippiDivC_32f_C1IR(3*feature_radius*feature_radius, image_tophat.get_image2D(),image_tophat.get_stepsize(),image_tophat.get_ROIfull());

	//subtract the two images
	status = ippiSub_32f_C1R(image_tophat.get_image2D() + TopHatKernel.get_offset(), step_size,
		image_gauss_rowcol.get_image2D()+TopHatKernel.get_offset(), step_size,
		image_bandpassed.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size());

	//cutoff values below zero
	status = ippiThreshold_LTVal_32f_C1IR(image_bandpassed.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size(),0,0);

	return status;
}