Dataset Viewer
Auto-converted to Parquet Duplicate
repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
sequencelengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
sequencelengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__msgc_step3_discontinuity_localization
def __msgc_step3_discontinuity_localization(self): """ Estimate discontinuity in basis of low resolution image segmentation. :return: discontinuity in low resolution """ import scipy start = self._start_time seg = 1 - self.segmentation.astype(np.int8) sel...
python
def __msgc_step3_discontinuity_localization(self): """ Estimate discontinuity in basis of low resolution image segmentation. :return: discontinuity in low resolution """ import scipy start = self._start_time seg = 1 - self.segmentation.astype(np.int8) sel...
[ "def", "__msgc_step3_discontinuity_localization", "(", "self", ")", ":", "import", "scipy", "start", "=", "self", ".", "_start_time", "seg", "=", "1", "-", "self", ".", "segmentation", ".", "astype", "(", "np", ".", "int8", ")", "self", ".", "stats", "[", ...
Estimate discontinuity in basis of low resolution image segmentation. :return: discontinuity in low resolution
[ "Estimate", "discontinuity", "in", "basis", "of", "low", "resolution", "image", "segmentation", ".", ":", "return", ":", "discontinuity", "in", "low", "resolution" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L323-L372
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__multiscale_gc_lo2hi_run
def __multiscale_gc_lo2hi_run(self): # , pyed): """ 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...
python
def __multiscale_gc_lo2hi_run(self): # , pyed): """ 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...
[ "def", "__multiscale_gc_lo2hi_run", "(", "self", ")", ":", "# , pyed):", "# from PyQt4.QtCore import pyqtRemoveInputHook", "# pyqtRemoveInputHook()", "self", ".", "_msgc_lo2hi_resize_init", "(", ")", "self", ".", "__msgc_step0_init", "(", ")", "hard_constraints", "=", "self...
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`
[ "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"...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L526-L606
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__multiscale_gc_hi2lo_run
def __multiscale_gc_hi2lo_run(self): # , pyed): """ 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. The...
python
def __multiscale_gc_hi2lo_run(self): # , pyed): """ 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. The...
[ "def", "__multiscale_gc_hi2lo_run", "(", "self", ")", ":", "# , pyed):", "# from PyQt4.QtCore import pyqtRemoveInputHook", "# pyqtRemoveInputHook()", "self", ".", "__msgc_step0_init", "(", ")", "hard_constraints", "=", "self", ".", "__msgc_step12_low_resolution_segmentation", "...
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`
[ "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", "gri...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L608-L626
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__ordered_values_by_indexes
def __ordered_values_by_indexes(self, data, inds): """ 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: [...
python
def __ordered_values_by_indexes(self, data, inds): """ 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: [...
[ "def", "__ordered_values_by_indexes", "(", "self", ",", "data", ",", "inds", ")", ":", "# get unique labels and their first indexes", "# lab, linds = np.unique(inds, return_index=True)", "# compute values by indexes", "# values = data.reshape(-1)[linds]", "# alternative slow implementati...
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...
[ "Return", "values", "(", "intensities", ")", "by", "indexes", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L628-L678
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__hi2lo_multiscale_indexes
def __hi2lo_multiscale_indexes(self, mask, orig_shape): # , zoom): """ 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. ...
python
def __hi2lo_multiscale_indexes(self, mask, orig_shape): # , zoom): """ 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. ...
[ "def", "__hi2lo_multiscale_indexes", "(", "self", ",", "mask", ",", "orig_shape", ")", ":", "# , zoom):", "mask_orig", "=", "zoom_to_shape", "(", "mask", ",", "orig_shape", ",", "dtype", "=", "np", ".", "int8", ")", "inds_small", "=", "np", ".", "arange", ...
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 ...
[ "Function", "computes", "multiscale", "indexes", "of", "ndarray", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L680-L721
mjirik/imcut
imcut/pycut.py
ImageGraphCut.interactivity
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: min_val = np.min(self.img) if max...
python
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: min_val = np.min(self.img) if max...
[ "def", "interactivity", "(", "self", ",", "min_val", "=", "None", ",", "max_val", "=", "None", ",", "qt_app", "=", "None", ")", ":", "from", ".", "seed_editor_qt", "import", "QTSeedEditor", "from", "PyQt4", ".", "QtGui", "import", "QApplication", "if", "mi...
Interactive seed setting with 3d seed editor
[ "Interactive", "seed", "setting", "with", "3d", "seed", "editor" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L723-L753
mjirik/imcut
imcut/pycut.py
ImageGraphCut.set_seeds
def set_seeds(self, seeds): """ 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 cons...
python
def set_seeds(self, seeds): """ 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 cons...
[ "def", "set_seeds", "(", "self", ",", "seeds", ")", ":", "if", "self", ".", "img", ".", "shape", "!=", "seeds", ".", "shape", ":", "raise", "Exception", "(", "\"Seeds must be same size as input image\"", ")", "self", ".", "seeds", "=", "seeds", ".", "astyp...
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)
[ "Function", "for", "manual", "seed", "setting", ".", "Sets", "variable", "seeds", "and", "prepares", "voxels", "for", "density", "model", ".", ":", "param", "seeds", ":", "ndarray", "(", "0", "-", "nothing", "1", "-", "object", "2", "-", "background", "3...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L755-L768
mjirik/imcut
imcut/pycut.py
ImageGraphCut.run
def run(self, run_fit_model=True): """ 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: """ if run_fit_model: self.fit_model(self.img, self.voxelsize, self...
python
def run(self, run_fit_model=True): """ 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: """ if run_fit_model: self.fit_model(self.img, self.voxelsize, self...
[ "def", "run", "(", "self", ",", "run_fit_model", "=", "True", ")", ":", "if", "run_fit_model", ":", "self", ".", "fit_model", "(", "self", ".", "img", ",", "self", ".", "voxelsize", ",", "self", ".", "seeds", ")", "self", ".", "_start_time", "=", "ti...
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:
[ "Run", "the", "Graph", "Cut", "segmentation", "according", "to", "preset", "parameters", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L770-L802
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__set_hard_hard_constraints
def __set_hard_hard_constraints(self, tdata1, tdata2, seeds): """ 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 """ seeds_mask = (seeds ...
python
def __set_hard_hard_constraints(self, tdata1, tdata2, seeds): """ 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 """ seeds_mask = (seeds ...
[ "def", "__set_hard_hard_constraints", "(", "self", ",", "tdata1", ",", "tdata2", ",", "seeds", ")", ":", "seeds_mask", "=", "(", "seeds", "==", "1", ")", "|", "(", "seeds", "==", "3", ")", "tdata2", "[", "seeds_mask", "]", "=", "np", ".", "max", "(",...
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
[ "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...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L834-L851
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__similarity_for_tlinks_obj_bgr
def __similarity_for_tlinks_obj_bgr( self, data, voxelsize, # voxels1, voxels2, # seeds, otherfeatures=None ): """ Compute edge values for graph cut tlinks based on image intensity and texture. """ # self.fit_model(data, voxelsize, seed...
python
def __similarity_for_tlinks_obj_bgr( self, data, voxelsize, # voxels1, voxels2, # seeds, otherfeatures=None ): """ Compute edge values for graph cut tlinks based on image intensity and texture. """ # self.fit_model(data, voxelsize, seed...
[ "def", "__similarity_for_tlinks_obj_bgr", "(", "self", ",", "data", ",", "voxelsize", ",", "# voxels1, voxels2,", "# seeds, otherfeatures=None", ")", ":", "# self.fit_model(data, voxelsize, seeds)", "# There is a need to have small vaues for good fit", "# R(obj) = -ln( Pr (Ip | O) )", ...
Compute edge values for graph cut tlinks based on image intensity and texture.
[ "Compute", "edge", "values", "for", "graph", "cut", "tlinks", "based", "on", "image", "intensity", "and", "texture", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1023-L1080
mjirik/imcut
imcut/pycut.py
ImageGraphCut.__create_nlinks
def __create_nlinks(self, data, inds=None, boundary_penalties_fcn=None): """ 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 ...
python
def __create_nlinks(self, data, inds=None, boundary_penalties_fcn=None): """ 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 ...
[ "def", "__create_nlinks", "(", "self", ",", "data", ",", "inds", "=", "None", ",", "boundary_penalties_fcn", "=", "None", ")", ":", "# use the gerneral graph algorithm", "# first, we construct the grid graph", "start", "=", "time", ".", "time", "(", ")", "if", "in...
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], ...
[ "Compute", "nlinks", "grid", "from", "data", "shape", "information", ".", "For", "boundary", "penalties", "are", "data", "(", "intensities", ")", "values", "are", "used", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1152-L1220
mjirik/imcut
imcut/pycut.py
ImageGraphCut.debug_get_reconstructed_similarity
def debug_get_reconstructed_similarity( self, data3d=None, voxelsize=None, seeds=None, area_weight=1, hard_constraints=True, return_unariesalt=False, ): """ Use actual model to calculate similarity. If no input is given the last image is used. ...
python
def debug_get_reconstructed_similarity( self, data3d=None, voxelsize=None, seeds=None, area_weight=1, hard_constraints=True, return_unariesalt=False, ): """ Use actual model to calculate similarity. If no input is given the last image is used. ...
[ "def", "debug_get_reconstructed_similarity", "(", "self", ",", "data3d", "=", "None", ",", "voxelsize", "=", "None", ",", "seeds", "=", "None", ",", "area_weight", "=", "1", ",", "hard_constraints", "=", "True", ",", "return_unariesalt", "=", "False", ",", "...
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:
[ "Use", "actual", "model", "to", "calculate", "similarity", ".", "If", "no", "input", "is", "given", "the", "last", "image", "is", "used", ".", ":", "param", "data3d", ":", ":", "param", "voxelsize", ":", ":", "param", "seeds", ":", ":", "param", "area_...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1222-L1259
mjirik/imcut
imcut/pycut.py
ImageGraphCut.debug_show_reconstructed_similarity
def debug_show_reconstructed_similarity( self, data3d=None, voxelsize=None, seeds=None, area_weight=1, hard_constraints=True, show=True, bins=20, slice_number=None, ): """ Show tlinks. :param data3d: ndarray with input d...
python
def debug_show_reconstructed_similarity( self, data3d=None, voxelsize=None, seeds=None, area_weight=1, hard_constraints=True, show=True, bins=20, slice_number=None, ): """ Show tlinks. :param data3d: ndarray with input d...
[ "def", "debug_show_reconstructed_similarity", "(", "self", ",", "data3d", "=", "None", ",", "voxelsize", "=", "None", ",", "seeds", "=", "None", ",", "area_weight", "=", "1", ",", "hard_constraints", "=", "True", ",", "show", "=", "True", ",", "bins", "=",...
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:
[ "Show", "tlinks", ".", ":", "param", "data3d", ":", "ndarray", "with", "input", "data", ":", "param", "voxelsize", ":", ":", "param", "seeds", ":", ":", "param", "area_weight", ":", ":", "param", "hard_constraints", ":", ":", "param", "show", ":", ":", ...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1261-L1296
mjirik/imcut
imcut/pycut.py
ImageGraphCut.debug_inspect_node
def debug_inspect_node(self, node_msindex): """ 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 """ return ins...
python
def debug_inspect_node(self, node_msindex): """ 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 """ return ins...
[ "def", "debug_inspect_node", "(", "self", ",", "node_msindex", ")", ":", "return", "inspect_node", "(", "self", ".", "nlinks", ",", "self", ".", "unariesalt2", ",", "self", ".", "msinds", ",", "node_msindex", ")" ]
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
[ "Get", "info", "about", "the", "node", ".", "See", "pycut", ".", "inspect_node", "()", "for", "details", ".", "Processing", "is", "done", "in", "temporary", "shape", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1298-L1306
mjirik/imcut
imcut/pycut.py
ImageGraphCut.debug_interactive_inspect_node
def debug_interactive_inspect_node(self): """ Call after segmentation to see selected node neighborhood. User have to select one node by click. :return: """ if ( np.sum( np.abs( np.asarray(self.msinds.shape) - np.asarray(sel...
python
def debug_interactive_inspect_node(self): """ Call after segmentation to see selected node neighborhood. User have to select one node by click. :return: """ if ( np.sum( np.abs( np.asarray(self.msinds.shape) - np.asarray(sel...
[ "def", "debug_interactive_inspect_node", "(", "self", ")", ":", "if", "(", "np", ".", "sum", "(", "np", ".", "abs", "(", "np", ".", "asarray", "(", "self", ".", "msinds", ".", "shape", ")", "-", "np", ".", "asarray", "(", "self", ".", "segmentation",...
Call after segmentation to see selected node neighborhood. User have to select one node by click. :return:
[ "Call", "after", "segmentation", "to", "see", "selected", "node", "neighborhood", ".", "User", "have", "to", "select", "one", "node", "by", "click", ".", ":", "return", ":" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1318-L1359
mjirik/imcut
imcut/pycut.py
ImageGraphCut._ssgc_prepare_data_and_run_computation
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_constraints. """ # from PyQt4.QtCore import pyqtRemoveInputHook ...
python
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_constraints. """ # from PyQt4.QtCore import pyqtRemoveInputHook ...
[ "def", "_ssgc_prepare_data_and_run_computation", "(", "self", ",", "# voxels1, voxels2,", "hard_constraints", "=", "True", ",", "area_weight", "=", "1", ",", ")", ":", "# from PyQt4.QtCore import pyqtRemoveInputHook", "# pyqtRemoveInputHook()", "# import pdb; pdb.set_trace() # BR...
Setting of data. You need set seeds if you want use hard_constraints.
[ "Setting", "of", "data", ".", "You", "need", "set", "seeds", "if", "you", "want", "use", "hard_constraints", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/pycut.py#L1370-L1430
mjirik/imcut
imcut/image_manipulation.py
resize_to_shape
def resize_to_shape(data, shape, zoom=None, mode="nearest", order=0): """ 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' """ # @TODO remove...
python
def resize_to_shape(data, shape, zoom=None, mode="nearest", order=0): """ 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' """ # @TODO remove...
[ "def", "resize_to_shape", "(", "data", ",", "shape", ",", "zoom", "=", "None", ",", "mode", "=", "\"nearest\"", ",", "order", "=", "0", ")", ":", "# @TODO remove old code in except part", "# TODO use function from library in future", "try", ":", "# rint 'pred vyjimkou...
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'
[ "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",...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L14-L49
mjirik/imcut
imcut/image_manipulation.py
seed_zoom
def seed_zoom(seeds, zoom): """ 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. """ # import scipy # loseeds...
python
def seed_zoom(seeds, zoom): """ 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. """ # import scipy # loseeds...
[ "def", "seed_zoom", "(", "seeds", ",", "zoom", ")", ":", "# import scipy", "# loseeds=seeds", "labels", "=", "np", ".", "unique", "(", "seeds", ")", "# remove first label - 0", "labels", "=", "np", ".", "delete", "(", "labels", ",", "0", ")", "# @TODO smart ...
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.
[ "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", ...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L85-L121
mjirik/imcut
imcut/image_manipulation.py
zoom_to_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=0, mode="reflect") if da...
python
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=0, mode="reflect") if da...
[ "def", "zoom_to_shape", "(", "data", ",", "shape", ",", "dtype", "=", "None", ")", ":", "import", "scipy", "import", "scipy", ".", "ndimage", "zoomd", "=", "np", ".", "array", "(", "shape", ")", "/", "np", ".", "array", "(", "data", ".", "shape", "...
Zoom data to specific shape.
[ "Zoom", "data", "to", "specific", "shape", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L124-L144
mjirik/imcut
imcut/image_manipulation.py
crop
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 = fix_crinfo(crinfo) return data[ __int_or_none(crinfo[0][0]) : __int_or_none(crinfo[0][1]), __int_or_none(crinfo[...
python
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 = fix_crinfo(crinfo) return data[ __int_or_none(crinfo[0][0]) : __int_or_none(crinfo[0][1]), __int_or_none(crinfo[...
[ "def", "crop", "(", "data", ",", "crinfo", ")", ":", "crinfo", "=", "fix_crinfo", "(", "crinfo", ")", "return", "data", "[", "__int_or_none", "(", "crinfo", "[", "0", "]", "[", "0", "]", ")", ":", "__int_or_none", "(", "crinfo", "[", "0", "]", "[",...
Crop the data. crop(data, crinfo) :param crinfo: min and max for each axis - [[minX, maxX], [minY, maxY], [minZ, maxZ]]
[ "Crop", "the", "data", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L361-L375
mjirik/imcut
imcut/image_manipulation.py
combinecrinfo
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], crinfo1[0][0] + crinfo2[0][1]], [crinfo1[1][0] + crinfo2[1][0],...
python
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], crinfo1[0][0] + crinfo2[0][1]], [crinfo1[1][0] + crinfo2[1][0],...
[ "def", "combinecrinfo", "(", "crinfo1", ",", "crinfo2", ")", ":", "crinfo1", "=", "fix_crinfo", "(", "crinfo1", ")", "crinfo2", "=", "fix_crinfo", "(", "crinfo2", ")", "crinfo", "=", "[", "[", "crinfo1", "[", "0", "]", "[", "0", "]", "+", "crinfo2", ...
Combine two crinfos. First used is crinfo1, second used is crinfo2.
[ "Combine", "two", "crinfos", ".", "First", "used", "is", "crinfo1", "second", "used", "is", "crinfo2", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L384-L397
mjirik/imcut
imcut/image_manipulation.py
crinfo_from_specific_data
def crinfo_from_specific_data(data, margin=0): """ Create crinfo of minimum orthogonal nonzero block in input data. :param data: input data :param margin: add margin to minimum block :return: """ # hledáme automatický ořez, nonzero dá indexy logger.debug("crinfo") logger.debug(str(m...
python
def crinfo_from_specific_data(data, margin=0): """ Create crinfo of minimum orthogonal nonzero block in input data. :param data: input data :param margin: add margin to minimum block :return: """ # hledáme automatický ořez, nonzero dá indexy logger.debug("crinfo") logger.debug(str(m...
[ "def", "crinfo_from_specific_data", "(", "data", ",", "margin", "=", "0", ")", ":", "# hledáme automatický ořez, nonzero dá indexy", "logger", ".", "debug", "(", "\"crinfo\"", ")", "logger", ".", "debug", "(", "str", "(", "margin", ")", ")", "nzi", "=", "np", ...
Create crinfo of minimum orthogonal nonzero block in input data. :param data: input data :param margin: add margin to minimum block :return:
[ "Create", "crinfo", "of", "minimum", "orthogonal", "nonzero", "block", "in", "input", "data", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L400-L441
mjirik/imcut
imcut/image_manipulation.py
uncrop
def uncrop(data, crinfo, orig_shape, resize=False, outside_mode="constant", cval=0): """ Put some boundary to input image. :param data: input data :param crinfo: array with minimum and maximum index along each axis [[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input im...
python
def uncrop(data, crinfo, orig_shape, resize=False, outside_mode="constant", cval=0): """ Put some boundary to input image. :param data: input data :param crinfo: array with minimum and maximum index along each axis [[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input im...
[ "def", "uncrop", "(", "data", ",", "crinfo", ",", "orig_shape", ",", "resize", "=", "False", ",", "outside_mode", "=", "\"constant\"", ",", "cval", "=", "0", ")", ":", "if", "crinfo", "is", "None", ":", "crinfo", "=", "list", "(", "zip", "(", "[", ...
Put some boundary to input image. :param data: input data :param crinfo: array with minimum and maximum index along each axis [[minX, maxX],[minY, maxY],[minZ, maxZ]]. If crinfo is None, the whole input image is placed into [0, 0, 0]. If crinfo is just series of three numbers, it is used as an...
[ "Put", "some", "boundary", "to", "input", "image", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L444-L522
mjirik/imcut
imcut/image_manipulation.py
fix_crinfo
def fix_crinfo(crinfo, to="axis"): """ Function recognize order of crinfo and convert it to proper format. """ crinfo = np.asarray(crinfo) if crinfo.shape[0] == 2: crinfo = crinfo.T return crinfo
python
def fix_crinfo(crinfo, to="axis"): """ Function recognize order of crinfo and convert it to proper format. """ crinfo = np.asarray(crinfo) if crinfo.shape[0] == 2: crinfo = crinfo.T return crinfo
[ "def", "fix_crinfo", "(", "crinfo", ",", "to", "=", "\"axis\"", ")", ":", "crinfo", "=", "np", ".", "asarray", "(", "crinfo", ")", "if", "crinfo", ".", "shape", "[", "0", "]", "==", "2", ":", "crinfo", "=", "crinfo", ".", "T", "return", "crinfo" ]
Function recognize order of crinfo and convert it to proper format.
[ "Function", "recognize", "order", "of", "crinfo", "and", "convert", "it", "to", "proper", "format", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/image_manipulation.py#L525-L534
mjirik/imcut
imcut/graph.py
grid_edges
def grid_edges(shape, inds=None, return_directions=True): """ Get list of grid edges :param shape: :param inds: :param return_directions: :return: """ if inds is None: inds = np.arange(np.prod(shape)).reshape(shape) # if not self.segparams['use_boundary_penalties'] and \ ...
python
def grid_edges(shape, inds=None, return_directions=True): """ Get list of grid edges :param shape: :param inds: :param return_directions: :return: """ if inds is None: inds = np.arange(np.prod(shape)).reshape(shape) # if not self.segparams['use_boundary_penalties'] and \ ...
[ "def", "grid_edges", "(", "shape", ",", "inds", "=", "None", ",", "return_directions", "=", "True", ")", ":", "if", "inds", "is", "None", ":", "inds", "=", "np", ".", "arange", "(", "np", ".", "prod", "(", "shape", ")", ")", ".", "reshape", "(", ...
Get list of grid edges :param shape: :param inds: :param return_directions: :return:
[ "Get", "list", "of", "grid", "edges", ":", "param", "shape", ":", ":", "param", "inds", ":", ":", "param", "return_directions", ":", ":", "return", ":" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L524-L568
mjirik/imcut
imcut/graph.py
gen_grid_2d
def gen_grid_2d(shape, voxelsize): """ Generate list of edges for a base grid. """ nr, nc = shape nrm1, ncm1 = nr - 1, nc - 1 # sh = nm.asarray(shape) # calculate number of edges, in 2D: (nrows * (ncols - 1)) + ((nrows - 1) * ncols) nedges = 0 for direction in range(len(shape)): ...
python
def gen_grid_2d(shape, voxelsize): """ Generate list of edges for a base grid. """ nr, nc = shape nrm1, ncm1 = nr - 1, nc - 1 # sh = nm.asarray(shape) # calculate number of edges, in 2D: (nrows * (ncols - 1)) + ((nrows - 1) * ncols) nedges = 0 for direction in range(len(shape)): ...
[ "def", "gen_grid_2d", "(", "shape", ",", "voxelsize", ")", ":", "nr", ",", "nc", "=", "shape", "nrm1", ",", "ncm1", "=", "nr", "-", "1", ",", "nc", "-", "1", "# sh = nm.asarray(shape)", "# calculate number of edges, in 2D: (nrows * (ncols - 1)) + ((nrows - 1) * ncol...
Generate list of edges for a base grid.
[ "Generate", "list", "of", "edges", "for", "a", "base", "grid", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L586-L636
mjirik/imcut
imcut/graph.py
write_grid_to_vtk
def write_grid_to_vtk(fname, nodes, edges, node_flag=None, edge_flag=None): """ Write nodes and edges to VTK file :param fname: VTK filename :param nodes: :param edges: :param node_flag: set if this node is really used in output :param edge_flag: set if this flag is used in output :retur...
python
def write_grid_to_vtk(fname, nodes, edges, node_flag=None, edge_flag=None): """ Write nodes and edges to VTK file :param fname: VTK filename :param nodes: :param edges: :param node_flag: set if this node is really used in output :param edge_flag: set if this flag is used in output :retur...
[ "def", "write_grid_to_vtk", "(", "fname", ",", "nodes", ",", "edges", ",", "node_flag", "=", "None", ",", "edge_flag", "=", "None", ")", ":", "if", "node_flag", "is", "None", ":", "node_flag", "=", "np", ".", "ones", "(", "[", "nodes", ".", "shape", ...
Write nodes and edges to VTK file :param fname: VTK filename :param nodes: :param edges: :param node_flag: set if this node is really used in output :param edge_flag: set if this flag is used in output :return:
[ "Write", "nodes", "and", "edges", "to", "VTK", "file", ":", "param", "fname", ":", "VTK", "filename", ":", "param", "nodes", ":", ":", "param", "edges", ":", ":", "param", "node_flag", ":", "set", "if", "this", "node", "is", "really", "used", "in", "...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L646-L683
mjirik/imcut
imcut/graph.py
Graph.add_nodes
def add_nodes(self, coors, node_low_or_high=None): """ Add new nodes at the end of the list. """ last = self.lastnode if type(coors) is nm.ndarray: if len(coors.shape) == 1: coors = coors.reshape((1, coors.size)) nadd = coors.shape[0] ...
python
def add_nodes(self, coors, node_low_or_high=None): """ Add new nodes at the end of the list. """ last = self.lastnode if type(coors) is nm.ndarray: if len(coors.shape) == 1: coors = coors.reshape((1, coors.size)) nadd = coors.shape[0] ...
[ "def", "add_nodes", "(", "self", ",", "coors", ",", "node_low_or_high", "=", "None", ")", ":", "last", "=", "self", ".", "lastnode", "if", "type", "(", "coors", ")", "is", "nm", ".", "ndarray", ":", "if", "len", "(", "coors", ".", "shape", ")", "==...
Add new nodes at the end of the list.
[ "Add", "new", "nodes", "at", "the", "end", "of", "the", "list", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L153-L171
mjirik/imcut
imcut/graph.py
Graph.add_edges
def add_edges(self, conn, edge_direction, edge_group=None, edge_low_or_high=None): """ Add new edges at the end of the list. :param edge_direction: direction flag :param edge_group: describes group of edges from same low super node and same direction :param edge_low_or_high: zero...
python
def add_edges(self, conn, edge_direction, edge_group=None, edge_low_or_high=None): """ Add new edges at the end of the list. :param edge_direction: direction flag :param edge_group: describes group of edges from same low super node and same direction :param edge_low_or_high: zero...
[ "def", "add_edges", "(", "self", ",", "conn", ",", "edge_direction", ",", "edge_group", "=", "None", ",", "edge_low_or_high", "=", "None", ")", ":", "last", "=", "self", ".", "lastedge", "if", "type", "(", "conn", ")", "is", "nm", ".", "ndarray", ":", ...
Add new edges at the end of the list. :param edge_direction: direction flag :param edge_group: describes group of edges from same low super node and same direction :param edge_low_or_high: zero for low to low resolution, one for high to high or high to low resolution. It is used to set w...
[ "Add", "new", "edges", "at", "the", "end", "of", "the", "list", ".", ":", "param", "edge_direction", ":", "direction", "flag", ":", "param", "edge_group", ":", "describes", "group", "of", "edges", "from", "same", "low", "super", "node", "and", "same", "d...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L173-L207
mjirik/imcut
imcut/graph.py
Graph._edge_group_substitution
def _edge_group_substitution( self, ndid, nsplit, idxs, sr_tab, ndoffset, ed_remove, into_or_from ): """ Reconnect edges. :param ndid: id of low resolution edges :param nsplit: number of split :param idxs: indexes of low resolution :param sr_tab: :para...
python
def _edge_group_substitution( self, ndid, nsplit, idxs, sr_tab, ndoffset, ed_remove, into_or_from ): """ Reconnect edges. :param ndid: id of low resolution edges :param nsplit: number of split :param idxs: indexes of low resolution :param sr_tab: :para...
[ "def", "_edge_group_substitution", "(", "self", ",", "ndid", ",", "nsplit", ",", "idxs", ",", "sr_tab", ",", "ndoffset", ",", "ed_remove", ",", "into_or_from", ")", ":", "# this is useful for type(idxs) == np.ndarray", "eidxs", "=", "idxs", "[", "nm", ".", "wher...
Reconnect edges. :param ndid: id of low resolution edges :param nsplit: number of split :param idxs: indexes of low resolution :param sr_tab: :param ndoffset: :param ed_remove: :param into_or_from: if zero, connection of input edges is done. If one, connection of ...
[ "Reconnect", "edges", ".", ":", "param", "ndid", ":", "id", "of", "low", "resolution", "edges", ":", "param", "nsplit", ":", "number", "of", "split", ":", "param", "idxs", ":", "indexes", "of", "low", "resolution", ":", "param", "sr_tab", ":", ":", "pa...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L264-L321
mjirik/imcut
imcut/graph.py
Graph.generate_base_grid
def generate_base_grid(self, vtk_filename=None): """ Run first step of algorithm. Next step is split_voxels :param vtk_filename: :return: """ nd, ed, ed_dir = self.gen_grid_fcn(self.data.shape, self.voxelsize) self.add_nodes(nd) self.add_edges(ed, ed_dir, ...
python
def generate_base_grid(self, vtk_filename=None): """ Run first step of algorithm. Next step is split_voxels :param vtk_filename: :return: """ nd, ed, ed_dir = self.gen_grid_fcn(self.data.shape, self.voxelsize) self.add_nodes(nd) self.add_edges(ed, ed_dir, ...
[ "def", "generate_base_grid", "(", "self", ",", "vtk_filename", "=", "None", ")", ":", "nd", ",", "ed", ",", "ed_dir", "=", "self", ".", "gen_grid_fcn", "(", "self", ".", "data", ".", "shape", ",", "self", ".", "voxelsize", ")", "self", ".", "add_nodes"...
Run first step of algorithm. Next step is split_voxels :param vtk_filename: :return:
[ "Run", "first", "step", "of", "algorithm", ".", "Next", "step", "is", "split_voxels", ":", "param", "vtk_filename", ":", ":", "return", ":" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L404-L415
mjirik/imcut
imcut/graph.py
Graph.split_voxels
def split_voxels(self, vtk_filename=None): """ Second step of algorithm :return:() """ self.cache = {} self.stats["t graph 10"] = time.time() - self.start_time self.msi = MultiscaleArray(self.data.shape, block_size=self.nsplit) # old implementation ...
python
def split_voxels(self, vtk_filename=None): """ Second step of algorithm :return:() """ self.cache = {} self.stats["t graph 10"] = time.time() - self.start_time self.msi = MultiscaleArray(self.data.shape, block_size=self.nsplit) # old implementation ...
[ "def", "split_voxels", "(", "self", ",", "vtk_filename", "=", "None", ")", ":", "self", ".", "cache", "=", "{", "}", "self", ".", "stats", "[", "\"t graph 10\"", "]", "=", "time", ".", "time", "(", ")", "-", "self", ".", "start_time", "self", ".", ...
Second step of algorithm :return:()
[ "Second", "step", "of", "algorithm", ":", "return", ":", "()" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L417-L453
mjirik/imcut
imcut/graph.py
MultiscaleArray.mul_block
def mul_block(self, index, val): """Multiply values in block""" self._prepare_cache_slice(index) self.msinds[self.cache_slice] *= val
python
def mul_block(self, index, val): """Multiply values in block""" self._prepare_cache_slice(index) self.msinds[self.cache_slice] *= val
[ "def", "mul_block", "(", "self", ",", "index", ",", "val", ")", ":", "self", ".", "_prepare_cache_slice", "(", "index", ")", "self", ".", "msinds", "[", "self", ".", "cache_slice", "]", "*=", "val" ]
Multiply values in block
[ "Multiply", "values", "in", "block" ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/graph.py#L714-L717
mjirik/imcut
imcut/features.py
select_from_fv_by_seeds
def select_from_fv_by_seeds(fv, seeds, unique_cls): """ Tool to make simple feature functions take features from feature array by seeds. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :param seeds: ndarray with seeds. Doe...
python
def select_from_fv_by_seeds(fv, seeds, unique_cls): """ Tool to make simple feature functions take features from feature array by seeds. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :param seeds: ndarray with seeds. Doe...
[ "def", "select_from_fv_by_seeds", "(", "fv", ",", "seeds", ",", "unique_cls", ")", ":", "logger", ".", "debug", "(", "\"seeds\"", "+", "str", "(", "seeds", ")", ")", "# fvlin = fv.reshape(-1, int(fv.size/seeds.size))", "expected_shape", "=", "[", "seeds", ".", "...
Tool to make simple feature functions take features from feature array by seeds. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :param seeds: ndarray with seeds. Does not to be linear. :param unique_cls: number of used seeds ...
[ "Tool", "to", "make", "simple", "feature", "functions", "take", "features", "from", "feature", "array", "by", "seeds", ".", ":", "param", "fv", ":", "ndarray", "with", "lineariezed", "feature", ".", "It", "s", "shape", "is", "MxN", "where", "M", "is", "n...
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/features.py#L39-L58
mjirik/imcut
imcut/features.py
return_fv_by_seeds
def return_fv_by_seeds(fv, seeds=None, unique_cls=None): """ Return features selected by seeds and unique_cls or selection from features and corresponding seed classes. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :par...
python
def return_fv_by_seeds(fv, seeds=None, unique_cls=None): """ Return features selected by seeds and unique_cls or selection from features and corresponding seed classes. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :par...
[ "def", "return_fv_by_seeds", "(", "fv", ",", "seeds", "=", "None", ",", "unique_cls", "=", "None", ")", ":", "if", "seeds", "is", "not", "None", ":", "if", "unique_cls", "is", "not", "None", ":", "return", "select_from_fv_by_seeds", "(", "fv", ",", "seed...
Return features selected by seeds and unique_cls or selection from features and corresponding seed classes. :param fv: ndarray with lineariezed feature. It's shape is MxN, where M is number of image pixels and N is number of features :param seeds: ndarray with seeds. Does not to be linear. :param uniqu...
[ "Return", "features", "selected", "by", "seeds", "and", "unique_cls", "or", "selection", "from", "features", "and", "corresponding", "seed", "classes", "." ]
train
https://github.com/mjirik/imcut/blob/1b38e7cd18a7a38fe683c1cabe1222fe5fa03aa3/imcut/features.py#L60-L76
chitamoor/Rester
rester/manifest.py
Variables.expand
def expand(self, expression): """Expands logical constructions.""" self.logger.debug("expand : expression %s", str(expression)) if not is_string(expression): return expression result = self._pattern.sub(lambda var: str(self._variables[var.group(1)]), expression) res...
python
def expand(self, expression): """Expands logical constructions.""" self.logger.debug("expand : expression %s", str(expression)) if not is_string(expression): return expression result = self._pattern.sub(lambda var: str(self._variables[var.group(1)]), expression) res...
[ "def", "expand", "(", "self", ",", "expression", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"expand : expression %s\"", ",", "str", "(", "expression", ")", ")", "if", "not", "is_string", "(", "expression", ")", ":", "return", "expression", "resu...
Expands logical constructions.
[ "Expands", "logical", "constructions", "." ]
train
https://github.com/chitamoor/Rester/blob/1865b17f70b7c597aeadde2d0907cb1b59f10c0f/rester/manifest.py#L34-L52
disqus/gutter
gutter/client/__init__.py
get_gutter_client
def get_gutter_client( alias='default', cache=CLIENT_CACHE, **kwargs ): """ Creates gutter clients and memoizes them in a registry for future quick access. Args: alias (str or None): Name of the client. Used for caching. If name is falsy then do not use the cache...
python
def get_gutter_client( alias='default', cache=CLIENT_CACHE, **kwargs ): """ Creates gutter clients and memoizes them in a registry for future quick access. Args: alias (str or None): Name of the client. Used for caching. If name is falsy then do not use the cache...
[ "def", "get_gutter_client", "(", "alias", "=", "'default'", ",", "cache", "=", "CLIENT_CACHE", ",", "*", "*", "kwargs", ")", ":", "from", "gutter", ".", "client", ".", "models", "import", "Manager", "if", "not", "alias", ":", "return", "Manager", "(", "*...
Creates gutter clients and memoizes them in a registry for future quick access. Args: alias (str or None): Name of the client. Used for caching. If name is falsy then do not use the cache. cache (dict): cache to store gutter managers in. **kwargs: kwargs to be passed the Manger ...
[ "Creates", "gutter", "clients", "and", "memoizes", "them", "in", "a", "registry", "for", "future", "quick", "access", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/__init__.py#L17-L42
disqus/gutter
gutter/client/operators/misc.py
PercentRange._modulo
def _modulo(self, decimal_argument): """ The mod operator is prone to floating point errors, so use decimal. 101.1 % 100 >>> 1.0999999999999943 decimal_context.divmod(Decimal('100.1'), 100) >>> (Decimal('1'), Decimal('0.1')) """ _times, remainder = self....
python
def _modulo(self, decimal_argument): """ The mod operator is prone to floating point errors, so use decimal. 101.1 % 100 >>> 1.0999999999999943 decimal_context.divmod(Decimal('100.1'), 100) >>> (Decimal('1'), Decimal('0.1')) """ _times, remainder = self....
[ "def", "_modulo", "(", "self", ",", "decimal_argument", ")", ":", "_times", ",", "remainder", "=", "self", ".", "_context", ".", "divmod", "(", "decimal_argument", ",", "100", ")", "# match the builtin % behavior by adding the N to the result if negative", "return", "...
The mod operator is prone to floating point errors, so use decimal. 101.1 % 100 >>> 1.0999999999999943 decimal_context.divmod(Decimal('100.1'), 100) >>> (Decimal('1'), Decimal('0.1'))
[ "The", "mod", "operator", "is", "prone", "to", "floating", "point", "errors", "so", "use", "decimal", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/operators/misc.py#L16-L29
disqus/gutter
gutter/client/models.py
Switch.enabled_for
def enabled_for(self, inpt): """ Checks to see if this switch is enabled for the provided input. If ``compounded``, all switch conditions must be ``True`` for the switch to be enabled. Otherwise, *any* condition needs to be ``True`` for the switch to be enabled. The sw...
python
def enabled_for(self, inpt): """ Checks to see if this switch is enabled for the provided input. If ``compounded``, all switch conditions must be ``True`` for the switch to be enabled. Otherwise, *any* condition needs to be ``True`` for the switch to be enabled. The sw...
[ "def", "enabled_for", "(", "self", ",", "inpt", ")", ":", "signals", ".", "switch_checked", ".", "call", "(", "self", ")", "signal_decorated", "=", "partial", "(", "self", ".", "__signal_and_return", ",", "inpt", ")", "if", "self", ".", "state", "is", "s...
Checks to see if this switch is enabled for the provided input. If ``compounded``, all switch conditions must be ``True`` for the switch to be enabled. Otherwise, *any* condition needs to be ``True`` for the switch to be enabled. The switch state is then checked to see if it is ``GLOB...
[ "Checks", "to", "see", "if", "this", "switch", "is", "enabled", "for", "the", "provided", "input", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/models.py#L150-L187
disqus/gutter
gutter/client/models.py
Condition.call
def call(self, inpt): """ Returns if the condition applies to the ``inpt``. If the class ``inpt`` is an instance of is not the same class as the condition's own ``argument``, then ``False`` is returned. This also applies to the ``NONE`` input. Otherwise, ``argument`` i...
python
def call(self, inpt): """ Returns if the condition applies to the ``inpt``. If the class ``inpt`` is an instance of is not the same class as the condition's own ``argument``, then ``False`` is returned. This also applies to the ``NONE`` input. Otherwise, ``argument`` i...
[ "def", "call", "(", "self", ",", "inpt", ")", ":", "if", "inpt", "is", "Manager", ".", "NONE_INPUT", ":", "return", "False", "# Call (construct) the argument with the input object", "argument_instance", "=", "self", ".", "argument", "(", "inpt", ")", "if", "not"...
Returns if the condition applies to the ``inpt``. If the class ``inpt`` is an instance of is not the same class as the condition's own ``argument``, then ``False`` is returned. This also applies to the ``NONE`` input. Otherwise, ``argument`` is called, with ``inpt`` as the instance an...
[ "Returns", "if", "the", "condition", "applies", "to", "the", "inpt", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/models.py#L333-L362
disqus/gutter
gutter/client/models.py
Manager.switches
def switches(self): """ List of all switches currently registered. """ results = [ switch for name, switch in self.storage.iteritems() if name.startswith(self.__joined_namespace) ] return results
python
def switches(self): """ List of all switches currently registered. """ results = [ switch for name, switch in self.storage.iteritems() if name.startswith(self.__joined_namespace) ] return results
[ "def", "switches", "(", "self", ")", ":", "results", "=", "[", "switch", "for", "name", ",", "switch", "in", "self", ".", "storage", ".", "iteritems", "(", ")", "if", "name", ".", "startswith", "(", "self", ".", "__joined_namespace", ")", "]", "return"...
List of all switches currently registered.
[ "List", "of", "all", "switches", "currently", "registered", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/models.py#L438-L447
disqus/gutter
gutter/client/models.py
Manager.switch
def switch(self, name): """ Returns the switch with the provided ``name``. If ``autocreate`` is set to ``True`` and no switch with that name exists, a ``DISABLED`` switch will be with that name. Keyword Arguments: name -- A name of a switch. """ try: ...
python
def switch(self, name): """ Returns the switch with the provided ``name``. If ``autocreate`` is set to ``True`` and no switch with that name exists, a ``DISABLED`` switch will be with that name. Keyword Arguments: name -- A name of a switch. """ try: ...
[ "def", "switch", "(", "self", ",", "name", ")", ":", "try", ":", "switch", "=", "self", ".", "storage", "[", "self", ".", "__namespaced", "(", "name", ")", "]", "except", "KeyError", ":", "if", "not", "self", ".", "autocreate", ":", "raise", "ValueEr...
Returns the switch with the provided ``name``. If ``autocreate`` is set to ``True`` and no switch with that name exists, a ``DISABLED`` switch will be with that name. Keyword Arguments: name -- A name of a switch.
[ "Returns", "the", "switch", "with", "the", "provided", "name", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/models.py#L449-L468
disqus/gutter
gutter/client/models.py
Manager.register
def register(self, switch, signal=signals.switch_registered): ''' Register a switch and persist it to the storage. ''' if not switch.name: raise ValueError('Switch name cannot be blank') switch.manager = self self.__persist(switch) signal.call(switch...
python
def register(self, switch, signal=signals.switch_registered): ''' Register a switch and persist it to the storage. ''' if not switch.name: raise ValueError('Switch name cannot be blank') switch.manager = self self.__persist(switch) signal.call(switch...
[ "def", "register", "(", "self", ",", "switch", ",", "signal", "=", "signals", ".", "switch_registered", ")", ":", "if", "not", "switch", ".", "name", ":", "raise", "ValueError", "(", "'Switch name cannot be blank'", ")", "switch", ".", "manager", "=", "self"...
Register a switch and persist it to the storage.
[ "Register", "a", "switch", "and", "persist", "it", "to", "the", "storage", "." ]
train
https://github.com/disqus/gutter/blob/d686fa3cd0551cacfc5630c8e7b5fa75e6dcfdf5/gutter/client/models.py#L479-L489
kaste/mockito-python
mockito/mockito.py
verify
def verify(obj, times=1, atleast=None, atmost=None, between=None, inorder=False): """Central interface to verify interactions. `verify` uses a fluent interface:: verify(<obj>, times=2).<method_name>(<args>) `args` can be as concrete as necessary. Often a catch-all is enough, especi...
python
def verify(obj, times=1, atleast=None, atmost=None, between=None, inorder=False): """Central interface to verify interactions. `verify` uses a fluent interface:: verify(<obj>, times=2).<method_name>(<args>) `args` can be as concrete as necessary. Often a catch-all is enough, especi...
[ "def", "verify", "(", "obj", ",", "times", "=", "1", ",", "atleast", "=", "None", ",", "atmost", "=", "None", ",", "between", "=", "None", ",", "inorder", "=", "False", ")", ":", "if", "isinstance", "(", "obj", ",", "str", ")", ":", "obj", "=", ...
Central interface to verify interactions. `verify` uses a fluent interface:: verify(<obj>, times=2).<method_name>(<args>) `args` can be as concrete as necessary. Often a catch-all is enough, especially if you're working with strict mocks, bc they throw at call time on unwanted, unconfigured a...
[ "Central", "interface", "to", "verify", "interactions", "." ]
train
https://github.com/kaste/mockito-python/blob/d6b22b003f56ee5b156dbd9d8ba209faf35b6713/mockito/mockito.py#L100-L140
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
19