1 / 15

PROJECT#3(b) Astrocyte Analysis

PROJECT#3(b) Astrocyte Analysis . BY Bhimanathini Venkatsai Sai Kumar Maddula. Contents. Astrocyte Analysis Algorithm for Converting into 8-bit Algorithm for Thresholding Sample code for T hresholding Overlapping/Touching of cell structure

roz
Download Presentation

PROJECT#3(b) Astrocyte Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PROJECT#3(b)Astrocyte Analysis BY BhimanathiniVenkatsai Sai Kumar Maddula

  2. Contents • Astrocyte Analysis • Algorithm for Converting into 8-bit • Algorithm for Thresholding • Sample code for Thresholding • Overlapping/Touching of cell structure • Watershed Algorithm • Analyze Particles And Future work

  3. Astrocyte Analysis: • Load the stack File into ImageJ File  Open Browse Stack File

  4. Converting to 8bit • java.util import Random • imp = IJ.createImage("A Random Image", "8-bit", 512, 512, 1) • Random().nextBytes(imp.getProcessor().getPixels()) • imp.show() Converting to 8bit

  5. 1. start set THRESHOLD = 30red = getRedPixelFromImage(row,column) green = getGreenPixelFromImage(row,column) blue = getBluePixelFromImage(row,column) • 2. avg = (red+green+blue)/3 • 3. if(avg<THRESHOLD) paint white else paint black. • 4. end Algorithm for Threshold:

  6. import java.awt.image.BufferedImage; public class ImageOperations { public static BufferedImage Threshold(BufferedImageimg,intrequiredThresholdValue) { int height = img.getHeight(); int width = img.getWidth(); BufferedImagefinalThresholdImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB) ; int red = 0; int green = 0; int blue = 0; for (int x = 0; x < width; x++) { // System.out.println("Row: " + x); try { for (int y = 0; y < height; y++) { int color = img.getRGB(x, y); red = ImageOperations.getRed(color); green = ImageOperations.getGreen(color); blue = ImageOperations.getBlue(color); // System.out.println("Threshold : " + requiredThresholdValue); if((red+green+green)/3 < (int) (requiredThresholdValue)) { finalThresholdImage.setRGB(x,y,ImageOperations.mixColor(0, 0,0)); } else { finalThresholdImage.setRGB(x,y,ImageOperations.mixColor(255, 255,255)); } } } catch (Exception e) { e.getMessage(); } } return finalThresholdImage; } private static intmixColor(int red, int green, int blue) { return red<<16|green<<8|blue; } public static intgetRed(int color) { return (color & 0x00ff0000) >> 16; } public static intgetGreen(int color) { return (color & 0x0000ff00) >> 8; } public static intgetBlue(int color) { return (color & 0x000000ff) >> 0; } } Code for Threshold

  7. Overlapping/Touching Cell Structures • Here we have to apply Watershed and Analyze Particles. • So we done with some code for Watershed and to Analyze Particles.

  8. # 1 - Obtain an image blobs = IJ.openImage(“aaa.tip") # Make a copy with the same properties as blobs image: imp = blobs.createImagePlus() ip = blobs.getProcessor().duplicate() imp.setProcessor("blobs copy", ip) # 2 - Apply a threshold: only zeros and ones # Set the desired threshold range: keep from 0 to 74 ip.setThreshold(147, 147, ImageProcessor.NO_LUT_UPDATE) # Call the Thresholder to convert the image to a mask IJ.run(imp, "Convert to Mask", "") # 3 - Apply watershed # Create and run new EDM object, which is an Euclidean Distance Map (EDM) # and run the watershed on the ImageProcessor: EDM().toWatershed(ip) # 4 - Show the watersheded image: imp.show() Watershed algorithm:

  9. # Create a table to store the results table = ResultsTable() # Create a hidden ROI manager, to store a ROI for each blob or cell roim = RoiManager(True) # Create a ParticleAnalyzer, with arguments: # 1. options (could be SHOW_ROI_MASKS, SHOW_OUTLINES, SHOW_MASKS, SHOW_NONE, ADD_TO_MANAGER, and others; combined with bitwise-or) # 2. measurement options # 3. a ResultsTable to store the measurements # 4. The minimum size of a particle to consider for measurement # 5. The maximum size (idem) # 6. The minimum circularity of a particle # 7. The maximum circularity pa = ParticleAnalyzer(ParticleAnalyzer.ADD_TO_MANAGER, Measurements.AREA, table, 0, Double.POSITIVE_INFINITY, 0.0, 1.0) pa.setHideOutputImage(True) if pa.analyze(imp):   print "All ok" else:  print "There was a problem in analyzing", blobs # The measured areas are listed in the first column of the results table, as a float array: areas = table.getColumn(0) Analyze particles:

  10. Expected Results:

  11. Expected Results

  12. Segmentation by 3D Viewer • Combine individual Plugin into one Plugin. Still working on..

  13. Thank you..!!

More Related