Sure! Actually something I just tried out, something I saw on a 'forensic photoshop' blog link.
I used the FFT filter in ImageJ, a free, cross platform, Java based image processing application.
Download ImageJ and FFT plugin.
Apply Process > FFT > FFT - This creates a forward Fourier transform.
Using the brush, black out the white dots on the edges.
Apply Process > FFT > Inverse FFT
Repeat as necessary.
Then, use healing brushes with content aware fills in Photoshop for scratches and dust.
Increase image size, apply Median filter, then shrink and sharpen.
Adjust levels/curves.
I never understand what the hell they are teaching people in University nowadays...15 years on from its inception and still most scientists have not heard of ImageJ and all its plugins...they waste hard earned grant money on stupid software thats worthless for career advancement...
anyways, I know its snarky, but here is the answer to all your problems. Learn to use it and take it with you wherever you go...
or if you want a bunch of already installed (image rendering-based) plugins you can try Fiji: http://pacific.mpi-cbg.de/wiki/index.php/Fiji
If you wanted to implement this guy's program you should look at Local Binary Patterns (LBP), and HoG (Histogram of Oriented Gradients) as a features instead of just using an unrolled image. You could also make histograms of gabor filtered image patches. I have also heard of a 3D color histogram that has NxNxN features where n is the number of bins you want per color channel. The idea is you can have a lot less than 10k features, and possibly more information. (with the setup I proposed you would have about 1019 features. SVM does like a lot of features though, so you could divide the image into more patches and generate as many features as you want. I have heard of face recognition guys getting 10k features of just LBPs.
http://en.wikipedia.org/wiki/Local_binary_patterns http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
here is an example of the 3D histogram. http://rsbweb.nih.gov/ij/plugins/color-inspector.html
It would also be nice to see the results of this guy's cross validation training.
Um did you look at the imageJ download page? There's a windows version right there. As for LaTeXiT maybe you could do a simple google search and try some of these alternatives.
we do this using macros in ImageJ which is open source, super customizable, powerful, opens super fast & records your image manipulation so when you submit data the reveiwers can check to see you didnt just boost artifacts to get signal or whatever
i posted this video showing one way to do it and r/biology voted it down (?) i dislike ps and for publication ps documents are sometimes considered suspicious.. this is how you do it in ImageJ
A few things:
You might not want to merge the channels in the image, because it's generally easier to work with composite images where each channel is separate. If you have each TIFF pair in a folder, you can open the pair as an image stack by dragging the folder onto ImageJ. Some info on color images here - http://rsbweb.nih.gov/ij/docs/guide/146-9.html#toc-Section-9
JPEG is a lossy file format, so you lose image quality every time you save to JPEG. You're better off using TIFF.
The simplest way to quantify the green area is to take the single-channel green image and threshold it until only the sufficiently green bits are selected, fill in the holes, then use the particle analysis tool to calculate the area.
Here's some screenshots of the steps - http://postimg.org/gallery/77u22l2g/
1) For the green image, use the threshold tool to select the sufficiently green area.
2) Press 'Apply' to get a binary image
3) Use the 'Fill Holes' tool to automatically fill in the holes
4) Open up the 'Analyze Particles' tool and select the appropriate options. I've set the minimum size to 500 so that only the largest area is calculated. You could also skip the fill holes step and do that here. By selected "Include holes"
5) Results. It has an area of 144349 pixels. If you calibrate the scale you will get a more useful unit of measurement.
It's possible to automate this using macros, but depending on the consistency of staining and imaging, you might need different thresholds for each image. Ask around your lab to see if anyone there can help you write/record a macro. :)
First Rule: the Macro Recorder is your friend. Also: go and read the basics and know where to find the macro functions.
Try this on your sample image:
original = getImageID(); run("Properties...", "channels=1 slices=1 frames=1 unit=pixel pixel_width=1.0000 pixel_height=1.0000 voxel_depth=1.0000 frame=[0 sec] origin=0,0"); run("8-bit"); setAutoThreshold("Otsu"); run("Set Measurements...", "area mean standard modal min center perimeter bounding fit shape feret's integrated median redirect=None decimal=3"); run("Analyze Particles...", "size=30-Infinity circularity=0.00-1.00 show=Masks display clear include record"); selectImage(original); resetThreshold(); xm = getResult("XM",0); // centre of mass ym = getResult("YM",0); // centre of mass angle = getResult("FeretAngle",0); // angle => slope length = getResult("Feret",0); if(angle>90){angle = 180 - angle; sign = -1;} else {sign = 1;} slope = sign*atan(angle*PI/180); print("Centre of mass: " + xm + ", " + ym); print("Slope: " + slope); setPixel(xm,ym,255); distance = length/6; x = distance / sqrt(1 + slope*slope); xa = xm + x; xb = xm - x; ya = ym - slope*x; yb = ym + slope*x; setPixel(xa,ya,0); print(xa + ", " + ya); setPixel(xb,yb,0); print(xb + ", " + yb);
I'll let you figure out how it works.
And pay it forward ;)
If you're not afraid of getting into scientific software, Fiji (or ImageJ) can do this. This is called "Registration", and there are a bunch of plugins included that do registration of multiple images in a stack.
In Fiji you can load your images, assemble them into a stack, then use something like "plugins->registration->Linear Stack Alignment with SIFT", and it's pretty automatic. Your mileage may vary.
Check out ImageJ, there are some plug ins that allow you to count colonies of scanned images. I believe it is all open source and only requires Java to run.
This is the first thing that came up. There may be better plug ins for ImageJ if you do some searching.
The interface takes a bit to learn, but it is a powerful piece of software with a large array of plugins.
Image J is free and easy to use. You can install the cell counter plugin from NIH to manually click and tally different bins (http://rsbweb.nih.gov/ij/plugins/cell-counter.html).
For a cheap ocular based camera, I recommend amscope. We are talking $80 if that is all you want.
Yes, modifying the results table output is a rather trivial task. There are two ways to add extra columns. The easy way for most of them is editing the 2nd of these two lines (the first is just a reminder):
// Set Measurements... ensure "Stack Position" and "Centre" are included run("Set Measurements...", "area mean min center stack redirect=None decimal=4");
That line is just the set of commands that I selected to for the particle analysis. It's easy to modify: Go to Plugins > Macro > Record..., then do Analyze > Set Measurements... and check off all of the ones that you want. Once you press "OK", the code for that will be in the Macro Recorder window. Copy, paste, voila!
The second way is easy if you're just doing simple math or something like that: to run a small loop.
for(i=0; i<nResults; i++){ a = getResult("Item",i); setResult("Item Squared",i,a*a); } updateResults();
You can also do some slightly more complicated tricks, such as using the ROI manager to select individual particles, then to record whatever statistics you want about it using the getStatistics(area, mean, min, max, std, histogram) macro function. Of course, "Set Measurements" does most of that, however with the "histogram" output, you can do other custom analyses. There's a huge list of different functions that can be employed (and imagined), so it's worth exploring.
Time to get the undergrads to learn programming! ;-) ImageJ is actually quite a good introduction to programming, as it's easy to get both text and visual feedback on what each command does. I usually try to teach it and the basics of Python (how I learned!) to my undergrads.
Yeah.... looks like ubuntu took it out of the repositories. Anyways, there are some download links and instructions here.
Full disclosure, I have never used ImageJ so all of what I am telling you is based on my quick (very quick) reading of the ImageJ documentation.
Near as I can tell you could create a macro to do what you want (see this documentation)
Then create a script in bash to run through all the files you need it to with the command line options sending the output to a CSV.
I'm on mobile right now so I can't really help, but you can definitely do this. There is a measurement tool that identifies and counts shapes, and you can set the size limit, and "circularity" with '1' being a perfect circle; then the software will identify all the objects that satisfy those parameters. Look here:
http://rsbweb.nih.gov/ij/docs/guide/146-30.html
And if that doesn't help, go to google - I know I've see video tutorials that cover this.
So sorry I can't be more helpful right now. Good luck!
> For the assignment as part of my report, I am required to provide a "computer algorithm" for how I edited the images...Am I right in assuming that involves some kind of coding?
> My lecturer has stated we can also just write a "What I did" step by step recount, but I feel in order to get me higher marks I should try and include a computer algorithm.
As /u/DaftPotato mentioned, the macro recording functionality is very useful. Just turn it on before you start editing the image(s) by going to Plugins > Macros > Record... on the menu. You can then copy the output to use as a macro; it will repeat everything that you did when it runs.
ImageJ has loads of built-in macro functions and the macro basics is a good place to get started. Also, you'll find that most of the macro functions in the prior link includes an example: looking at those is a good way to see how they work. You can just copy & paste the code into a new macro window (Plugins > New > Macro) and then run it (CTRL + R).
Also, TIFF images are entirely compatible with ImageJ.
Not a problem. Follow the examples that are provided with the built-in functions or come back & ask more questions if those aren't 100% clear.
On the macro functions list there is a collection of Plot Functions, all of which start with Plot.
I'm presuming that your "standardized selction" is a profile plot (??) - if so, you can get the data from each individual plot using
Plot.getValues(xpoints, ypoints);
Then re-plotting the sets sets of data using the aforementioned Plot Functions.
ImageJ will allow easy conversion of a huge range of image formats between bit depths/color formats. It's also free and created by taxpayer dollars! There's 32 and 64 bit versions for PC, MacOsX, and linux.
I suppose the ImageJ & custom scripts have been written for single cores? In this case, if each script can run on separate cores, I'd get an Intel i7-2600K: each core is fast on its own + there are enough cores to run your scripts. Overclock the cpu, each core will be even faster. The 64bits OS takes care of distributing the work load.
1) hard drives: separate the OS, by installing it on a SSD, from the data drives. Increase data speed retrieval and security with 4 drives raid1+0. Don't forget the additional external backup drive, raid1 mirrors the data but it's not backup.
RAM: 4x 4GB? You didn't say how much is "several Gb in size".
2) SW: your software limits its use of memory by default. Fix that by following the instructions.
Yes, it can be written. I haven't used DistributionJ myself -- What's the title of the histogram window that gets opened? I can write a quick function for you, otherwise see these two links:
Writing details is fairly simple:
open("http://i.imgur.com/0FvM1py.jpg"); setForegroundColor(200,200,0); setFont("Monospaced",80,"bold"); setJustification("left"); x = 2350; y= 780; drawString("Is this a \nchannel?",x,y); setForegroundColor(220,90,75); x = 1400; y = 1020; setFont("Arial",30,"bold"); drawString("What about this one?",x,y);
You can write whatever string you want at whatever location you want (x,y). There's also a good demo macro on the ImageJ website. For the other stuff, I'd need to see what you want to do... but there are links for guides to macro stuff in the side bar.
When each image is opened, it would probably help to use the "ImageID" for each image:
x = getImageID();
How do you have your images sorted / organized?
It is possible to automatically draw features or text onto an image using a macro. Alternatively, you can use overlays, which is a non-destructive, and the ROI can be separately saved. Here's a tutorial on annotating images. Can you sketch with Paint or Inkscape what sort of features you would like to draw on the image? I can probably write up a bit of macro code to get you started.
Answering my own question - Yes, there are command line options.
http://rsbweb.nih.gov/ij/docs/guide/146-18.html
I suspect you could create a macro to do what you need to do and tell it to run from the command line appending the results to a CSV which can be read by excel.
One other useful item in the ImageJ macro toolbox is the histogram function:
getHistogram(values, counts, nBins[, histMin, histMax])
So a simple macro along these lines can automatically set the threshold to a set percentage of the histogram:
percentage = 0.75; target = percentage*getWidth()*getHeight(); nBins = 256; getHistogram(values,counts,nBins); sum = 0; threshold = -1; for(i=0; i<nBins; i++){ sum += counts[i]; if( (sum >= target) & (threshold < 0) ){ threshold = i; } } setThreshold(0, threshold);
Uh... your first question doesn't quite make sense. To create a mask, you need to threshold the image:
Image> Adjust > Threshold...
Beyond that, you need to imagine a specific set of instructions which would let you find the features that you're looking for, and then imagine how you would measure them... break it all down into the smallest possible step. Then look through the list of functions to see if any would do what you need. If not, then you make a function that does (this can be done within the macro).
This may also be a good place to look for ideas: http://imagej.1557.x6.nabble.com/Dendritic-spine-td3685212.html
I take it that this is what you're referring to: Free Selection (Lasso)?
Kind of. There's the Polygon Selection Tool & the Freehand Selection Tool, which can be used to make a series of line segments to enclose an object.
ImageJ has this feature, but the program might seem quite cluttered:
Yeah the perspective throws it off. I figured this would be a decent estimate though. using something like imageJ might give you a good estimate based off of that picture.