asap.rough_align package

Submodules

asap.rough_align.apply_rough_alignment_to_montages module

exception asap.rough_align.apply_rough_alignment_to_montages.ApplyRoughAlignmentException[source]

Bases: RenderModuleException

Something is wrong in ApplyRough….

class asap.rough_align.apply_rough_alignment_to_montages.ApplyRoughAlignmentTransform(schema_type=None, *args, **kwargs)[source]

Bases: RenderModule

Note

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

default_output_schema

alias of ApplyRoughAlignmentOutputParameters

default_schema

alias of ApplyRoughAlignmentTransformParameters

run()[source]
asap.rough_align.apply_rough_alignment_to_montages.add_masks_to_lowres(render, stack, z, mask_map)[source]
asap.rough_align.apply_rough_alignment_to_montages.apply_rough_alignment(render, input_stack, prealigned_stack, lowres_stack, output_stack, output_dir, scale, mask_input_dir, update_lowres_with_masks, read_masks_from_lowres_stack, filter_montage_output_with_masks, mask_exts, Z, apply_scale=False, consolidateTransforms=True, remap_section_ids=False)[source]
asap.rough_align.apply_rough_alignment_to_montages.filter_highres_with_masks(resolved_highres, tspec_lowres, mask_map)[source]
function to return a filtered list of tilespecs from a

ResolvedTiles object, based on a lowres mask

Parameters
  • resolved_highres (renderapi.resolvedtiles.ResolvedTiles object) – tilespecs and transforms from a single section

  • tspec_lowres (renderapi.tilespec.TileSpec object) – tilespec from a downsampled stack

  • mask_map (dict) – keys should match lowres tileids, values are mask file URI

Returns

new_highres – which highres specs are fully contained within the boundary of mask=255

Return type

List of renderapi.tilespec.TileSpec objects

asap.rough_align.apply_rough_alignment_to_montages.get_mask_paths(mask_input_dir, tilespecs, read_masks_from_lowres_stack, exts=['png', 'tif'])[source]

asap.rough_align.do_rough_alignment module

asap.rough_align.schemas module

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

Bases: DefaultSchema

ApplyRoughAlignmentOutputParameters

key

description

default

field_type

json_type

zs

list of z values that were applied to

NA

NumpyArray

?

output_stack

stack where applied transforms were set

NA

String

str

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

Bases: RenderParameters

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

ApplyRoughAlignmentTransformParameters

key

description

default

field_type

json_type

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

montage_stack

stack to make a downsample version of

(REQUIRED)

String

str

prealigned_stack

stack with dropped tiles corrected for stitching errors

None

String

str

lowres_stack

montage scape stack with rough aligned transform

(REQUIRED)

String

str

output_stack

output high resolution rough aligned stack

(REQUIRED)

String

str

tilespec_directory

path to save section images

(REQUIRED)

String

str

map_z

map the montage Z indices to the rough alignment indices (default - False)

False

Boolean

bool

remap_section_ids

map section ids as well with the new z mapping. Default = False

False

Boolean

bool

consolidate_transforms

should the transforms be consolidated? (default - True)

True

Boolean

bool

scale

scale of montage scapes

(REQUIRED)

Float

float

apply_scale

do you want to apply scale

False

Boolean

bool

pool_size

pool size for parallel processing

10

Integer

int

new_z

List of new z values to be mapped to

None

List

int

old_z

List of z values to apply rough alignment to

(REQUIRED)

List

int

mask_input_dir

directory containing mask files. basenames of masks that match tileIds in the rough stack will be handled.

None

InputDir

str

read_masks_from_lowres_stack

masks will be taken from lowres tilespecs. any mask_input_dir ignored.

False

Boolean

bool

update_lowres_with_masks

should the masks be added to the rough stack?

False

Boolean

bool

filter_montage_output_with_masks

should the tiles written be filtered by the masks?

False

Boolean

bool

mask_exts

what kind of mask files to recognize

[‘png’, ‘tif’]

List

str

close_stack

whether to set output stack to COMPLETE

True

Boolean

bool

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

Bases: RenderParameters

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

DownsampleMaskHandlerSchema

key

description

default

field_type

json_type

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

stack

stack that is read and modified with masks

(REQUIRED)

String

str

close_stack

set COMPLETE or not

True

Boolean

bool

mask_dir

directory containing masks, named <z>_*.png where<z> is a z value in input_stack and may be specifiedin z_apply

None

InputDir

str

collection

name of collection to be filtered by mask, or resetcan be None for no operation

None

String

str

zMask

z values for which the masks will be set

None

List

int

zReset

z values for which the masks will be reset

None

List

int

mask_exts

what kind of mask files to recognize

[‘png’, ‘tif’]

List

str

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

Bases: DefaultSchema

LowresStackParameters

key

description

default

field_type

json_type

stack

Input downsample images section stack

(REQUIRED)

String

str

owner

Owner of the input lowres stack

None

String

str

project

Project of the input lowres stack

None

String

str

service_host

Service host for the input stack Render service

None

String

str

baseURL

Base URL of the Render service for the source stack

None

String

str

renderbinPath

Client scripts location

None

String

str

verbose

Want the output to be verbose?

0

Integer

int

opts = <marshmallow.schema.SchemaOpts object>
class asap.rough_align.schemas.MakeAnchorStackSchema(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

MakeAnchorStackSchema

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

not used in this module, keeps parents happy

[1000]

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

transform_xml

xml transforms from trakemimages from which these are madeare assumed to be named <z>_*.png

NA

InputFile

str

transform_json

Human generated list of transforms.or, json scraped from xmlKeys are of form <z>_*.png where z matches a tilespec in input_stack and values are AffineModel transform jsonswill override xml input.

None

InputFile

str

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

Bases: DefaultSchema

OutputLowresStackParameters

key

description

default

field_type

json_type

stack

Input downsample images section stack

(REQUIRED)

String

str

owner

Owner of the input lowres stack

None

String

str

project

Project of the input lowres stack

None

String

str

service_host

Service host for the input stack Render service

None

String

str

baseURL

Base URL of the Render service for the source stack

None

String

str

renderbinPath

Client scripts location

None

String

str

verbose

Want the output to be verbose?

0

Integer

int

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

Bases: DefaultSchema

PairwiseRigidOutputSchema

key

description

default

field_type

json_type

minZ

minimum z value in output stack

(REQUIRED)

Integer

int

maxZ

minimum z value in output stack

(REQUIRED)

Integer

int

output_stack

name of output stack

(REQUIRED)

String

str

missing

list of z values missing in z range of output stack

(REQUIRED)

List

int

masked

list of z values masked in z range of output stack

(REQUIRED)

List

int

residuals

pairwise residuals in output stack

(REQUIRED)

List

?

opts = <marshmallow.schema.SchemaOpts object>
class asap.rough_align.schemas.PairwiseRigidSchema(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

PairwiseRigidSchema

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

match_collection

Point match collection name

(REQUIRED)

String

str

gap_file

json file {k: v} where int(k) is a z value to skipentries in here that are not already missing willbe omitted from the output stacki.e. this is a place one can skip sections

None

InputFile

str

translate_to_positive

translate output stack to positive space

True

Boolean

bool

translation_buffer

minimum (x, y) of output stack if translate_to_positive=True

[0, 0]

List

float

anchor_stack

fix transforms using tiles in this stack

None

String

str

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

Bases: DefaultSchema

PointMatchCollectionParameters

key

description

default

field_type

json_type

owner

Point match collection owner (defaults to render owner

None

String

str

match_collection

Point match collection name

(REQUIRED)

String

str

server

baseURL of the Render service holding the point match collection

None

String

str

verbose

Verbose output flag

0

Integer

int

opts = <marshmallow.schema.SchemaOpts object>

Module contents