本文整理汇总了Python中ClearMap.IO.pointShiftFromRange方法的典型用法代码示例。如果您正苦于以下问题:Python IO.pointShiftFromRange方法的具体用法?Python IO.pointShiftFromRange怎么用?Python IO.pointShiftFromRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClearMap.IO
的用法示例。
在下文中一共展示了IO.pointShiftFromRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: joinPoints
# 需要导入模块: from ClearMap import IO [as 别名]
# 或者: from ClearMap.IO import pointShiftFromRange [as 别名]
def joinPoints(results, subStacks = None, shiftPoints = True, **args):
"""Joins a list of points obtained from processing a stack in chunks
Arguments:
results (list): list of point results from the individual sub-processes
subStacks (list or None): list of all sub-stack information, see :ref:`SubStack`
shiftPoints (bool): if True shift points to refer to origin of the image stack considered
when range specification is given. If False, absolute
position in entire image stack.
Returns:
tuple: joined points, joined intensities
"""
nchunks = len(results);
pointlist = [results[i][0] for i in range(nchunks)];
intensities = [results[i][1] for i in range(nchunks)];
results = [];
resultsi = [];
for i in range(nchunks):
cts = pointlist[i];
cti = intensities[i];
if cts.size > 0:
cts[:,2] += subStacks[i]["z"][0];
iid = numpy.logical_and(subStacks[i]["zCenters"][0] <= cts[:,2] , cts[:,2] < subStacks[i]["zCenters"][1]);
cts = cts[iid,:];
results.append(cts);
if not cti is None:
cti = cti[iid];
resultsi.append(cti);
if results == []:
if not intensities is None:
return (numpy.zeros((0,3)), numpy.zeros((0)));
else:
return numpy.zeros((0,3))
else:
points = numpy.concatenate(results);
if shiftPoints:
points = points + io.pointShiftFromRange(io.dataSize(subStacks[0]["source"]), x = subStacks[0]["x"], y = subStacks[0]["y"], z = 0);
else:
points = points - io.pointShiftFromRange(io.dataSize(subStacks[0]["source"]), x = 0, y = 0, z = subStacks[0]["z"]); #absolute offset is added initially via zranges !
if intensities is None:
return points;
else:
return (points, numpy.concatenate(resultsi));