text stringlengths 81 112k |
|---|
polyStop, is the polymorphisme at wixh number where the calcul of combinaisons stops
def __getSequenceVariants(self, x1, polyStart, polyStop, listSequence) :
"""polyStop, is the polymorphisme at wixh number where the calcul of combinaisons stops"""
if polyStart < len(self.polymorphisms) and polyStart < polyStop:
... |
returns the sequences resulting from all combinaisons of all polymorphismes between x1 and x2. The results is a couple (bool, variants of sequence between x1 and x2), bool == true if there's more combinaisons than maxVariantNumber
def getSequenceVariants(self, x1 = 0, x2 = -1, maxVariantNumber = 128) :
"""returns th... |
returns the nb of variants of sequences between x1 and x2
def getNbVariants(self, x1, x2 = -1) :
"""returns the nb of variants of sequences between x1 and x2"""
if x2 == -1 :
xx2 = len(self.defaultSequence)
else :
xx2 = x2
nbP = 1
for p in self.polymorphisms:
if x1 <= p[0] and p[0] <= xx2 :
n... |
dichotomic search, if lst is None, will return the first position found. If it's a list, will return a list of all positions in lst. returns -1 or [] if no match found
def _dichFind(self, needle, currHaystack, offset, lst = None) :
"""dichotomic search, if lst is None, will return the first position found. If it's a... |
the helper function for KMP-string-searching is to construct the DFA. pattern should be an integer array. return a 2D array representing the DFA for moving the pattern.
def _kmp_construct_next(self, pattern):
"""the helper function for KMP-string-searching is to construct the DFA. pattern should be an ... |
use KMP algorithm to search the first occurrence in the input_sequence of the pattern. both arguments are integer arrays. return the position of the occurence if found; otherwise, -1.
def _kmp_search_first(self, pInput_sequence, pPattern):
"""use KMP algorithm to search the first occurrence in the inpu... |
use KMP algorithm to search all occurrence in the input_sequence of the pattern. both arguments are integer arrays. return a list of the positions of the occurences if found; otherwise, [].
def _kmp_search_all(self, pInput_sequence, pPattern):
"""use KMP algorithm to search all occurrence in the input_... |
find with KMP-searching. needle is an integer array, reprensenting a pattern. haystack is an integer array, reprensenting the input sequence. if lst is None, return the first position found or -1 if no match found. If it's a list, will return a list of all positions in lst. returns -1 or [] if no match found.
def _kmp... |
returns the first occurence of strSeq in self. Takes polymorphisms into account
def findByBiSearch(self, strSeq) :
"""returns the first occurence of strSeq in self. Takes polymorphisms into account"""
arr = self.encode(strSeq)
return self._dichFind(arr[0], self, 0, lst = None) |
Same as find but returns a list of all occurences
def findAllByBiSearch(self, strSeq) :
"""Same as find but returns a list of all occurences"""
arr = self.encode(strSeq)
lst = []
self._dichFind(arr[0], self, 0, lst)
return lst |
returns the first occurence of strSeq in self. Takes polymorphisms into account
def find(self, strSeq) :
"""returns the first occurence of strSeq in self. Takes polymorphisms into account"""
arr = self.encode(strSeq)
return self._kmp_find(arr[0], self) |
Same as find but returns a list of all occurences
def findAll(self, strSeq) :
"""Same as find but returns a list of all occurences"""
arr = self.encode(strSeq)
lst = []
lst = self._kmp_find(arr[0], self, lst)
return lst |
decodes a binary sequence to return a string
def decode(self, binSequence):
"""decodes a binary sequence to return a string"""
try:
binSeq = iter(binSequence[0])
except TypeError, te:
binSeq = binSequence
ret = ''
for b in binSeq :
ch = ''
for c in self.charToBin :
if b & self.forma[self... |
opens a file
def parse(self, filename, gziped = False, stream = False) :
"""opens a file"""
self.stream = stream
if gziped :
self.f = gzip.open(filename)
else :
self.f = open(filename)
self.filename = filename
self.gziped = gziped
lineId = 0
inLegend = True
while inLegend :
ll = sel... |
Decode an UTF-8 String at the given offset
:param offset: offset of the string inside the data
:return: str
def _decode8(self, offset):
"""
Decode an UTF-8 String at the given offset
:param offset: offset of the string inside the data
:return: str
"""
#... |
Decode an UTF-16 String at the given offset
:param offset: offset of the string inside the data
:return: str
def _decode16(self, offset):
"""
Decode an UTF-16 String at the given offset
:param offset: offset of the string inside the data
:return: str
"""
... |
Generic Length Decoding at offset of string
The method works for both 8 and 16 bit Strings.
Length checks are enforced:
* 8 bit strings: maximum of 0x7FFF bytes (See
http://androidxref.com/9.0.0_r3/xref/frameworks/base/libs/androidfw/ResourceTypes.cpp#692)
* 16 bit strings: maxi... |
Apply some fixes to element named and attribute names.
Try to get conform to:
> Like element names, attribute names are case-sensitive and must start with a letter or underscore.
> The rest of the name can contain letters, digits, hyphens, underscores, and periods.
See: https://msdn.micr... |
Return a cleaned version of a value
according to the specification:
> Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
See https://www.w3.org/TR/xml/#charsets
:param value: a value to clean
:return: the cleaned value
def _fix_value(self, va... |
Run analysis on the APK file.
This method is usually called by __init__ except if skip_analysis is False.
It will then parse the AndroidManifest.xml and set all fields in the APK class which can be
extracted from the Manifest.
def _apk_analysis(self):
"""
Run analysis on the AP... |
Return the filetype guessed for a buffer
:param buffer: bytes
:return: str of filetype
def _get_file_magic_name(self, buffer):
"""
Return the filetype guessed for a buffer
:param buffer: bytes
:return: str of filetype
"""
default = "Unknown"
ftype... |
Return the files inside the APK with their associated types (by using python-magic)
:rtype: a dictionnary
def get_files_types(self):
"""
Return the files inside the APK with their associated types (by using python-magic)
:rtype: a dictionnary
"""
if self._files == {}:
... |
Overwrite some probably wrong detections by mime libraries
:param buffer: bytes of the file to detect
:param orig: guess by mime libary
:return: corrected guess
def _patch_magic(self, buffer, orig):
"""
Overwrite some probably wrong detections by mime libraries
:param ... |
Calculates and returns a dictionary of filenames and CRC32
:return: dict of filename: CRC32
def get_files_crc32(self):
"""
Calculates and returns a dictionary of filenames and CRC32
:return: dict of filename: CRC32
"""
if self.files_crc32 == {}:
for i in se... |
Test if the APK has multiple DEX files
:return: True if multiple dex found, otherwise False
def is_multidex(self):
"""
Test if the APK has multiple DEX files
:return: True if multiple dex found, otherwise False
"""
dexre = re.compile("^classes(\d+)?.dex$")
retu... |
Deprecated: use `get_all_attribute_value()` instead
Return elements in xml files which match with the tag name and the specific attribute
:param tag_name: a string which specify the tag name
:param attribute: a string which specify the attribute
def get_elements(self, tag_name, attribute, with_... |
Format a value with packagename, if not already set
:param value:
:return:
def _format_value(self, value):
"""
Format a value with packagename, if not already set
:param value:
:return:
"""
if len(value) > 0:
if value[0] == ".":
... |
:Deprecated: use `get_attribute_value()` instead
Return element in xml files which match with the tag name and the specific attribute
:param tag_name: specify the tag name
:type tag_name: string
:param attribute: specify the attribute
:type attribute: string
:rtype: strin... |
Return true if the attributes matches in attribute filter
:param tag: specify the tag element
:type tag: Element
:param attribute: specify the attribute
:type attribute: string
def is_tag_matched(self, tag, **attribute_filter):
"""
Return true if the attributes matches i... |
Return the String assosciated with the tag name
def name(self):
"""
Return the String assosciated with the tag name
"""
if self.m_name == -1 or (self.m_event != const.START_TAG and self.m_event != const.END_TAG):
return u''
return self.sb[self.m_name] |
Return the Namespace URI (if any) as a String for the current tag
def namespace(self):
"""
Return the Namespace URI (if any) as a String for the current tag
"""
if self.m_name == -1 or (self.m_event != const.START_TAG and self.m_event != const.END_TAG):
return u''
#... |
Return the String assosicated with the current text
def text(self):
"""
Return the String assosicated with the current text
"""
if self.m_name == -1 or self.m_event != const.TEXT:
return u''
return self.sb[self.m_name] |
Return the Namespace URI (if any) for the attribute
def getAttributeNamespace(self, index):
"""
Return the Namespace URI (if any) for the attribute
"""
uri = self.getAttributeUri(index)
# No Namespace
if uri == 0xFFFFFFFF:
return u''
return self.sb[... |
Returns the String which represents the attribute name
def getAttributeName(self, index):
"""
Returns the String which represents the attribute name
"""
offset = self._get_attribute_offset(index)
name = self.m_attributes[offset + const.ATTRIBUTE_IX_NAME]
res = self.sb[n... |
Return the type of the attribute at the given index
:param index: index of the attribute
def getAttributeValueType(self, index):
"""
Return the type of the attribute at the given index
:param index: index of the attribute
"""
offset = self._get_attribute_offset(index)
... |
Return the data of the attribute at the given index
:param index: index of the attribute
def getAttributeValueData(self, index):
"""
Return the data of the attribute at the given index
:param index: index of the attribute
"""
offset = self._get_attribute_offset(index)
... |
Return resource name qualifier for the current configuration.
for example
* `ldpi-v4`
* `hdpi-v4`
All possible qualifiers are listed in table 2 of https://developer.android.com/guide
/topics/resources/providing-resources
FIXME: This name might not have all properties se... |
Generate a cache key from request object data
def make_cache_key(request):
""" Generate a cache key from request object data """
headers = frozenset(request._p['header'].items())
path = frozenset(request._p['path'].items())
query = frozenset(request._p['query'])
return (request.url, headers, path, ... |
check if a cache fits esipy needs or not
def check_cache(cache):
""" check if a cache fits esipy needs or not """
if isinstance(cache, BaseCache):
return cache
elif cache is False:
return DictCache()
elif cache is None:
return DummyCache()
else:
raise ValueError('Pro... |
return the time left in second for an expires header
def get_cache_time_left(expires_header):
""" return the time left in second for an expires header """
epoch = datetime(1970, 1, 1)
# this date is ALWAYS in UTC (RFC 7231)
expire = (
datetime(
*parsedate(expires_header)[:6]
... |
source: https://github.com/openstack/deb-python-oauth2client
Generates a 'code_verifier' as described in section 4.1 of RFC 7636.
This is a 'high-entropy cryptographic random string' that will be
impractical for an attacker to guess.
Args:
n_bytes: integer between 31 and 96, inclusive. default: ... |
source: https://github.com/openstack/deb-python-oauth2client
Creates a 'code_challenge' as described in section 4.2 of RFC 7636
by taking the sha256 hash of the verifier and then urlsafe
base64-encoding it.
Args:
verifier: bytestring, representing a code_verifier as generated by
gene... |
Add a receiver to the list of receivers.
:param receiver: a callable variable
def add_receiver(self, receiver):
""" Add a receiver to the list of receivers.
:param receiver: a callable variable
"""
if not callable(receiver):
raise TypeError("receiver must b... |
Remove a receiver to the list of receivers.
:param receiver: a callable variable
def remove_receiver(self, receiver):
""" Remove a receiver to the list of receivers.
:param receiver: a callable variable
"""
if receiver in self.event_receivers:
self.event_re... |
Trigger all receiver and pass them the parameters
If an exception is raised it will be catched and displayed as error
in the logger (if defined).
:param kwargs: all arguments from the event.
def send_robust(self, **kwargs):
""" Trigger all receiver and pass them the parameters
... |
Get the app from cache or generate a new one if required
Because app object doesn't have etag/expiry, we have to make
a head() call before, to have these informations first...
def __get_or_create_app(self, url, cache_key):
""" Get the app from cache or generate a new one if required
B... |
Invalidate all cached endpoints, meta included
Loop over all meta endpoints to generate all cache key the
invalidate each of them. Doing it this way will prevent the
app not finding keys as the user may change its prefixes
Meta endpoint will be updated upon next call.
:param: pr... |
Get from jwks_ui all the JWK keys required to decode JWT Token.
Parameters
----------
jwks_uri : string
The URL where to gather JWKS key
kwargs : Dict
The constructor parameters
def __get_jwks_key(self, jwks_uri, **kwargs):
"""Get from jwks_ui al... |
Return the Basic Authorization header for oauth if secret_key exists
Returns
-------
type
A dictionary that contains the Basic Authorization key/value,
or {} if secret_key is None
def __get_basic_auth_header(self):
"""Return the Basic Authorization header... |
Generate the request parameters to execute the POST call to
get or refresh a token.
Parameters
----------
params : dictionary
Contains the parameters that will be given as data to the oauth
endpoint
Returns
-------
type
... |
Constructs the full auth uri and returns it..
Parameters
----------
state : string
The state to pass through the auth process
scopes : list (optional)
The list of scope to have
implicit : Boolean (optional)
Activate or not the implici... |
Return the param object for the post() call to get the access_token
from the refresh_token
:param code: the refresh token
:return: a dict with the url, params and header
def get_refresh_token_params(self, scope_list=None):
""" Return the param object for the post() call to get the... |
Update access_token, refresh_token and token_expiry from the
response body.
The response must be converted to a json object before being passed as
a parameter
:param response_json: the response body to use.
:param token_identifier: the user identifier for the token
def up... |
Return true if the token is expired.
The offset can be used to change the expiry time:
- positive value decrease the time (sooner)
- negative value increase the time (later)
If the expiry is not set, always return True. This case allow the users
to define a security object... |
Update the auth data (tokens) using the refresh token in auth.
def refresh(self, scope_list=None):
""" Update the auth data (tokens) using the refresh token in auth.
"""
request_data = self.get_refresh_token_params(scope_list)
res = self._session.post(**request_data)
if res... |
Request the token to the /oauth/token endpoint.
Update the security tokens.
:param code: the code you get from the auth process
def auth(self, code):
""" Request the token to the /oauth/token endpoint.
Update the security tokens.
:param code: the code you get from the a... |
Revoke the current tokens then empty all stored tokens
This returns nothing since the endpoint return HTTP/200
whatever the result is...
Currently not working with JWT, left here for compatibility.
def revoke(self):
"""Revoke the current tokens then empty all stored tokens
... |
Decode and verify the token and return the decoded informations
Parameters
----------
kid : string
The JWKS key id to identify the key to decode the token.
Default is 'JWT-Signature-Key'. Only change if CCP changes it.
options : Dict
The dicti... |
Uses self._request in a sane retry loop (for 5xx level errors).
Do not use the _retry parameter, use the same params as _request
Used when ESIClient is initialized with retry_requests=True
if raise_on_error is True, this will only raise exception after
all retry have been done
d... |
Use a threadpool to send multiple requests in parallel.
:param reqs_and_resps: iterable of req_and_resp tuples
:param raw_body_only: applied to every request call
:param opt: applies to every request call
:param threads: number of concurrent workers to use
:return: a lis... |
Take a request_and_response object from pyswagger.App and
check auth, token, headers, prepare the actual request and fill the
response
Note on performance : if you need more performance (because you are
using this in a batch) you'd rather set raw_body_only=True, as parsed
... |
Take a request_and_response object from pyswagger.App, check
and prepare everything to make a valid HEAD request
:param req_and_resp: the request and response object from pyswagger.App
:param opt: options, see pyswagger/blob/master/pyswagger/io.py#L144
:param raise_on_error: boolea... |
cache the response
if method is one of self.__uncached_method__, don't cache anything
def __cache_response(self, cache_key, res, method):
""" cache the response
if method is one of self.__uncached_method__, don't cache anything
"""
if ('expires' in res.headers
... |
Check cache, deal with expiration and etag, make the request and
return the response or cached response.
:param request: the pyswagger.io.Request object to prepare the request
:param opt: options, see pyswagger/blob/master/pyswagger/io.py#L144
:param cache_key: the cache key used f... |
generate a hash from data object to be used as cache key
def _hash(data):
""" generate a hash from data object to be used as cache key """
hash_algo = hashlib.new('md5')
hash_algo.update(pickle.dumps(data))
# prefix allows possibility of multiple applications
# sharing same keyspace
retur... |
This Method allows computes feature vector and train model.
:cls: list of index number of requested classes in seeds
def fit_from_image(self, data, voxelsize, seeds, unique_cls):
"""
This Method allows computes feature vector and train model.
:cls: list of index number of requested cl... |
Save model to pickle file. External feature function is not stored
def save(self, filename):
"""
Save model to pickle file. External feature function is not stored
"""
import dill
tmpmodelparams = self.modelparams.copy()
# fv_extern_src = None
fv_extern_name = N... |
load model from file. fv_type is not set with this function. It is expected to set it before.
def load(self, mdl_file):
"""
load model from file. fv_type is not set with this function. It is expected to set it before.
"""
import dill as pickle
mdl_file_e = op.expanduser(mdl_fil... |
Input data is 3d image
:param data: is 3d image
:param seeds: ndimage with same shape as data, nonzero values means seeds.
:param unique_cls: can select only fv for seeds from specific class.
f.e. unique_cls = [1, 2] ignores label 0
funcion is called twice in graph cut
... |
Train clas number cl with data clx.
Use trainFromImageAndSeeds() function if you want to use 3D image data
as an input.
clx: data, 2d matrix
cl: label, integer
label: gmmsame, gaussian_kde, dpgmm, stored
def _fit_one_class(self, clx, cl):
""" Train clas number cl with... |
X = numpy.random.random([2,3,4])
# we have data 2x3 with fature vector with 4 fatures
Use likelihoodFromImage() function for 3d image input
m.likelihood(X,0)
def likelihood(self, x, cl):
"""
X = numpy.random.random([2,3,4])
# we have data 2x3 with fature vector with 4 f... |
Get information about one node in graph
:param nlinks: neighboorhood edges
:param msinds: indexes in 3d image
:param node_msindex: int, multiscale index of selected voxel
:return: node_neighboor_edges_and_weights, node_neighboor_seeds
def inspect_node_neighborhood(nlinks, msinds, node_msindex):
""... |
Get information about one node in graph
:param nlinks: neighboorhood edges
:param unariesalt: weights
:param msinds: indexes in 3d image
:param node_msindex: msindex of selected node. See get_node_msindex()
:return: node_unariesalt, node_neighboor_edges_and_weights, node_neighboor_seeds
def inspec... |
Convert seeds-like selection of voxel to multiscale index.
:param msinds: ndarray with indexes
:param node_seed: ndarray with 1 where selected pixel is, or list of indexes in this array
:return: multiscale index of first found seed
def get_node_msindex(msinds, node_seed):
"""
Convert seeds-like sel... |
Makes relabeling of data if there are unused values.
def relabel_squeeze(data):
""" Makes relabeling of data if there are unused values. """
palette, index = np.unique(data, return_inverse=True)
data = index.reshape(data.shape)
# realy slow solution
# unq = np.unique(data)
# act... |
Read model stored in the file.
:param filename: Path to file with model
:param fv_extern: external feature vector function is passed here
:return:
def load(self, filename, fv_extern=None):
"""
Read model stored in the file.
:param filename: Path to file with model
... |
:param axis: direction of edge
:param mask: 3d ndarray with ones where is fine resolution
Neighboorhood penalty between small pixels should be smaller then in
bigger tiles. This is the way how to set it.
def __ms_npenalty_fcn(self, axis, mask, orig_shape):
"""
:param axis: dire... |
Get the segmentation and the
:return:
def __msgc_step12_low_resolution_segmentation(self):
"""
Get the segmentation and the
:return:
"""
import scipy
start = self._start_time
# ===== low resolution data processing
# default parameters
# T... |
Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution
def __msgc_step3_discontinuity_localization(self):
"""
Estimate discontinuity in basis of low resolution image segmentation.
:return: discontinuity in low resolution
""... |
Run Graph-Cut segmentation with refinement of low resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties`
def __multisc... |
Run Graph-Cut segmentation with simplifiyng of high resolution multiscale graph.
In first step is performed normal GC on low resolution data
Second step construct finer grid on edges of segmentation from first
step.
There is no option for use without `use_boundary_penalties`
def __multi... |
Return values (intensities) by indexes.
Used for multiscale graph cut.
data = [[0 1 1],
[0 2 2],
[0 2 2]]
inds = [[0 1 2],
[3 4 4],
[5 4 4]]
return: [0, 1, 1, 0, 2, 0]
If the data are not consistent, it will take... |
Function computes multiscale indexes of ndarray.
mask: Says where is original resolution (0) and where is small
resolution (1). Mask is in small resolution.
orig_shape: Original shape of input data.
zoom: Usually number greater then 1
result = [[0 1 2],
[3 4 ... |
Interactive seed setting with 3d seed editor
def interactivity(self, min_val=None, max_val=None, qt_app=None):
"""
Interactive seed setting with 3d seed editor
"""
from .seed_editor_qt import QTSeedEditor
from PyQt4.QtGui import QApplication
if min_val is None:
... |
Function for manual seed setting. Sets variable seeds and prepares
voxels for density model.
:param seeds: ndarray (0 - nothing, 1 - object, 2 - background,
3 - object just hard constraints, no model training, 4 - background
just hard constraints, no model training)
def set_seeds(self,... |
Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: Allow to skip model fit when the model is prepared before
:return:
def run(self, run_fit_model=True):
"""
Run the Graph Cut segmentation according to preset parameters.
:param run_fit_model: A... |
it works with seed labels:
0: nothing
1: object 1 - full seeds
2: object 2 - full seeds
3: object 1 - not a training seeds
4: object 2 - not a training seeds
def __set_hard_hard_constraints(self, tdata1, tdata2, seeds):
"""
it works with seed labels:
0: n... |
Compute edge values for graph cut tlinks based on image intensity
and texture.
def __similarity_for_tlinks_obj_bgr(
self,
data,
voxelsize,
# voxels1, voxels2,
# seeds, otherfeatures=None
):
"""
Compute edge values for graph cut tlinks based on image i... |
Compute nlinks grid from data shape information. For boundary penalties
are data (intensities) values are used.
ins: Default is None. Used for multiscale GC. This are indexes of
multiscale pixels. Next example shows one superpixel witn index 2.
inds = [
[1 2 2],
... |
Use actual model to calculate similarity. If no input is given the last image is used.
:param data3d:
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param return_unariesalt:
:return:
def debug_get_reconstructed_similarity(
s... |
Show tlinks.
:param data3d: ndarray with input data
:param voxelsize:
:param seeds:
:param area_weight:
:param hard_constraints:
:param show:
:param bins: histogram bins number
:param slice_number:
:return:
def debug_show_reconstructed_similarity(... |
Get info about the node. See pycut.inspect_node() for details.
Processing is done in temporary shape.
:param node_seed:
:return: node_unariesalt, node_neighboor_edges_and_weights, node_neighboor_seeds
def debug_inspect_node(self, node_msindex):
"""
Get info about the node. See ... |
Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return:
def debug_interactive_inspect_node(self):
"""
Call after segmentation to see selected node neighborhood.
User have to select one node by click.
:return:
"""... |
Setting of data.
You need set seeds if you want use hard_constraints.
def _ssgc_prepare_data_and_run_computation(
self,
# voxels1, voxels2,
hard_constraints=True,
area_weight=1,
):
"""
Setting of data.
You need set seeds if you want use hard_constrain... |
Function resize input data to specific shape.
:param data: input 3d array-like data
:param shape: shape of output data
:param zoom: zoom is used for back compatibility
:mode: default is 'nearest'
def resize_to_shape(data, shape, zoom=None, mode="nearest", order=0):
"""
Function resize input dat... |
Smart zoom for sparse matrix. If there is resize to bigger resolution
thin line of label could be lost. This function prefers labels larger
then zero. If there is only one small voxel in larger volume with zeros
it is selected.
def seed_zoom(seeds, zoom):
"""
Smart zoom for sparse matrix. If there ... |
Zoom data to specific shape.
def zoom_to_shape(data, shape, dtype=None):
"""
Zoom data to specific shape.
"""
import scipy
import scipy.ndimage
zoomd = np.array(shape) / np.array(data.shape, dtype=np.double)
import warnings
datares = scipy.ndimage.interpolation.zoom(data, zoomd, order... |
Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
def crop(data, crinfo):
"""
Crop the data.
crop(data, crinfo)
:param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
"""
crinfo = f... |
Combine two crinfos. First used is crinfo1, second used is crinfo2.
def combinecrinfo(crinfo1, crinfo2):
"""
Combine two crinfos. First used is crinfo1, second used is crinfo2.
"""
crinfo1 = fix_crinfo(crinfo1)
crinfo2 = fix_crinfo(crinfo2)
crinfo = [
[crinfo1[0][0] + crinfo2[0][0], cr... |
Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param margin: add margin to minimum block
:return:
def crinfo_from_specific_data(data, margin=0):
"""
Create crinfo of minimum orthogonal nonzero block in input data.
:param data: input data
:param m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.