예제 #1
0
def _get_txt_acquisition(txt_acquisition, acquisition_name=None,
                         verbose=False, filehandle=None):
    """
    A generator the returns the acquisitions
    :param mcd_acquisition:
    :param acquisition:
    :param verbose:
    :return:
    """
    if acquisition_name is None:
        acquisition_name='0'
    txt = txtparser.TxtParser(txt_acquisition, filehandle)
    if verbose:
        print('containing 1 acquisition')
    imc_img = txt.get_imc_acquisition()
    acquisition = acquisition_name
    yield (acquisition, imc_img)
예제 #2
0
get_ipython().magic('matplotlib notebook')

# Define the variables:
# The folder should contain the txt files from tunning tapes with 1 folder per day

# In[214]:

folder_name = '/mnt/bbvolume/hart_tma_data/20161025_tunning_tapes/'
out_folder = '/home/vitoz/Data/Analysis/20161026_tuning_tape'

# Load the txt files

# In[12]:

txt_parsers = [
    txtparser.TxtParser(os.path.join(folder_name, subfol, fn))
    for subfol in os.listdir(folder_name)
    for fn in os.listdir(os.path.join(folder_name, subfol))
]

# Following files were used:

# In[13]:

for p in txt_parsers:
    print(p.filename)

# In[14]:

imc_acs = [p.get_imc_acquisition() for p in txt_parsers]
예제 #3
0
        metalDict[metal] = [bool(int(x)) for x in [fstack, istack]]
fin.close()

## OUTPUT FILE LINKING ROI IDS TO ROI LABELS (IMAGE DESCRIPTION)
roi_map = open(os.path.basename(args.INPUT_FILE) + '_ROI_map.csv', "w")

## USE DIFFERENT PARSERS CORRESPONDING TO THE INPUT FILE FORMAT
file_type = re.sub(".*\.([^.]+)$", '\\1', args.INPUT_FILE.lower())

## CONVERT INPUT_FILE TO TIFF AND WRITE RELEVANT TIFF IMAGES
if file_type == "mcd":
    parser = mcdparser.McdParser(args.INPUT_FILE)
    acids = parser.acquisition_ids
else:
    if file_type == "txt":
        parser = txtparser.TxtParser(args.INPUT_FILE)
    elif file_type == "tiff" or file_type == "tif":
        parser = omeparser.OmetiffParser(args.INPUT_FILE)
    else:
        print("{}: Invalid input file type - should be txt, tiff, or mcd!".
              format(file_type))
        sys.exit(1)

    # THERE IS ONLY ONE ACQUISITION - ROI FOLDER NAMED ACCORDING TO INPUT FILENAME
    acids = [
        re.sub('.txt|.tiff', '',
               os.path.basename(parser.filename).lower().replace(" ", "_"))
    ]

for roi_number in acids:
    if file_type == "mcd":
예제 #4
0
def get_txt_aquisition(file_name):
	txt = txtparser.TxtParser(file_name)
	return txt.get_imc_acquisition()