class DonorInfoSchema(BaseSchema): _MANY = True id = Int(required=True, description="Donor ID") name = Str(required=True, description="Donor Name") external_donor_name = Str( description="External donor name (expected to be labtracks ID)") specimens = Nested(SpecimenSchema, many=True)
class PairwiseRigidSchema(StackTransitionParameters): match_collection = Str(required=True, description="Point match collection name") gap_file = InputFile( required=False, default=None, missing=None, description="json file {k: v} where int(k) is a z value to skip" "entries in here that are not already missing will" "be omitted from the output stack" "i.e. this is a place one can skip sections") translate_to_positive = Bool( required=False, default=True, missing=True, description="translate output stack to positive space") translation_buffer = List(Float, required=False, default=[0, 0], missing=[0, 0], description=("minimum (x, y) of output stack if " "translate_to_positive=True")) anchor_stack = Str( require=False, default=None, missing=None, description=("fix transforms using tiles in this stack"))
class FlipStackParameters(RenderParameters): input_stack = Str(required=True,description='stack to apply affine to') output_stack = Str(required=False,description='stack to save answer into (defaults to overwriting input_stack)') minZ = Int(required=True,description='minimum Z to flip') maxZ = Int(required=True,description='maximum Z to flip') pool_size = Int(required=False,default=20,description='size of pool for parallel processing (default=20)') delete_after = Boolean(required=False,default=False,description='whether to delete the old image files or not after flipping')
class PointMatchTransferParameters(RenderTransferParameters): collection_source = Str(required=True, description='point match collection to move from source_render') collection_target = Str(required=False, description='point match colleciton to move to target_render (default to the same)') pool_size = Int(required=False,default=20, description='point match colleciton to move to target_render (default to the same)')
class BaseStackParameters(DefaultSchema): stack = Str(required=True, description="Stack name") owner = Str( required=False, default=None, missing=None, description="Owner of the stack (defaults to render clients' owner)") project = Str(required=False, default=None, missing=None, description="Project of the stack") service_host = Str( required=False, default=None, missing=None, description="url of render service host (without http://)") baseURL = Str(required=False, default=None, missing=None, description="Base Render URL") renderbinPath = InputDir(required=False, default=None, missing=None, description="Path to render's client scripts") verbose = Int(required=False, default=0, missing=0, description="Verbose output from solver needed?")
class LensCorrectionParameters(ArgSchema): manifest_path = InputFile(required=True, description='path to manifest file') project_path = Str(required=True, description='path to project directory') fiji_path = InputFile(required=True, description='path to FIJI') grid_size = Int( required=True, description=('maximum row and column to form square ' 'subset of tiles starting from zero (based on filenames ' 'which end in "\{row\}_\{column\}.tif")')) heap_size = Int(required=False, default=20, description="memory in GB to allocate to Java heap") outfile = Str(required=False, description=("File to which json output of lens correction " "(leaf TransformSpec) is written")) processing_directory = Str( required=False, allow_none=True, description=("directory to which trakem2 processing " "directory will be written " "(will place in project_path directory if " "unspecified or create temporary directory if None)")) SIFT_params = Nested(SIFTParameters) align_params = Nested(AlignmentParameters) max_threads_SIFT = Int(required=False, default=3, description=("Threads specified for SIFT"))
class MakeMedianParams(StackTransitionParameters): file_prefix = Str(required=False, default="Median", description='File prefix for median image file that is saved') output_directory = Str(required=True, description='Output Directory for saving median image') num_images = Int (required=False,default=-1, description="Number of images to randomly subsample to generate median")
class DetectAndDropStitchingMistakesParameters(RenderParameters): prestitchedStack = Str( required=True, description='name of render stack of tiles before stitching') poststitchedStack = Str( required=True, description='name of render stack of tiles after stitching') outputStack = Str( required=True, description='name of render stack to output with stitching fixed') jsonDirectory = Str(required=True, description='directory to save json files') edge_threshold = Int( required=False, default=1843, description= 'distance between tilespecs to consider as edges(default=1843)') pool_size = Int(required=False, default=20, description='degree of parallelism (default=20)') distance_threshold = Int( required=False, default=50, description= 'amplitude difference between pre and post stitching results,\ that causes edge to be tossed (units of render)(default=50)')
class ConsolidateTransformsParameters(RenderParameters): stack = Str(required=True, description='stack to consolidate') postfix = Str(required=False, default="_CONS", description=('postfix to add to stack name on saving if no ' 'output defined (default _CONS)')) transforms_slice = Slice( required=True, description=("a string representing a slice describing " "the set of transforms to be consolidated (i.e. 1:)")) output_stack = Str(required=False, description=('name of output stack (default to adding ' 'postfix to input)')) pool_size = Int( required=False, default=10, description=( 'name of output stack (default to adding postfix to input)')) minZ = Float( required=False, description=( "minimum z to consolidate in read in from stack and write " "to output_stack. Default to minimum z in stack")) maxZ = Float( required=False, description=( "maximum z to consolidate in read in from stack and write " "to output_stack. Default to maximum z in stack")) overwrite_zlayer = Boolean( required=False, default=False, description=("whether to remove the existing layer from the " "target stack before uploading.")) close_stack = Boolean(required=False, default=False)
class RenderStackParameters(RenderParameters): stack = Str(required=True, description='stack to render') channel = Str(required=False, description='name to use instead of stack to name files/directories') minX = Int(required=False, description='minimum X of box (else default to stack bounds)') minY = Int(required=False, description='minimum Y of box (else default to stack bounds)') width = Int(required=False, description='width of box (else default to stack bounds)') height = Int(required=False, description='height of box (else default to stack bounds)') scale = Float(required=False,default=1.0, description='scale to render (default is 1.0)') minZ = Int(required=False, description='minimum Z to use to render (default to stack bounds)') maxZ = Int(required=False, description='maximum Z to use to render (default to stack bounds)') minIntensity = Int(required=False,default=0, description='minimum Intensity used to render tiles(default to 0)') maxIntensity = Int(required=False,default=65535, description='maximum Intensity used to render tiles(default to 65535)') volume_dir = Str(required=True, description='root folder to save images.. volume_dir/channel/channel_XXXXXX.tif') pool_size = Int(required=False,default=5, description='degree of parallelism to use (default to 5)')
class ApplyAlignmentFromRegisteredStackParametersBase(RenderParameters): prealigned_stack = Str( required=True, description= 'stack has same tiles as aligned stack but is registered with source_stack(s) example' ) postaligned_stack = Str( required=True, description= 'stack has same tiles as prealignedstack stack but is in the desired aligned space' ) pool_size = Int(required=False, default=20, description='degree of parallelism (default 20)') stackResolutionX = Int( required=False, default=1, description= 'X stack resolution (nm) to save in output stack (default use source stack)' ) stackResolutionY = Int( required=False, default=1, description= 'Y stack resolution (nm) to save in output stack (default use source stack)' ) stackResolutionZ = Int( required=False, default=1, description= 'Z stack resolution (nm) to save in output stack (default use source stack)' )
class ApplyLensCorrectionParameters(StackTransitionParameters): transform = Nested(TransformParameters) refId = Str(allow_none=True, required=True, description=('Reference ID to use when uploading transform to ' 'render database (Not Implemented)')) labels = List(Str, required=False, missing=['lens'], default=['lens'], description="labels for the lens correction transform") maskUrl = InputFile( required=False, default=None, missing=None, description='path to level 0 maskUrl to apply to stack') maskUrl_uri = Str(required=False, default=None, missing=None, description="uri for level 0 mask image to apply") @marshmallow.pre_load def maskUrl_to_uri(self, data): rendermodules.utilities.schema_utils.posix_to_uri( data, "maskUrl", "maskUrl_uri")
class FilterEMParameters(RenderParameters): input_stack = Str(required=True, description='stack to apply affine to') output_stack = Str( required=False, description= 'stack to save answer into (defaults to overwriting input_stack)') pool_size = Int( required=False, default=20, description='size of pool for parallel processing (default=20)') sat_pix = Float( required=False, default=.2, description= 'percent of pixels to saturate when normalizing contrast (default .2%)' ) contrast_adjust = Float( required=False, default=.85, description='constrast fraction to adjust before CLAHE (default .85)') clahe_size = Int( required=False, default=90, description= 'CLAHE parameter for grid size.. smaller is less strong, larger is stronger (default 90)' ) clahe_clip_limit = Float( required=False, default=1.5, description='clip limit for CLAHE normalization (default 1.5)') vert_flip = Boolean(required=False, default=True, description='vertically flip the image (default True)')
class FilterSchema(RenderParameters, ZValueParameters, ProcessPoolParameters): input_stack = Str( required=True, description='stack with stage-aligned coordinates') input_match_collection = Str( required=True, description='Name of the montage point match collection') output_match_collection = Str( required=True, default=None, missing=None, description='Name of the montage point match collection to write to') resmax = Float( required=True, description=("maximum value in " "pixels for average residual in tile pair")) transmax = Float( required=True, description=("maximum value in " "pixels for translation relative to stage coords")) filter_output_file = OutputFile( required=True, description="location of json file with filter output") inverse_weighting = Bool( required=True, default=False, missing=False, description='new weights weighted inverse to counts per tile-pair')
class QCPointMatchResultsParameters(RenderParameters): matchcollections = List( Str, required=True, metadata={'description': 'list of match collections to analyze'}) input_tilepairfile = InputFile( required=True, metadata={'description': 'file path of tile pair file to qc'}) output_tilepairfile = Str( required=True, metadata={ 'description': 'file path of where to save the tile pair file to qc' }) figdir = Str(required=True, metadata={'description': 'directory to save images'}) min_matches = Int( required=False, default=5, metadata={ 'description': 'number of matches between tiles to be considered a valid match' }) pool_size = Int( required=False, default=20, metadata={'description': 'number of parallel threads to use'})
class UploadChannelTileSpecParameters(RenderParameters): inputDir = Str(required=True, metadata={'description': 'directory to upload'}) outputStack = Str(required=True, metadata={'description': 'directory to upload'}) channel = Str(required=True, metadata={'description': 'directory to upload'})
class TransformLocalAnnotationParameters(RenderParameters): stack = Str(required=True, description='stack to look for transform annotations into') input_annotation_file = InputFile(required=True, description='path to annotation file') output_annotation_file = Str( required=True, description='path to save transformed annotation')
class LensCorrectionParameters(ArgSchema): manifest_path = Str(required=True, metadata={'description': 'path to manifest file'}) project_path = Str(required=True, metadata={'description': 'path to project directory'}) SIFT_params = Nested(SIFTParameters) other_params = Nested(OtherParameters)
class PointMatchOptimizationParameters(RenderParameters): stack = Str( required=True, description='Name of the stack containing the tile pair') tile_stack = Str( required=False, default=None, missing=None, description='Name of the stack that will hold these two tiles') tileId1 = Str( required=True, description='tileId of the first tile in the tile pair') tileId2 = Str( required=True, description='tileId of the second tile in the tile pair') pool_size = Int( required=False, default=10, missing=10, description='Pool size for parallel processing') SIFT_options = Nested(SIFT_options, required=True) outputDirectory = OutputDir( required=True, description='Parent directory in which subdirectories will be created to store images and point-match results from SIFT') url_options = Nested(url_options, required=True)
class PostProcessROIsInputSchema(ArgSchema): suite2p_stat_path = Str( required=True, validate=lambda x: Path(x).exists(), description=("Path to s2p output stat file containing ROIs generated " "during source extraction")) motion_corrected_video = Str( required=True, validate=lambda x: Path(x).exists(), description=("Path to motion corrected video file *.h5")) motion_correction_values = InputFile( required=True, description=("Path to motion correction values for each frame " "stored in .csv format. This .csv file is expected to" "have a header row of either:\n" "['framenumber','x','y','correlation','kalman_x'," "'kalman_y']\n['framenumber','x','y','correlation'," "'input_x','input_y','kalman_x'," "'kalman_y','algorithm','type']")) output_json = OutputFile( required=True, description=("Path to a file to write output data.")) maximum_motion_shift = Float( missing=30.0, required=False, allow_none=False, description=("The maximum allowable motion shift for a frame in pixels" " before it is considered an anomaly and thrown out of " "processing")) abs_threshold = Float( missing=None, required=False, allow_none=True, description=("The absolute threshold to binarize ROI masks against. " "If not provided will use quantile to generate " "threshold.")) binary_quantile = Float( missing=0.1, validate=Range(min=0, max=1), description=("The quantile against which an ROI is binarized. If not " "provided will use default function value of 0.1.")) npixel_threshold = Int( default=50, required=False, description=("ROIs with fewer pixels than this will be labeled as " "invalid and small size.")) aspect_ratio_threshold = Float( default=0.2, required=False, description=("ROIs whose aspect ratio is <= this value are " "not recorded. This captures a large majority of " "Suite2P-created artifacts from motion border")) morphological_ops = Bool( default=True, required=False, description=("whether to perform morphological operations after " "binarization. ROIs that are washed away to empty " "after this operation are eliminated from the record. " "This can apply to ROIs that were previously labeled " "as small size, for example."))
class NeuroglancerLayerOptions(DefaultSchema): opacity = Float(validate=mm.validate.Range(0, 1), description="default opacity of layers") blend = Str(default="default", validate=mm.validate.OneOf(['default', 'additive']), description="Blend mode for this each layer created", required=False) shader = Str(description="shader to use")
class SplitTileParameters(RenderParameters): stack = Str(required=True, metadata={'description': 'stack from tile to split'}) tileId = Str(required=True, metadata={'description': 'tileId of tile to split'}) matchCollection = Str( required=True, metadata={'description': 'matchCollection to base splitting on'})
class GenerateMipMapsParameters(InputStackParameters): output_dir = mm.fields.Str( required=False, description='directory to which the mipmaps will be stored') output_prefix = mm.fields.Str( required=True, description=("uri prefix for generated mipmaps")) method = mm.fields.Str( required=True, default="block_reduce", validator=mm.validate.OneOf(["PIL", "block_reduce"]), description=( "method to downsample mipmapLevels, " "'PIL' for PIL Image (currently NEAREST) filtered resize, " "can be 'block_reduce' for skimage based area downsampling")) # "'render' for render-ws based rendering. " convert_to_8bit = mm.fields.Boolean( required=False, default=True, description='convert the data from 16 to 8 bit (default True)') pool_size = mm.fields.Int(required=False, default=20, description='number of cores to be used') imgformat = mm.fields.Str( required=False, default='tiff', description='image format for mipmaps (default tiff)') levels = mm.fields.Int( required=False, default=6, description='number of levels of mipmaps, default is 6') force_redo = mm.fields.Boolean( required=False, default=True, description='force re-generation of existing mipmaps') PIL_filter = Str(required=False, default='NEAREST', validator=mm.validate.OneOf([ 'NEAREST', 'BOX', 'BILINEAR', 'HAMMING', 'BICUBIC', 'LANCZOS' ]), description=('filter to be used in PIL resize')) block_func = Str(required=False, default='mean', validator=mm.validate.OneOf(['mean', 'median']), description=("function to represent blocks in " "area downsampling with block_reduce")) @classmethod def validationOptions(cls, options): excluded_fields = {'PIL': [''], 'block_reduce': [''], 'render': ['']} exc_fields = excluded_fields[options['method']] return cls(exclude=exc_fields).dump(options) # TODO test this @pre_load def directory_to_prefix(self, data): rendermodules.utilities.schema_utils.posix_to_uri( data, "output_dir", "output_prefix")
class AddDownSampleParameters(RenderParameters): input_stack = Str(required=True, description='stack to input') output_stack = Str(required=True, description='stack to output (deletes before upload)') convert_to_8bit = Boolean(required=False,default=True, description='convert the data from 16 to 8 bit (default True)') pool_size = Int(required=False, default=20, description='size of parallelism')
class src_dst(DefaultSchema): src = Str(required=False, missing='opt', default='opt', description=("is optical data src or dst")) dst = Str(required=False, missing='em', default='em', description=("is em data src or dst"))
class common_schema(ArgSchema): client_mount_or_map = Str( required=True, default="/data/em-131fs3", missing="/data/em-131fs3", description=("where the client sees the robocopied destination" " windows example 'Q:'")) fdir = Str(required=True, description="appended to client_mount to find files")
class ApplyTransformParameters(RenderParameters): alignedStack = Str(required=True, metadata={'description':'stack whose transforms you want to copy'}) inputStack = Str(required=True, metadata={'description':'stack you want to apply transforms to'}) outputStack = Str(required=True, metadata={'description':'stack name to save result'}) pool_size = Int(required=True,default=20, metadata={'description':'number of parallel threads'})
class GenerateEMTileSpecsParameters(OutputStackParameters): metafile = InputFile( required=False, description="metadata file containing TEMCA acquisition data") metafile_uri = Str( required=True, description=("uri of metadata containing TEMCA acquisition data")) # FIXME maskUrl and image_directory are not required -- posix_to_uri should support this maskUrl = InputFile(required=False, default=None, missing=None, description="absolute path to image mask to apply") maskUrl_uri = Str(required=False, default=None, missing=None, description=("uri of image mask to apply")) image_directory = InputDir( required=False, description=("directory used in determining absolute paths to images. " "Defaults to parent directory containing metafile " "if omitted.")) image_prefix = Str( required=False, description=( "prefix used in determining full uris of images in metadata. " "Defaults to using the / delimited prefix to " "the metadata_uri if omitted")) maximum_intensity = Int( required=False, default=255, description=("intensity value to interpret as white")) minimum_intensity = Int( required=False, default=0, description=("intensity value to interpret as black")) sectionId = Str( required=False, description=("sectionId to apply to tiles during ingest. " "If unspecified will default to a string " "representation of the float value of z_index.")) @pre_load def metafile_to_uri(self, data): rendermodules.utilities.schema_utils.posix_to_uri( data, "metafile", "metafile_uri") # FIXME not required -- does this work @pre_load def maskUrl_to_uri(self, data): rendermodules.utilities.schema_utils.posix_to_uri( data, "storage_directory", "storage_prefix") @pre_load def image_directory_to_prefix(self, data): rendermodules.utilities.schema_utils.posix_to_uri( data, "image_directory", "image_prefix")
class RegisterSubvolumeOutputParameters(argschema.schemas.DefaultSchema): stack_a = Str(required=True, description=("'parent' stack remaining fixed for this " "transform to register")) stack_b = Str(required=True, description=("'child' stack which moves with this " "transformation in order to register")) transform = Nested( Transform, required=False, default=None, allow_none=True, description="")
class ApplyMaskParameters(RenderParameters): mask_file = Str(required=True, description='Mask file') input_stack = Str(required=True, description='Input Stack') output_stack = Str(required=True, description='Output Stack') pool_size = Int( required=False, default=20, description='size of pool for parallel processing (default=20)') minz = Int(required=False, default=-1, description='minz') maxz = Int(required=False, default=-1, description='maxz')