Ejemplo n.º 1
0
def list_scans(experimentFolder, microscopeType):
    scanList = []  # Makes an empty list

    # This section screens out text files and other things that might be in the main experimentFolder, and only makes a list of the actual scan directories
    # For Bruker microscopes, the scan directories are plain, so os.isdir is used to look for them
    if microscopeType == "Bruker":
        for File in sorted(os.listdir(experimentFolder)):
            dirpath = os.path.join(experimentFolder,
                                   File)  # Makes a complete path to the file
            if os.path.isdir(
                    dirpath
            ):  # If the dirpath is a directory, print it and add it to scanList. If it's a file, do not add it.
                print "dirpath is " + dirpath
                scanList.append(dirpath)
        return scanList  # Returns scanList to run_it()

    # If the microscope is "Olympus" type, the directories end in .oif.files, so .endswith needs to be used to find them
    if microscopeType == "Olympus":
        oifList = [
        ]  # This doesn't look like it was used, so I should delete it in the future once I have verified this.
        for File in sorted(os.listdir(experimentFolder)):
            if File.endswith(
                    ".oif.files"
            ):  # If the item ends with .oif.files, make the complete path and append it to scanList
                dirpath = os.path.join(experimentFolder, File)
                #print "dirpath is " + dirpath
                scanList.append(dirpath)
        return scanList  # Returns scanList to run_it()
Ejemplo n.º 2
0
def microscope_check(experimentFolder):
    #If it finds .oif files inside the main folder, it calls the microscope "Olympus"
    if any(File.endswith(".oif") for File in os.listdir(experimentFolder)):
        print(".oif files present, running Olympus pipeline")
        microscopeType = "Olympus"
        return microscopeType  #returns microscopeType to run_it()
    else:
        #If there are no .oif files in the main folder, it calls the microscope "Bruker"
        print("No .oif files present, running Bruker pipeline")
        microscopeType = "Bruker"
        return microscopeType  #returns microscopeType to run_it()