lama/img_processing/organ_vol_calculation.py
def label_sizes(label_dir: Path, outpath: Path, mask_dir=None):
    """
    Given a directory of labelmaps and whole embryo masks, generate a csv file containing organ volumes normalised to
    mask size

    Parameters
    ----------
    label_dir: str
        directory containing (inverted) label maps - can be in subdirectories
    mask_dir: str
        directory containing (inverted) masks - can be in subdirectories
    outpath: str
        path to save generated csv

    """
    label_df = _get_label_sizes(get_images_ignore_elx_itermediates(label_dir))

    if mask_dir:

        mask_df = _get_label_sizes(get_file_paths(mask_dir))

        label_df = label_df.divide(mask_df[1], axis=0)

    try:
        label_df.to_csv(outpath)
    except PermissionError:
        os.remove(outpath)
        label_df.to_csv(outpath)

    Given a directory of labelmaps and whole embryo masks, generate a csv file containing organ volumes normalised to
    mask size

    Parameters
    ----------
    label_dir: str
        directory containing (inverted) label maps - can be in subdirectories
    mask_dir: str
        directory containing (inverted) masks - can be in subdirectories
    outpath: str
        path to save generated csv

    
Given a directory of labelmaps and whole embryo masks, generate a csv file containing organ volumes normalised to
mask size

Parameters

str
directory containing (inverted) label maps - can be in subdirectories
mask_dir: str
directory containing (inverted) masks - can be in subdirectories
outpath: str
path to save generated csv
Given a directory of labelmaps and whole embryo masks generate a csv file containing organ volumes normalised to mask size Parameters str directory containing ( inverted ) label maps - can be in subdirectories mask_dir : str directory containing ( inverted ) masks - can be in subdirectories outpath : str path to save generated csv
def label_sizes(label_dir: Path, outpath: Path, mask_dir=None):
    label_df = _get_label_sizes(get_images_ignore_elx_itermediates(label_dir))
    if mask_dir:
        mask_df = _get_label_sizes(get_file_paths(mask_dir))
        label_df = label_df.divide(mask_df[1], axis=0)
    try:
        label_df.to_csv(outpath)
    except PermissionError:
        os.remove(outpath)
        label_df.to_csv(outpath)
def label_sizes ( label_dir : Path , outpath : Path , mask_dir = None ) : label_df = _get_label_sizes ( get_images_ignore_elx_itermediates ( label_dir ) ) if mask_dir : mask_df = _get_label_sizes ( get_file_paths ( mask_dir ) ) label_df = label_df . divide ( mask_df [ 1 ] , axis = 0 ) try : label_df . to_csv ( outpath ) except PermissionError : os . remove ( outpath ) label_df . to_csv ( outpath )
Given a directory of labelmaps and whole embryo masks, generate a csv file containing organ volumes normalised to
mask size
Given a directory of labelmaps and whole embryo masks generate a csv file containing organ volumes normalised to mask size
"""
    Given a directory of labelmaps and whole embryo masks, generate a csv file containing organ volumes normalised to
    mask size

    Parameters
    ----------
    label_dir: str
        directory containing (inverted) label maps - can be in subdirectories
    mask_dir: str
        directory containing (inverted) masks - can be in subdirectories
    outpath: str
        path to save generated csv

    """
label_dir
Path
outpath
Path
mask_dir