Commit 102b7a76 authored by Timm Schoening's avatar Timm Schoening
Browse files

Initial commit of the CoMoNoD algorithm with example file

parents
Loading
Loading
Loading
Loading

comonod.hpp

0 → 100644
+0 −0

File added.

Preview size limit exceeded, changes collapsed.

example

0 → 100755
+314 KiB

File added.

No diff preview for this file type.

example.cpp

0 → 100644
+47 −0
Original line number Diff line number Diff line
#include "comonod.hpp"

using namespace std;

int main() {

	// Load input image
	cv::Mat img = cv::imread("/media/tschoening/files/data/nodule_datasets/JC120_NOCS_AutoSub/images/Picture_42.jpg");

	// CoMoNoD input parameter that governs the selection of the adaptive threshold
	float theta_gamma = 0.08;

	// CoMoNoD input parameter representing the minimum nodule size in px
	uint theta_r = 5;
	
	// The median area of all images in the data set (in m^2)
	float median_area = 1.745380165;

	// The area of the image to be processed (in m^2)
	float image_area = 1.983397784;

	// The top left and bottom right pixel coordinates of the region of interest to process with CoMoNoD
	cv::Point top_left(100,100);
	cv::Point bottom_right(img.cols-100,img.rows-100);

	// Execute the contrast maximization, nodule delineation and nodule statistic computation
	vector<double> phis;
	
	// Run CoMoNoD and filter for nodules larger than 3.14cm^2 size
	if(ocv::runCoMoNoD(img,theta_gamma, theta_r, median_area, image_area, top_left, bottom_right, phis, 3.14)) {

// NOTE: Phis contains descriptive nodule statistics for the image.
// NOTE: Further analysis would follow here.
	
		// Dump the phis
		for(double phi : phis)
			cout << phi << " ";
		cout << endl;
		
		// Compute and dump the Trask particle size metrics
		for(double val : ocv::particleSizeAnalysis({phis[2],phis[3],phis[4]}))
			cout << val << " ";
		cout << endl;
		
	}

}