from ij import IJ from ij.gui import GenericDialog gd = GenericDialog("Change Estimated Sarcomere Length") gd.addNumericField("Estimated Sarcomere Length", 1.5, 0) gd.showDialog() ll = gd.getNextNumber() IJ.setProperty("sarcomereLength", ll)
from ij import IJ import sys sys.path.append( IJ.getDirectory("imagej") + "/jars/HaralickFeaturesInteractive/") from Haralick_Features import Haralick_Features as hf cmChan = int(IJ.getProperty("cmChan")) analyte = WindowManager.getCurrentImage() analyte.setC(cmChan) title = analyte.getTitle() cmNumber = IJ.getProperty("cmNumber") if cmNumber is None: cmNumber = 1 IJ.setProperty("cmNumber", cmNumber) cmNumber += 1 sarcomereLength = IJ.getProperty("sarcomereLength") if sarcomereLength is None: sarcomereLength = 1.5 icalibration = analyte.getCalibration() pixelDistance = round(icalibration.getRawX(sarcomereLength)) pixelDistance = round(icalibration.getRawX(sarcomereLength)) retval = findMaximaSeqs([ list(hfi) for hfi in hf().calculate(analyte, "Sarcomeres", 45, sarcomereLength, 10, 8) ], pixelDistance) print(list(retval)) valplot = WindowManager.getWindow( "Angle-Distance Correlation Values").getPlot() valplot.setColor("black")
histsum = sum(hist) ii = 0 for jj in range(0, 65536): ii += hist[jj] if ii > histsum / 2: break return jj gd = GenericDialog("Image Information") gd.addNumericField("Cardiomyocye Stain Channel Number", 1, 0, 10, "") gd.addNumericField("Nuclear Stain Channel Number", 2, 0, 10, "") gd.showDialog() cmChan = int(gd.getNextNumber()) nucChan = int(gd.getNextNumber()) IJ.setProperty("cmChan", cmChan) IJ.setProperty("nucChan", nucChan) analyte = WindowManager.getCurrentImage() title = analyte.getTitle() IJ.run("Split Channels") nucTitle = "C{}-{}".format(nucChan, title) nucIp = WindowManager.getImage(nucTitle) nucIpMedian = calcMedian(nucIp) IJ.run(nucIp, "Subtract...", "value=" + str(nucIpMedian) + " stack") IJ.run("Merge Channels...", "c1=[C1-{}] c2=[C2-{}] create".format(title, title)) cmt = ResultsTable() cmt.show("Cardiomyocyte Results") IJ.renameResults("Cardiomyocyte Results") nuct = ResultsTable()