PA #4: MIMP Processing Pipeline

Objectives

The purpose of this assignment is to gain experience working with polymorphism and dynamic binding.

Introduction

In the first two programming assignments you completed a graphical application that allowed a user to load an image, apply a number of different image transformations, and then save the results to a file. This work flow is fine for one-off image manipulations, but it's not ideal for repetitive, high-throughput, image processing tasks.

An example of an area that involves repetitive image processing is pathology. Pathologists make diagnostic decisions by examining laboratory samples under a microscope. The diagnosis may depend on the cell shapes or the number of cells observed in a particular sample. This work can be very tedious, requiring accurate evaluations of dozens of specimens each day.

Computerized image processing can simplify some aspects of these diagnostic decisions. As an example, imagine that a pathologist needs to estimate the number of cells present in the following sample:

As a first step, she might convert the image to grayscale. Color is not relevant for this task. Darker regions of the image correspond to cells regardless of their color:

Next she performs a 3x3 blur of the image to remove some of the unnecessary detail. In this case, the goal is to count the largish dots. Smaller features are not relevant.

Next she performs a threshold operation to isolate the cells from the background:

This is getting close, but it would be difficult to obtain an accurate count from this image. It isn't clear whether we should count the tiny dots, and it looks like some individual cells are showing up as small clusters. One more round of blurring and thresholding will smear away the isolated dots, and recombine clusters into recognizable shapes:



Success! This image will be much easier to work with than the image we started with. It would be relatively simple for a human (or a program) to count the dots in this image.

It would obviously be inconvenient to repeat the process outlined above, by hand, on dozens of images every day. Your goal for this assignment is to create a framework that makes it possible to store a sequence of image transforms so that they may be repeatedly applied to any number of images.

We will refer to a particular sequence of image transformations as a "pipeline". The pipeline described above could be graphically represented as follows:

The arrows represent the fact that the stages of the pipeline are sequential: the output of one transformation becomes the input to the next.

Program Specification

You will create (at least) 5 classes for this project: one class representing each of the image transformations defined in ImageTransforms.java and a Pipeline class that will represent an arbitrarily long sequence of transformations. Your classes should have the following names:

The constructors for each of your transformation classes will take arguments that correspond to the arguments required by the corresponding methods. For example, the AdjustBrightness constructor will take a single integer argument representing the amount that the brightness should be adjusted.

The following driver class illustrates how these classes will be used:

as you can see in this driver, the Pipeline class must have an add method that adds an additional transform to the pipeline, as well as a transform method that takes an image argument and returns the image that results from applying each of the pipeline transformations in turn. The original image should not be modified. Notice that a pipeline may include another pipeline as one of its components.

Your finished classes must work with this driver. If your code is working correctly, executing this driver in a directory containing the file madison.jpg should create two image files like the following: madison_transform1.jpg and madison_transform2.jpg.

Suggestions

You should not restrict yourself to the classes and methods described above. A good design will include additional classes and/or interfaces and/or methods.

Part of your grade for this project will be based on your design. I strongly encourage you to run your design past me before you start working on your implementation.

The transform classes introduced above should be simple . You shouldn't even need to copy the the methods from ImageTransforms.java into your new classes. They can just call the existing methods as needed.

Submitting/Grading

Submit all of your newly created files through Web-CAT by the project deadline. You should NOT submit any of the classes that were written for any of the previous MIMP projects.

Your grade will be based on the following factors, and may also be affected by the number of submissions that you make. See below for more details on how each component will be calculated.

Autograding based on correctness/testing: 60%
Instructor grading based on design: 20%
Autograding based on static analysis of style: 10%
Instructor grading based on style and readability: 10%

You do not need to submit your own unit tests for this project. Your code will be tested against instructor provided unit tests.

Autograding based on static analysis of style

Web-CAT will use checkstyle to analyze your code for conformance to the course style guide. I strongly suggest that you to install checkstyle for Eclipse on your own machine so that you can run your own style checks before submission. You can find the checkstyle configuration file that Web-CAT will use on the course supplemental material page.

Instructor grading based on style and readability

This portion of your grade will based on stylistic issues that cannot be checked automatically. This includes:

Submission penalties

Your grade will also be based on the number of submissions that you make. You may make one free submission per day. Beyond those free submissions, you may make up to six submissions with no penalty. Your grade will then be reduced by 3% after every six submissions:

Number of submissions Penalty
1-6 0
7-12 -3%
13-18 -6%
... ...