asap.intensity_correction package

Submodules

asap.intensity_correction.apply_multiplicative_correction module

class asap.intensity_correction.apply_multiplicative_correction.MultIntensityCorr(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 MultIntensityCorrParams

default_schema

alias of MultIntensityCorrParams

run()[source]
asap.intensity_correction.apply_multiplicative_correction.getImage(ts, channel=None)[source]

Simple function to get the level 0 image of this tilespec as a numpy array

Parameters
  • ts (renderapi.tilespec.TileSpec) – tilespec to get images from (presently assumes this is a tiff image whose URL can be read with tifffile)

  • channel (str) – channel name to get image of, default=None which will default to the non channel image pyramid

Returns

2d numpy array of this image

Return type

numpy.array

asap.intensity_correction.apply_multiplicative_correction.intensity_corr(img, ff, clip, scale_factor, clip_min, clip_max)[source]

utility function to correct an image with a flatfield correction will take img and return img_out = img * max(ff) / (ff + .0001) converted back to the original type of img

Parameters
  • img (numpy.array) – N,M array to correct, could be any type

  • ff (numpy.array) – N,M array of flatfield correction, could be of any type

Returns

N,M numpy array of the same type as img but now corrected

Return type

numpy.array

asap.intensity_correction.apply_multiplicative_correction.process_tile(C, dirout, stackname, clip, scale_factor, clip_min, clip_max, input_ts, corr_dict=None)[source]

function to correct each tile in the input_ts with the matrix C, and potentially move the original tiles to a new location.abs

Parameters
  • C (numpy.array) – a 2d numpy array of uint16 or uint8 that represents the correction to apply

  • corr_dict (dict or None) – a dictionary with keys of strings of channel names and values of corrections (as with C). If None, C will be applied to each channel, if they exist.

  • dirout (str) – the path to the directory to save all corrected images

  • input_ts (renderapi.tilespec.TileSpec) – the tilespec with the tiles to be corrected

asap.intensity_correction.apply_multiplicative_correction.write_image(dirout, orig_imageurl, Res, stackname, z)[source]

asap.intensity_correction.calculate_multiplicative_correction module

class asap.intensity_correction.calculate_multiplicative_correction.MakeMedian(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 MakeMedianParams

default_schema

alias of MakeMedianParams

run()[source]
asap.intensity_correction.calculate_multiplicative_correction.getImageFromTilespecs(alltilespecs, index, channel=None)[source]
asap.intensity_correction.calculate_multiplicative_correction.make_median_image(alltilespecs, numtiles, outImage, pool_size, chan=None, gauss_size=10)[source]
asap.intensity_correction.calculate_multiplicative_correction.randomly_subsample_tilespecs(alltilespecs, numtiles)[source]

asap.intensity_correction.schemas module

class asap.intensity_correction.schemas.MakeMedianParams(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

MakeMedianParams

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

file_prefix

File prefix for median image file that is saved

Median

String

str

output_directory

Output Directory for saving median image

(REQUIRED)

String

str

num_images

Number of images to randomly subsample to generate median

-1

Integer

int

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

MultIntensityCorrParams

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

correction_stack

Correction stack (usually median stack for AT data)

(REQUIRED)

String

str

output_directory

Directory for storing Images

(REQUIRED)

OutputDir

str

cycle_number

what cycleNumber to upload for output_stack on render

2

Integer

int

cycle_step_number

what cycleStepNumber to upload for output_stack on render

1

Integer

int

clip

whether to clip values

True

Boolean

bool

scale_factor

scaling value

1.0

Float

float

clip_min

Min Clip value

0

Integer

int

clip_max

Max Clip value

65535

Integer

int

opts = <marshmallow.schema.SchemaOpts object>

Module contents