Thursday, June 30, 2011

WPF

A few new bugs have popped up but some have been fixed.

Program can now cycle through a directory next/back and run on each item. Infrequently crashes (at random) due to Generic Error in GDI+, COM Dead Lock, or Argument Exceptions.

Trying to pinpoint why this is.

Tuesday, June 28, 2011

WPF

Lots of bug fixes. It appears all memory managing has been fixed. The program only crashes for Argument exception when the bitmap is -somehow- blank/full of errors. Or the generic error occurring in GDI+.

On one occasion the program crashed due to a COM deadlock.

The program now creates a directory, and in it places the final processed image. Text files for measurements made along with a JPG/thumbnail of what the blob looks like in the original imaged named in a unique way which can always be converted back to the blob found.

Monday, June 27, 2011

Zoom and panning works

You are able to zoom and pan the image, but using the splitting / gestures on diatoms that you have zoomed into doesn't work yet.

When you zoom in you can still use the overlay, and view the original image, etc.

User had a hard time with gestures (on the tablet) but said that they would get used to the controls, Everything functions to what is needed. But it erases some smaller diatoms that they would need (by default). So I have lowered the default min blob width/height.

Wednesday, June 22, 2011

WPF

Program save button removed - On measure, the program will automatically save a thumbnail of the diatom.

Perimeter works (Accuracy unknown) - Uses convex hull.

Erosion and Threshold functions work much better now. Still bugs with overlapping diatoms currently.

Tried a few different grayscaling algorithms, but none have worked. I tried using histograms (Red, Green, and Blue) to get which there were more of for the normal Grayscale. Still, doesn't function on one entire set of images.

Can now open images after another image has been opened. Program frees unused memory and clears garbage collection. But even with that it still has out of memory errors. There must be something that I am creating that isn't being disposed.

Idea for running on an entire folder of images.

If all the images are similar user can "calibrate" the program on the first image.
-set up the grayscale coefficients, and the threshold that gives the best result.

Then the program can run with this information, placing copies in a folder named after the original (-processed added to the end).

Then the user can do the calculations/actions required on each image. Because the original and new images are both accessible the overlay will still work (but not for Edge Detection, Fill Holes, Grayscale, etc.)

Tuesday, June 21, 2011

WPF

Got some more bugs now. I figured out why they are happening, but I'm not sure about how to go about fixing.

Threshold by selection is completed and functions (you draw a square - gesturewise)

Erode single diatoms functions (bug if blobs are overlapping)

Main bug is that when ever I clone an image (from bitmap source) it gives me an out of memory exception.

Bitmap Source --> Bitmap Image (Clone[Rectangle, Bitmap Image Pixel Format])

I was told this error in C# doesn't necessarily mean Out of Memory. But that you could have an unsupported pixel format (How to fix this I'm not sure)

Monday, June 20, 2011

WPF

Some bugs have returned with implementations/changes.

Threshold by selection is partially implemented. This is done by drawing a square twice (after pressing the threshold button). It then runs the method to perform the threshold calculations.

Eroding is partially implemented as well done by a "down-up" gesture. Possibly implement dilate as the reverse (up-down gesture). I don't think there are any mask tools in AForge itself, so I'm looking at other ways to cut out the blob.

You can identify the species of the blobs on the screen, once identified the program saves the identification. You can quickly drop down to it instead of typing it in every time. (Right now this opens as a new window) I would like to get this so it has a small drop down menu at the mouse. I think that species and genera need to be separated, so I may have two separate lists.

Thinking of

List of Genera

Dictionary of <Genera, List>

Where the list will be the types of species each genera has.

Measurements (Area) works. Perimeter and others to be done up next.

Friday, June 17, 2011

WPF Bug fixes

Fixed all bugs that I could find in the program, memory seems good for the program.

Implemented importance gestures, the gesture (Sometimes) marks things not in the circle which I'm not sure why. As of now when you circle something it saves a single point (at the center of the circle) signifying importance. The program also draws a small marker on it.

With these points I plan on pulling out those blobs right away (Anything not near these points can be automatically considered garbage (?)

For delete gesture, it runs much faster as well (on large blobs) and doesn't crash if drawn across the entire blob (if the blob is large).

Wednesday, June 15, 2011

WPF - Progress

Lots of progress has been made with the current program.

Splitting - Now implemented
Joining - Now Implemented
(There appears to be *some* problems with using the stylus here but the mouse works fine)
Gestures - Delete & Undo - Implemented
Quick gestures to delete the blob that it crosses, or undo something.
 Swapping between images (Original, Grayscale, Edge Detection, etc.) - Implemented
Overlay of two images - Implemented
You can alter the image while overlay is being performed.

Program at this time is much quicker to get to the same area. a button press and a few swipes, and you are done.

Next to be completed:

Threshold by selections (either by point or box)
Important sections - Gesture to signify important objects on the bitmap (before program runs)
Erode - Erode the selected blob
Measurements
Identify

(For future)

Measurements output automatically into a spreadsheet for the python / DB.
Program can run on a large section of images (saving the basic copy it makes) [?] - then the user can run through these images and make the necessary changes/alterations.
Grayscale to work well on all images (find a way to set the coefficients up so that the grayscale gives a better image average - don't run into problems like large chunks of blobs in the middle)
Even more intuitive controls (?)

Monday, June 13, 2011

WPF Continued

Some advances in the program including can now split and join blobs, gestures correctly fire out console messages (but don't do anything else yet).

Left Click - Split
Right Click - Join (While joining the line that you are drawing isn't visible)

I plan on building the viewing of old images, undo list, and overlaying 2 images next. Then will work on making gestures actually execute some code.

Friday, June 10, 2011

New WPF program

So started the new program; I'm trying to make this much more simplified.

There are 5 basic buttons - Open and Save, Gesture Commands, Run the program, and properties.

if no button is selected you will be able to split (by eraser with stylus) or join (by drawing with stylus).

I have the program looking a bit crisper, simplified look (done entirely in XAML via designer).

XAML works quite good for designing the GUI, very useful I found, made changing things very simple.


The properties menu is a new window, which will allow you to set everything from grayscale coefficients to desired threshold values, to blobs filtering widths/heights.



I changed the idea for selecting the threshold to make it even quicker. Not yet implemented, but to allow the user to tap on the screen to set a small box at the location (one in the biggest chunk of foreground, other in biggest chunk of background) then just using a set square size to measure the histograms.

Basic gesture ideas (Diagonal Slash - Delete, < symbol - Undo, Circle - (before program runs important object), X - Erode the object)

I'm not sure about how to erode a single blob though, I'm sure there is some way to do it.

Thursday, June 9, 2011

WPF

Just started reading the textbook "Windows Presentation Foundation - Adam Nathan, Daniel Lehenbauer"

Got further into altering the actual XAML code to make the program look different, integrated changed Bitmap into BitmapSource and back the other way. Still had problems with the "pixel format" giving me errors when trying to perform certain functions in AForge, this ended up fixing itself.

Found a new filter "FillHoles" morphology is no longer required.

Program runs quickly, and shows all the blobs with some blob filtering. There is no human interaction, measuring, etc yet. That will be worked on tomorrow, probably in a newer program to more better design the actual GUI.

Tuesday, June 7, 2011

WPF

It appears you can only get stylus, pressure, other info using WPF. this is what I'm working on learning better since everything works differently). ANN still can't classify even the most simple set ups with the genera data. So this may be because they are unclassifiable like this, or really hard to classify. There are some other functions you can use for the ANN classifier, but I don't really understand what difference any of these make.

WPF looks simple enough, and the tablet works fine and calibrated well on my laptop. Tested using an ink canvas, but I haven't been able to do much. I found a way to open images but they have to be BMP (I see a way to convert them, but I can't find many tutorials on these tools).

Will hopefully learn much more for WPF tomorrow, shouldn't be hard to transfer the program over since it will be the same algorithms and concepts.