asap.dataimport package

Submodules

asap.dataimport.apply_mipmaps_to_render module

class asap.dataimport.apply_mipmaps_to_render.AddMipMapsToStack(schema_type=None, *args, **kwargs)[source]

Bases: StackTransitionModule

Note

This class takes a ArgSchema as an input to parse inputs , with a default schema of type AddMipMapsToStackParameters

default_output_schema

alias of AddMipMapsToStackOutput

default_schema

alias of AddMipMapsToStackParameters

run()[source]
asap.dataimport.apply_mipmaps_to_render.addMipMapsToRender(render, input_stack, mipmap_prefix, imgformat, levels, z)[source]

asap.dataimport.create_mipmaps module

exception asap.dataimport.create_mipmaps.CreateMipMapException[source]

Bases: RenderModuleException

Exception raised when there is a problem creating a mipmap

asap.dataimport.create_mipmaps.create_mipmaps(inputImage, outputDirectory='.', *args, **kwargs)

legacy create_mipmaps function

asap.dataimport.create_mipmaps.create_mipmaps_legacy(inputImage, outputDirectory='.', *args, **kwargs)[source]

legacy create_mipmaps function

asap.dataimport.create_mipmaps.create_mipmaps_uri(inputImage, outputDirectory=None, method='block_reduce', mipmaplevels=[1, 2, 3], outputformat='tif', convertTo8bit=True, force_redo=True, **kwargs)[source]

function to create downsampled images from an input image

Parameters
  • inputImage (str) – path to input image

  • outputDirectory (str) – path to save output images (default to current directory)

  • mipmaplevels (list or tuple) – list or tuple of integers (default to (1,2,3))

  • outputformat (str) – string representation of extension of image format (default tif)

  • convertTo8bit (boolean) – whether to convert the image to 8 bit, dividing each value by 255

  • force_redo (boolean) – whether to recreate mip map images if they already exist

  • method (str) – string corresponding to downsampling method

  • block_func (str) – string corresponding to function used by block_reduce

  • ds_filter (str) – string corresponding to PIL downsample mode

Returns

list of output images created in order of levels

Return type

list

Raises

MipMapException – if an image cannot be created for some reason

asap.dataimport.create_mipmaps.mipmap_PIL(im, levels_file_map, ds_filter='NEAREST', force_redo=True, **kwargs)[source]
asap.dataimport.create_mipmaps.mipmap_block_reduce(im, levels_file_map, block_func='mean', force_redo=True, **kwargs)[source]
asap.dataimport.create_mipmaps.writeImage(img, outpath, force_redo)[source]

asap.dataimport.generate_EM_tilespecs_from_metafile module

create tilespecs from TEMCA metadata file

class asap.dataimport.generate_EM_tilespecs_from_metafile.GenerateEMTileSpecsModule(schema_type=None, *args, **kwargs)[source]

Bases: StackOutputModule

Note

This class takes a ArgSchema as an input to parse inputs , with a default schema of type GenerateEMTileSpecsParameters

default_output_schema

alias of GenerateEMTileSpecsOutput

default_schema

alias of GenerateEMTileSpecsParameters

static image_coords_from_stage(stage_coords, resX, resY, rotation)[source]
run()[source]
static sectionId_from_z(z)[source]
tileId_from_basename(fname)[source]
ts_from_imgdata(imgdata, imgprefix, x, y, minint=0, maxint=255, maskUrl=None, width=3840, height=3840, z=None, sectionId=None, scopeId=None, cameraId=None, pixelsize=None)[source]

asap.dataimport.generate_mipmaps module

class asap.dataimport.generate_mipmaps.GenerateMipMaps(schema_type=None, *args, **kwargs)[source]

Bases: StackInputModule

Note

This class takes a ArgSchema as an input to parse inputs , with a default schema of type GenerateMipMapsParameters

default_output_schema

alias of GenerateMipMapsOutput

default_schema

alias of GenerateMipMapsParameters

run()[source]
asap.dataimport.generate_mipmaps.create_mipmap_from_tuple(mipmap_tuple, levels=[1, 2, 3], imgformat='tif', convertTo8bit=True, force_redo=True, **kwargs)[source]
asap.dataimport.generate_mipmaps.create_mipmap_from_tuple_uri(mipmap_tuple, levels=[1, 2, 3], imgformat='tif', convertTo8bit=True, force_redo=True, **kwargs)[source]
asap.dataimport.generate_mipmaps.get_filepath_from_tilespec(ts)[source]
asap.dataimport.generate_mipmaps.make_tilespecs_and_cmds(render, inputStack, output_prefix, zvalues, levels, imgformat, convert_to_8bit, force_redo, pool_size, method)[source]

asap.dataimport.make_montage_scapes_stack module

class asap.dataimport.make_montage_scapes_stack.MakeMontageScapeSectionStack(schema_type=None, *args, **kwargs)[source]

Bases: StackOutputModule

Note

This class takes a ArgSchema as an input to parse inputs , with a default schema of type MakeMontageScapeSectionStackParameters

default_output_schema

alias of MakeMontageScapeSectionStackOutput

default_schema

alias of MakeMontageScapeSectionStackParameters

run()[source]
asap.dataimport.make_montage_scapes_stack.create_montage_scape_tile_specs(render, input_stack, image_directory, scale, project, tagstr, imgformat, Z, apply_scale=False, uuid_prefix=True, uuid_prefix_length=10, **kwargs)[source]

asap.dataimport.schemas module

class asap.dataimport.schemas.AddMipMapsToStackOutput(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: DefaultSchema

AddMipMapsToStackOutput

key

description

default

field_type

json_type

output_stack

no description

(REQUIRED)

String

str

missing_ts_zs

Z values for which apply mipmaps failed

[]

List

int

opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.AddMipMapsToStackParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: StackTransitionParameters

This schema is designed to be a schema_type for an ArgSchemaParser object

AddMipMapsToStackParameters

key

description

default

field_type

json_type

pool_size

no description

1

Integer

int

minZ

no description

NA

Integer

int

maxZ

no description

NA

Integer

int

z

no description

NA

Integer

int

zValues

no description

NA

List

int

input_json

file path of input json file

NA

InputFile

str

output_json

file path to output json file

NA

OutputFile

str

log_level

set the logging level of the module

ERROR

LogLevel

str

render

parameters to connect to render server

(REQUIRED)

RenderClientParameters

dict

input_stack

no description

(REQUIRED)

String

str

output_stack

no description

(REQUIRED)

String

str

close_stack

no description

False

Boolean

bool

overwrite_zlayer

no description

False

Boolean

bool

output_stackVersion

no description

NA

RenderStackVersion

dict

mipmap_dir

directory to which the mipmaps will be stored

NA

InputDir

str

mipmap_prefix

uri prefix from which mipmap locations are built.

(REQUIRED)

String

str

levels

number of levels of mipmaps, default is 6

6

Integer

int

imgformat

mipmap image format, default is tiff

tiff

String

str

mipmap_directory_to_prefix(data)[source]
opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.GenerateEMTileSpecsOutput(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: DefaultSchema

GenerateEMTileSpecsOutput

key

description

default

field_type

json_type

stack

stack to which generated tiles were added

(REQUIRED)

String

str

opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.GenerateEMTileSpecsParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: OutputStackParameters

This schema is designed to be a schema_type for an ArgSchemaParser object

GenerateEMTileSpecsParameters

key

description

default

field_type

json_type

pool_size

no description

1

Integer

int

minZ

no description

NA

Integer

int

maxZ

no description

NA

Integer

int

z

no description

NA

Integer

int

zValues

no description

NA

List

int

input_json

file path of input json file

NA

InputFile

str

output_json

file path to output json file

NA

OutputFile

str

log_level

set the logging level of the module

ERROR

LogLevel

str

render

parameters to connect to render server

(REQUIRED)

RenderClientParameters

dict

output_stack

no description

(REQUIRED)

String

str

close_stack

no description

False

Boolean

bool

overwrite_zlayer

no description

False

Boolean

bool

output_stackVersion

no description

NA

RenderStackVersion

dict

metafile

metadata file containing TEMCA acquisition data

NA

InputFile

str

metafile_uri

uri of metadata containing TEMCA acquisition data

(REQUIRED)

String

str

maskUrl

absolute path to image mask to apply

None

InputFile

str

maskUrl_uri

uri of image mask to apply

None

String

str

image_directory

directory used in determining absolute paths to images. Defaults to parent directory containing metafile if omitted.

NA

InputDir

str

image_prefix

prefix used in determining full uris of images in metadata. Defaults to using the / delimited prefix to the metadata_uri if omitted

NA

String

str

maximum_intensity

intensity value to interpret as white

255

Integer

int

minimum_intensity

intensity value to interpret as black

0

Integer

int

sectionId

sectionId to apply to tiles during ingest. If unspecified will default to a string representation of the float value of z_index.

NA

String

str

image_directory_to_prefix(data)[source]
maskUrl_to_uri(data)[source]
metafile_to_uri(data)[source]
opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.GenerateMipMapsOutput(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: DefaultSchema

GenerateMipMapsOutput

key

description

default

field_type

json_type

levels

no description

(REQUIRED)

Integer

int

output_prefix

no description

(REQUIRED)

String

str

opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.GenerateMipMapsParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: InputStackParameters

This schema is designed to be a schema_type for an ArgSchemaParser object

GenerateMipMapsParameters

key

description

default

field_type

json_type

minZ

no description

NA

Integer

int

maxZ

no description

NA

Integer

int

z

no description

NA

Integer

int

zValues

no description

NA

List

int

input_json

file path of input json file

NA

InputFile

str

output_json

file path to output json file

NA

OutputFile

str

log_level

set the logging level of the module

ERROR

LogLevel

str

render

parameters to connect to render server

(REQUIRED)

RenderClientParameters

dict

input_stack

no description

(REQUIRED)

String

str

output_dir

directory to which the mipmaps will be stored

NA

String

str

output_prefix

uri prefix for generated mipmaps

(REQUIRED)

String

str

method

method to downsample mipmapLevels, ‘PIL’ for PIL Image (currently NEAREST) filtered resize, can be ‘block_reduce’ for skimage based area downsampling

block_reduce

String

str

convert_to_8bit

convert the data from 16 to 8 bit (default True)

True

Boolean

bool

pool_size

number of cores to be used

20

Integer

int

imgformat

image format for mipmaps (default tiff)

tiff

String

str

levels

number of levels of mipmaps, default is 6

6

Integer

int

force_redo

force re-generation of existing mipmaps

True

Boolean

bool

PIL_filter

filter to be used in PIL resize

NEAREST

String

str

block_func

function to represent blocks in area downsampling with block_reduce

mean

String

str

directory_to_prefix(data)[source]
opts = <marshmallow.schema.SchemaOpts object>
classmethod validationOptions(options)[source]
class asap.dataimport.schemas.MakeMontageScapeSectionStackOutput(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: DefaultSchema

MakeMontageScapeSectionStackOutput

key

description

default

field_type

json_type

output_stack

Name of the downsampled sections stack

(REQUIRED)

String

str

opts = <marshmallow.schema.SchemaOpts object>
class asap.dataimport.schemas.MakeMontageScapeSectionStackParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Bases: OutputStackParameters

This schema is designed to be a schema_type for an ArgSchemaParser object

MakeMontageScapeSectionStackParameters

key

description

default

field_type

json_type

pool_size

no description

1

Integer

int

minZ

no description

NA

Integer

int

maxZ

no description

NA

Integer

int

z

no description

NA

Integer

int

zValues

no description

NA

List

int

input_json

file path of input json file

NA

InputFile

str

output_json

file path to output json file

NA

OutputFile

str

log_level

set the logging level of the module

ERROR

LogLevel

str

render

parameters to connect to render server

(REQUIRED)

RenderClientParameters

dict

output_stack

no description

(REQUIRED)

String

str

close_stack

no description

False

Boolean

bool

overwrite_zlayer

no description

False

Boolean

bool

output_stackVersion

no description

NA

RenderStackVersion

dict

montage_stack

stack to make a downsample version of

(REQUIRED)

String

str

image_directory

directory that stores the montage scapes

(REQUIRED)

String

str

set_new_z

set to assign new z values starting from 0 (default - False)

False

Boolean

bool

new_z_start

new starting z index

0

Integer

int

remap_section_ids

change section ids to new z values. default = False

False

Boolean

bool

imgformat

image format of the montage scapes (default - tif)

tif

String

str

scale

scale of montage scapes

(REQUIRED)

Float

float

apply_scale

Do you want to scale the downsample to the size of section? Default = False

False

Boolean

bool

doFilter

whether to apply default filtering when generating missing downsamples

True

Boolean

bool

level

integer mipMapLevel used to generate missing downsamples

1

Integer

int

fillWithNoise

Whether to fill the background pixels with noise when generating missing downsamples

False

Boolean

bool

memGB_materialize

Java heap size in GB for materialization

12G

String

str

pool_size_materialize

number of processes to generate missing downsamples

1

Integer

int

filterListName

Apply specified filter list to all renderings

NA

String

str

uuid_prefix

Prepend uuid to generated tileIds to prevent collisions

True

Boolean

bool

uuid_length

length of uuid4 string used in uuid prefix

10

Integer

int

opts = <marshmallow.schema.SchemaOpts object>
validate_data(data)[source]

Module contents