Exemplo n.º 1
0
def askToSaveUnsavedChanges():
    if note_status.getText() == "Unsaved changes.":
        if IJ.showMessageWithCancel("Alert", "Save current note?"):
            requestSave(None)
        else:
            # Stash current note in the log window
            IJ.log("Discarded note for image at:")
            IJ.log(path.getText())
            IJ.log(textarea.getText())
            IJ.log("===")
Exemplo n.º 2
0
    def setup() :
        """setup"""

        if Exper.IN_DEV :
            canceled = False
        else :
            canceled = not IJ.showMessageWithCancel(__program__,'To proceed program will close all open images and windows, continue?')

        if not canceled :
            IJ.run("Colors...", "foreground=white background=black selection=yellow");

            ## aspirational todo: identify current settings and return settings at the end
            ## set setting to save column headers
            IJ.run("Input/Output...", "jpeg=85 gif=-1 file=.csv use_file save_column");

            ## set setting to copy column headers - not actually necessary
            IJ.run("Input/Output...", "jpeg=85 gif=-1 file=.csv copy_column save_column");

            futils.force_close_all_images()
            rm = RoiManager.getRoiManager()
            rm.reset()
            rm.show()
Exemplo n.º 3
0
    # Process list of images
    for (counter, f) in enumerate(files):

        # Display progress
        IJ.showStatus("Processing file "+ str(counter+1) +"/"+ str(len(files)))

        # Open each image and process it
        imp = IJ.openImage(f)
        myRoutines(imp)

        # Save processed image in out_dir (enforcing .tif extension)
        newpath = os.path.splitext(out_dir + imp.getTitle())[0] +".tif"
        IJ.saveAsTiff(imp, newpath)
        imp.close()

        # Log paths of processed files
        csvWriter.writerow([f, newpath])

    # Display CSV log
    csvFile.close()
    rt = ResultsTable.open(csvPath)
    rt.show("_ProcessedFileList.csv")

    # Proudly inform that processing terminated
    if IJ.showMessageWithCancel("All done","Reveal output directory?"):
        Utils.revealFile(out_dir);

else:
    # Inform no filtered files were found
    IJ.error("No matches for the selected extension(s).")
Exemplo n.º 4
0
		return self.__pathdir

	def setPositionslist(self, positions) : 
		self.__positionsList=positions

	def parsebool(self, val) :
		if val : return str(1)
		else : return str(0)

			
############################################## end class Bacteria_Tracking ################################################################################################
		


if __name__ == "__main__":
	import os, glob
	from os import path
	
	bact=Bacteria_Tracking()
	#def run(self, files, path, scale, batch, **settings):														
	if IJ.showMessageWithCancel("", "active image ? (ok) \nfiles (cancel)") :
		bact.run(IJ.getImage(), "", 1, False)
	else :
		selectdir=IJ.getDirectory("image")
		selectdir=IJ.getDirectory("")
		listfiles=[]
		listfiles.append(glob.glob(selectdir+"*DIA_s0001*t000[1-9].tif"))
		listfiles.append(glob.glob(selectdir+"*DIA_s0002*t000[1-9].tif"))
		bact.run(listfiles)
		
    for ndId, tagNames in candidateTable.iteritems():
        nd = candidateIdVsNode[ndId]
        isCandidate = False
        votes = []
        for tagName in tagNames:
            if candidateRe.match(tagName):
                isCandidate = True
            if voteRe.match(tagName):
                votes.append(tagName)
        if isCandidate:
            if 1 != len(votes):
                # one and only one vote should exist
                print "found missing vote"
                nMissingVotes = nMissingVotes + 1
                nd.addTag(Tag("REVOTE-this", KeyEvent.VK_R))

    print "done."
    return nMissingVotes


## run checking votes with a dialogue hint
firstProject = Project.getProjects().get(0)
if IJ.showMessageWithCancel("Checking Votes For TrakEM2 Project", "Will now check for missing votes in TrakEM2 project:\n"+firstProject.getTitle()):
    n = checkVotes(firstProject)
    if 0 == n:
        msg = "Well done! All candidates ara voted in:\n"+firstProject.getTitle()
    else:
        msg = str(n)+" votes missing in project:\n"+firstProject.getTitle()+"\n \nSearch REVOTE- to view missed votes.\nPlease re-check after appending missing votes."
    IJ.showMessage("Checking Votes Done", msg)
Exemplo n.º 6
0
#	exper.hsegs.append(hseg)
#	exper.cells.append(vl3)
#	exper.cells.append(vl4)

	return exper

	
	

## main program


if IN_DEV :
	canceled = False
else :
	canceled = not IJ.showMessageWithCancel(__program__,'To proceed program will close all open images and windows, continue?')


if not canceled :
	
	setup()


	if IN_DEV :
		exper_path = "/Users/baylieslab/Documents/Amelia/data/patrick/2019-05-20_Dmef2-2xeGFP"
	else :
		dir_chooser = DirectoryChooser(__program__)
		exper_path = dir_chooser.getDirectory()
		if exper_path.endswith('/') :
			exper_path = exper_path[:-1]
	
Exemplo n.º 7
0
        for tagName in tagNames:
            if candidateRe.match(tagName):
                isCandidate = True
            if voteRe.match(tagName):
                votes.append(tagName)
        if isCandidate:
            if 1 != len(votes):
                # one and only one vote should exist
                print "found missing vote"
                nMissingVotes = nMissingVotes + 1
                nd.addTag(Tag("REVOTE-this", KeyEvent.VK_R))

    print "done."
    return nMissingVotes


## run checking votes with a dialogue hint
firstProject = Project.getProjects().get(0)
if IJ.showMessageWithCancel(
        "Checking Votes For TrakEM2 Project",
        "Will now check for missing votes in TrakEM2 project:\n" +
        firstProject.getTitle()):
    n = checkVotes(firstProject)
    if 0 == n:
        msg = "Well done! All candidates ara voted in:\n" + firstProject.getTitle(
        )
    else:
        msg = str(n) + " votes missing in project:\n" + firstProject.getTitle(
        ) + "\n \nSearch REVOTE- to view missed votes.\nPlease re-check after appending missing votes."
    IJ.showMessage("Checking Votes Done", msg)