예제 #1
0
def define_pixel_sizes(args):
    """
    Defines the pixel sizes based on metadata file, or CLI flags
    :param args: amap argument object
    :return: args updated
    """

    if None in [args.x_pixel_um, args.y_pixel_um, args.z_pixel_um]:
        if args.metadata is None:
            raise CommandLineInputError(
                "Not all pixel sizes are defined on the command line, but "
                "no metadata file has been supplied")
        try:
            metadata = get_acquisition_metadata(args.metadata)
        except NotImplementedError:
            raise CommandLineInputError(
                "Not all pixel sizes are defined on the command line, but the"
                " metadata file cannot be read.")

    for dim in ["x", "y", "z"]:
        dim_attribute = "{}_pixel_um".format(dim)
        if getattr(args, dim_attribute) is None:
            try:
                setattr(args, dim_attribute, getattr(metadata, dim_attribute))
            except ArgumentTypeError:
                raise CommandLineInputError(
                    "No {} pixel size was defined on the command line, and it "
                    "cannot be parsed from the metadata".format(dim))

    return args
예제 #2
0
def test_mesospim_meta():
    metadata = meta.get_acquisition_metadata(mesoSPIM_metadata)
    assert isclose(8.23, metadata.x_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(8.23, metadata.y_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(10, metadata.z_pixel_um, abs_tol=VOX_DIM_TOLERANCE)

    assert metadata.num_planes == 852
예제 #3
0
def test_baking_tray_meta():
    metadata = meta.get_acquisition_metadata(baking_tray_metadata)
    assert isclose(2.19, metadata.x_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(2.14, metadata.y_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(5, metadata.z_pixel_um, abs_tol=VOX_DIM_TOLERANCE)

    assert metadata.num_planes == 2000
예제 #4
0
def test_amap_meta():
    metadata = meta.get_acquisition_metadata(amap_metadata)
    assert isclose(8, metadata.x_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(8, metadata.y_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(20, metadata.z_pixel_um, abs_tol=VOX_DIM_TOLERANCE)

    assert metadata.num_planes == 100
예제 #5
0
def test_cellfinder_meta():
    metadata = meta.get_acquisition_metadata(cellfinder_metadata)
    assert isclose(2, metadata.x_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(2, metadata.y_pixel_um, abs_tol=VOX_DIM_TOLERANCE)
    assert isclose(5, metadata.z_pixel_um, abs_tol=VOX_DIM_TOLERANCE)

    assert metadata.num_planes == 1500
예제 #6
0
def test_unsupported_meta():
    with pytest.raises(NotImplementedError):
        assert meta.get_acquisition_metadata(unsupported_metadata)