public ImagePlus segment(String path){
		InputImage input;
		try{
			input = new InputImage(path);
		} catch (FileNotFoundException e){
			return null;
		}
		ImageProcessor origImg = input.getOrig().getProcessor();
		ImageProcessor adjustedImg = input.getAdjusted().getProcessor();
		int width = origImg.getWidth();
		int height = adjustedImg.getHeight();
		
		//test constant
		if(BlurDetector.detectBlur(origImg, .1)){
			System.err.println("Discarding image " + path + " due to blurriness");
			return null;
		}
		
		ImageProcessor minSuppres = doMinimumSuppression(origImg, adjustedImg);
		
		//Now perform difference of Gaussians
		ImageProcessor en = gaussDifference(minSuppres, 8.0, 5.0);
		
		en.copyBits(minSuppres, 0, 0, Blitter.MULTIPLY);
		
		//Detect edges
		ImageProcessor e = canny.canny(en);
	
		//dilate the image
		filter.rank(e, 10, RankFilters.MAX);
		
		e = bwAreaOpen(e, 500);
		e = bwAreaOpen(e, 300);
		
		fillHoles(e);
		
		ImageProcessor cells = findCells(e).convertToFloatProcessor();
		
		//smoothing
		ImageProcessor presmooth1 = cells.duplicate();
		presmooth1.resetMinAndMax();
		
		ImageProcessor smooth = doSmoothing(cells, adjustedImg);
		
		List<Point> maximList = findMaxima(smooth);
		
		ImageProcessor boundaries = findBoundaries(e);		
		
		//The ith maximum belongs to the jth cell (belongs[i] = j)
		Hashtable<Point, BoundaryBox> belongs = new Hashtable<Point, BoundaryBox>();
		for(int i = 0; i < maximList.size(); i++){
			Point p = maximList.get(i);
			belongs.put(p, new BoundaryBox(p, presmooth1));
		}
		
		ImageProcessor imc = origImg.convertToFloatProcessor();
		imc.invert();
		
		boundaries = findConnectedComponents(boundaries);
		
		double[] hMin = findhMin(maximList, belongs, width, height, boundaries, imc, presmooth1);
		
		ImageProcessor threshSmooth = presmooth1.convertToByteProcessor(true);
		threshSmooth.threshold(0);
		
		List<BoundaryBox> bbs = BoundaryBox.getBoundaries(threshSmooth, maximList);
		
		ImageProcessor mask = performWatershedding(maximList, bbs, width, height, hMin, origImg);
		
		//System.out.println("Time elapsed: " + (System.nanoTime() - begin)/1000000000.0 + " seconds");
		return new ImagePlus("Segmented image", mask); //TODO: change when completed testing
	}