Beispiel #1
0
    # it is here because before this cell the folder doesnt exist yet
    add_file_handler(logger, t2s_model.train_log_path)

    # repeat it so that the log file saves this
    logger.info(f"args\n{dict2str(asdict(args))}")
    logger.info(f"{t2s_model.name=}")
    logger.info(f"t2s_model\n{dict2str(asdict(t2s_model))}")

    # # Data

    # Metadata/paths objects

    # Volume
    volume = Volume.with_check(
        name=args.volume_name, version=args.volume_version
    )

    logger.info(f"volume\n{dict2str(asdict(volume))}")

    assert volume.nclasses == model_nclasses, f"{model_nclasses=} {volume.nclasses=}"

    logger.info("Loading data from disk.")

    # Data
    voldata = file_utils.HST_read(
        str(volume.data_path),  # it doesn't accept paths...

        autoparse_filename=False,  # the file names are not properly formatted
        data_type=volume.metadata.dtype,
        dims=volume.metadata.dimensions,
Beispiel #2
0
volume_name, volume_version = VOLUME_NAME_VERSION
labels_version = LABELS_VERSION

logger.info(f"{volume_name=}")
logger.info(f"{volume_version=}")
logger.info(f"{labels_version=}")


# In[ ]:


# Metadata/paths objects

## Volume
volume = Volume.with_check(
    name=volume_name, version=volume_version
)
logger.info(f"{volume=}")

def _read_raw(path_: Path, volume_: Volume): 
    # from pymicro
    return file_utils.HST_read(
        str(path_),  # it doesn't accept paths...
        # pre-loaded kwargs
        autoparse_filename=False,  # the file names are not properly formatted
        data_type=volume.metadata.dtype,
        dims=volume.metadata.dimensions,
        verbose=True,
    )

read_raw = partial(_read_raw, volume_=volume)