tile_processing - Tile Processors and properties in python

TileProcessor

class tile_processing.TileProcessor.TileProcessor(creatorName: str = '')[source]

Bases: ABC

Base class for python based tile processors e.g. for machine learning model inference.

exception Error[source]

Bases: RuntimeError, ABC

add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ParameterError[source]

Bases: Error

add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ProcessingError[source]

Bases: Error

add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

prepareProcessBatch(usedProperties: TileProcessorProperties, **processingParameters) None[source]

Can be called before the first processBatch call. The call is not enforced, but recommended. The provided usedProperties are stored in self._usedProperties (so derived classes should not reimplement this method, but _prepareProcessBatch instead).

Parameters:
  • usedProperties – Properties that are to be used within subsequent processBatch calls

  • processingParameters – kwargs with processing params constant for subsequent processBatch calls

Returns:

None

Raises:

ParameterError if an exception is raised in _prepareProcessBatch, indicating that the object is not ready for processBatch()

getProposedProperties() TileProcessorProperties[source]

Returns the proposed tile processor properties by calling custom implementation _getProposedProperties(). Do not overwrite, overwrite _getProposedProperties() instead.

Returns:

A TileProcessorProperties object declaring at least all inputs and outputs by name, and as many properties as possible

Raises:

ParameterError

processBatch(requestedOutputNames: Sequence[str], inputs: Dict[str, ndarray]) Dict[str, ndarray][source]

Public API to convert an input batch into an output batch using the backend. Wraps _processBatch().

Parameters:
  • requestedOutputNames – Names of the outputs to be requested from the TileProcessor

  • inputs – Dictionary with one input batch per input (keys are the input names)

Returns:

Prediction result for the input batch as a dictionary of with output name keys

Raises:

ParameterError for output name validation errors, ProcessingError for processing issues.

processBatchForPreAllocatedOutputs(outputs: Dict[str, ndarray], inputs: Dict[str, ndarray]) None[source]

Public API to convert an input batch into an output batch for which the nd-arrays are already set up and allocated. Wraps _processBatchForPreAllocatedOutputs() and apply selected output filtering (if not already done).

Parameters:
  • outputs – Dictionary of output names and nd-arrays already set up and allocated to take in the result.

  • inputs – Dictionary with one input batch per input (keys are the input names)

Returns:

None

Raises:

ParameterError for output name validation errors, ProcessingError for processing issues.

getParameterInfo() ParameterInfo[source]

Information about the prediction parameters. Usually best not to overwrite, overwrite _addCustomParameterInfo() instead.

Returns:

Information about the prediction parameters.

finalize() None[source]

To be called when the object is about to be discarded, so that cleanup/reset can occur. This method ensures that _finalize() is called, but only once.

Returns:

None

Properties

!!! Important Notice !!!

For technical reasons, the pydantic fields holding the actual properties cannot be shown in this part of the documentation.

Please refer to this external documentation for property information:


class tile_processing.properties.PydanticConfig(*args: Any, **kwargs: Any)[source]

Bases: BaseConfig

class tile_processing.properties.InputProperties(*args: Any, **kwargs: Any)[source]

Bases: _PropertiesBase

InputProperties describe a tile processor’s input. These properties define how input tiles are to be prepared.

All properties are optional, i.e. can also have null/None value, in which case a default handling kicks in.

class Config(*args: Any, **kwargs: Any)

Bases: PydanticConfig

classmethod getDefaultComponentValue(propertyName: str) Any

Returns the default component value of the provided property. Use only for vector properties that actually define such a value (will raise otherwise).

getParameterInfo()

Returns the properties as a ParameterInfo dictionary.

classmethod getPropertyNames() Tuple[str, ...]

Returns a tuple with all available property names.

classmethod getPropertyType(propertyName: str) Any

Returns the type of the property with the given name.

json(*args, **kwargs) str

Returns a JSON representation of the object. See dict() for many of the possible parameters.

class tile_processing.properties.OutputProperties(*args: Any, **kwargs: Any)[source]

Bases: _PropertiesBase

Properties a tile processor input can have. These properties define how input tiles are to be prepared.

class Config(*args: Any, **kwargs: Any)

Bases: PydanticConfig

classmethod getDefaultComponentValue(propertyName: str) Any

Returns the default component value of the provided property. Use only for vector properties that actually define such a value (will raise otherwise).

getParameterInfo()

Returns the properties as a ParameterInfo dictionary.

classmethod getPropertyNames() Tuple[str, ...]

Returns a tuple with all available property names.

classmethod getPropertyType(propertyName: str) Any

Returns the type of the property with the given name.

json(*args, **kwargs) str

Returns a JSON representation of the object. See dict() for many of the possible parameters.

class tile_processing.properties.TileProcessorProperties(*args: Any, **kwargs: Any)[source]

Bases: _PropertiesBase

Comprises all generic properties a TileProcessor can have, which is mostly relevant to describe its inputs/output.

We differentiate between two different application modes for a TileProcessor:

  • For a “global” (or “single-tile”) processing of the input image(s), very few of the properties are relevant.

  • For “page-wise” (or “tiled” or “patch-based”) processing of the input image(s), much more information

needs to be provided so that the processor application module (e.g. ProcessTiles) knows how to create the individual input tiles/patches/batches from the input image and put the resulting output tiles back together into a comprehensive output image.

For details on the properties, see member inputs (InputProperties) and outputs (OutputProperties) documentation.

class Config(*args: Any, **kwargs: Any)[source]

Bases: PydanticConfig

getInputNames() Tuple[str, ...][source]

Just for convenience to simplify porting from TileProcessor.getInputNames()

getOutputNames() Tuple[str, ...][source]

Just for convenience to simplify porting from TileProcessor.getOutputNames()

static getJsonSchemaPath() str[source]

Returns the path to the latest version of the schema.

It can be updated by running the test_properties unit tests with g_UPDATE_PROPERTIES_SCHEMA set in the test code.

static getJsonSchemaDocumentationPath() str[source]

Returns the path to the latest version of the schema documentation.

It can be updated together with the schema by running the test_properties unit tests with g_UPDATE_PROPERTIES_SCHEMA set in the test code, if you pip-install json_schema_for_humans first.

classmethod getDefaultComponentValue(propertyName: str) Any

Returns the default component value of the provided property. Use only for vector properties that actually define such a value (will raise otherwise).

getParameterInfo()

Returns the properties as a ParameterInfo dictionary.

classmethod getPropertyNames() Tuple[str, ...]

Returns a tuple with all available property names.

classmethod getPropertyType(propertyName: str) Any

Returns the type of the property with the given name.

json(*args, **kwargs) str

Returns a JSON representation of the object. See dict() for many of the possible parameters.

Property Types

class tile_processing.property_types.NumpyDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Supported numpy datatypes.

Currently, we only support scalar types that have a 1:1 equivalent in the ML, but it’s not clear if we could not support float16 or float128 and try to cast to/from.

As bool is also not supported as an ML (sub)image type, you can’t use it as a datatype either. However, some TileProcessors support auto-conversion to/from uint8. Please check the individual TileProcessor documentation.

Note that thanks to the _NumpyDataType_parser below, all of these initializations are ok:

NumpyDataType( NumpyDataType.int64 ) NumpyDataType( “float32”) NumpyDataType( “uint64”) NumpyDataType( numpy.dtype( “uint64” ) ) NumpyDataType( numpy.uint64 )

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class tile_processing.property_types.FillMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Enumeration for supported fill modes. While FillValue fills undefined image/padding areas with a user-defined fill value, Reflect will fill them by reflecting the valid data at the borders.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class tile_processing.property_types.ImageDimension(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Enumeration for the possible image dimensions. The enum values for all non-NONE items must not be changed, as they correspond to ML image dimension indices.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class tile_processing.property_types.DimensionMapping(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Enumeration for external to classifier dimension mappings. The enum values for all items starting with “IN” must not be changed, as they correspond to ML image dimension indices.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

tile_processing.property_types.ImageDimensionToMlImageVectorIndex(imageDim: ImageDimension) int[source]

Returns the ML image vector index associated with the given image dimension. imageDim must be a valid ImageDimension (not NONE).

Parameters:

imageDim – Image dimension to get the index of

Returns:

Corresponding index of the input dimension in ML vectors

tile_processing.property_types.DimensionMappingToString(dimMapping: DimensionMapping) str[source]

Converts the given dimension mapping value to a nice, human-readable string, e.g. by removing prefixes. Inverse operation to StringToDimensionMapping.

Parameters:

dimMapping – Dimension mapping to get a string for

Returns:

Human readable string representation (not containing prefixes for the dimensions)

Raises:

TypeError If input is not a DimensionMapping

tile_processing.property_types.StringToDimensionMapping(dimMappingStr: str) DimensionMapping[source]

Converts a valid dimension mapping string into a DimensionMapping enum value, raising a ValueError in case of parsing problems. Inverse operation to DimensionMappingToString.

Parameters:

dimMappingStr – String representation of a dimension mapping (using “X” instead of “X”)

Returns:

DimensionMapping representation of input string

Raises:

ValueError If the input string could not be converted

tile_processing.property_types.DimensionMappingsToString(dimMappings: Sequence[DimensionMapping]) str[source]

Converts a list of dimension mapping enum values into a nice, human-readable comma-separated string. Inverse operation to StringToDimensionMappings.

Example:

DimensionMappingsToString( [ X, Y, CHANNEL1, UNUSED ] ) -> "X, Y, CHANNEL"
Parameters:

dimMappings – Dimension mapping to get a string for

Returns:

Human readable string representation (not containing prefixes for the dimensions, any trailing UNUSED entries removed)

Raises:

TypeError If one of the input sequences’ components is not a DimensionMapping

tile_processing.property_types.StringToDimensionMappings(dimMappingsStr: str, fillWithUNUSED=True) Sequence[DimensionMapping][source]

Converts a string representation of dimension mappings into a list of DimensionMapping enum values, raising a ValueError in case of parsing problems. Inverse operation to DimensionMappingsToString.

Parameters:
  • dimMappingsStr – A comma-separated string with dimension mapping strings

  • fillWithUNUSED – If True, the resulting vector will be extended to full rank (NUM_ML_VECTOR_DIMENSIONS) by appending UNUSED items.

Returns:

List of DimensionMapping corresponding to the input string.

Raises:

ValueError If the input string could not be converted due to an invalid/empty token

tile_processing.property_types.GetCorrespondingDimensionMapping(imageDim: ImageDimension) DimensionMapping[source]

Converts any non-NONE ImageDimension into the corresponding DimensionMappings value, e.g. ID.X into DM.X, and ID.NONE into DM.UNUSED.

tile_processing.property_types.GetCorrespondingImageDimension(dimMapping: DimensionMapping) ImageDimension[source]

Converts any image-dimension-associated DimensionMapping (X, … U) to the corresponding ImageDimension and DM.UNUSED to ID.NONE

utils

tile_processing.utils.getAllInputPropertyNames() Tuple[str][source]
Returns:

Tuple with all input property names

tile_processing.utils.getAllOutputPropertyNames() Tuple[str][source]
Returns:

Tuple with all output property names

tile_processing.utils.fieldToPropertyValue(propertyName: str, fieldValue: Any) Any[source]

Converts the given value (supposedly obtained from a MeVisLab field) to a valid property value.

Parameters:
  • propertyName – Name of the property (without input/output prefix)

  • fieldValue – Value of the property as read from an (ML) field

Returns:

Corresponding property value in the correct property type. If the result is a sequence, its type will be list, not tuple.

Raises:

ValueError or KeyError for unsupported values

tile_processing.utils.propertyToFieldValue(propertyName: str, value: Any) Any[source]

Converts the value of property propertyName to one that will be accepted by a MeVisLab field. As vector field values are tuples, not lists, any list values are converted to tuples.

Parameters:
  • propertyName – Name of the property to convert

  • value – Value of the property

Returns:

Corresponding ML field value for the given property value

Raises:

ValueError for unsupported property names or values

tile_processing.utils.getValidOutputTileSizeGreaterOrEqual(tileSizeHint: Sequence[int], minimumOutputTileSize: Sequence[int], validTileSizeOffset: Sequence[int] | None = None) Sequence[int][source]

Returns a vector that is >= minimumOutputTileSize and as close to tileSizeHint as possible while respecting minimumOutputTileSize and validTileSizeOffset.

In detail, that means for components with validTileSizeOffset > 0: Return the smallest value that fulfills both:

  1. ( ts - minimumOutputTileSize ) % validTileSizeOffset == 0

  2. ts >= tileSizeHint

For components with offset 0: Return minimumOutputTileSize

Parameters:
  • tileSizeHint – Suggested tile size

  • minimumOutputTileSize – Minimum tile size (component-wise)

  • validTileSizeOffset – Quantization of valid tile sizes (component-wise)

Returns:

Smallest valid tile size >= tileSizeHint

tile_processing.utils.removeFromDimensionMapping(props: TileProcessorProperties, inputName: str, dm: DimensionMapping) None[source]

Removed the entry dm from the given props object’s dimensions, and all other vectors, replacing it with a “neutral” default.

Parameters:
  • props – Given TileProcessorProperties object to adapt

  • inputName – Affected (reference) input

  • dm – Dimension mapping to remove

Returns:

None

tile_processing.utils.getComponentLabelsForUsedDimensionMappingString(usedDimMappingStr: str) List[str][source]

Given a string with comma-separated dimension mapping strings, returns a list of short component labels that can be used as vector component labels in a GUI. Note that if only CHANNEL1 occurs and no other channel, the index is omitted from the label.

Examples:

getComponentLabelsForUsedDimensionMappingString( "X, Y, CHANNEL1, BATCH" ) -> [ "X", "Y", "Ch", "Bt" ]
getComponentLabelsForUsedDimensionMappingString( "X, Y, CHANNEL1, CHANNEL2" ) -> [ "X", "Y", "Ch1", "Ch2" ]
Parameters:

usedDimMappingStr – Dimension mappings as human-readable, comma separated string, e.g. “X, Y, CHANNEL1, BATCH”

Returns:

Individual list of short labels corresponding to usedDimMappingStr, e.g. [ “X”, “Y”, “Ch”, “Bt” ]

tile_processing.utils.normalizeAndAdjustTileShape(inputTile: ndarray, shapeHint: Sequence[int]) ndarray[source]

Tries to reshape the input tile to match the provided shapeHint (e.g. -1, 3, 2, 1) by removing/adding leading or trailing trivial dimensions (with extent 1). If the shapeHint is empty, all leading or trailing trivial dimensions will be removed from the input tile.

Examples:

normalizeAndAdjustTileShape( tile with shape [1, 1, 1, 1], shapeHint=[] ) -> tile with shape [1] normalizeAndAdjustTileShape( tile with shape [1, 2, 3, 1, 1], shapeHint=[] ) -> tile with shape [2, 3] normalizeAndAdjustTileShape( tile with shape [1, 2, 3, 1, 1], shapeHint=[2, 3, 1] ) -> tile with shape [2, 3, 1] normalizeAndAdjustTileShape( tile with shape [1, 2, 3, 1, 1], shapeHint=[-1, 3, 1] ) -> tile with shape [2, 3, 1] normalizeAndAdjustTileShape( tile with shape [1, 1, 3, 5, 1, 4, 1], shapeHint=[-1, 3, -1, 1, -1] ) -> tile with shape [1, 3, 5, 1, 4]

tile_processing.utils.mlToNumpyOrder(vec: _ListOrTuple) _ListOrTuple[source]

Converts from ML to numpy dimension order

tile_processing.utils.getCorrectedShape(concreteShape: Sequence[int], templateShape: Sequence[int]) Sequence[int] | None[source]

Returns the corrected concreteShape when matched to the given template. The template has the desired length already, but may contain wildcards (‘-1’) at arbitrary positions.

See test_getCorrectedShape() for examples. This is probably not the easiest algorithm yet, but it works on the test…

tile_processing.utils.isCompatibleShape(concreteShape, templateShape) bool[source]

Returns TRUE if concreteShape has the same length as templateShape and matches in exact numbers when we consider -1 in the templateShape a wildcard

helpers

tile_processing.helpers.toUpperCase(word: str) str[source]

Converts only the first character to upper case and leaves the rest untouched

Example:

toUpperCase( "myPropertyName" ) -> "MyPropertyName"
tile_processing.helpers.toFullVec(seq: Sequence, fillValue: Any = 0, typeToEnsure: type = None, fullNumComponents=6) List[source]

Extends the given tuple or list to TileProcessor.NUM_IMAGE_VECTOR_COMPONENTS components by appending the given fillValue as often as necessary, optionally converting all elements to typeToEnsure at the end.

Parameters:
  • seq – List or tuple with <= TileProcessor.NUM_IMAGE_VECTOR_COMPONENTS elements

  • fillValue – Value used for the elements appended to partialSequence

  • typeToEnsure – If not None, used to convert all elements (including fillValue) to the given type

  • fullNumComponents – “Full” number of components expected, i.e. number of components in the result list

Returns:

Completed sequence

Raises:

TypeError if seq is not a tuple or list

Raises:

ValueError if seq has more than TileProcessor.NUM_IMAGE_VECTOR_COMPONENTS elements

tile_processing.helpers.stripStartAndEnd(seq: Sequence, searchVal: Any) Sequence[source]

Strips leading or trailing occurrences of searchVal from seq.

Parameters:
  • seq – Sequence to strip components from

  • searchVal – Component value to strip