本文整理汇总了Python中ClearMap.IO.isPointFile方法的典型用法代码示例。如果您正苦于以下问题:Python IO.isPointFile方法的具体用法?Python IO.isPointFile怎么用?Python IO.isPointFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClearMap.IO
的用法示例。
在下文中一共展示了IO.isPointFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: correctIllumination
# 需要导入模块: from ClearMap import IO [as 别名]
# 或者: from ClearMap.IO import isPointFile [as 别名]
def correctIllumination(img, correctIlluminationParameter = None, flatfield = None, background = None, scaling = None, save = None, verbose = False,
subStack = None, out = sys.stdout, **parameter):
"""Correct illumination variations
The intensity image :math:`I(x)` given a flat field :math:`F(x)` and
a background :math:`B(x)` the image is corrected to :math:`C(x)` as:
.. math:
C(x) = \\frac{I(x) - B(x)}{F(x) - B(x)}
If the background is not given :math:`B(x) = 0`.
The correction is done slice by slice assuming the data was collected with
a light sheet microscope.
The image is finally optionally scaled.
Arguments:
img (array): image data
findCenterOfMaximaParameter (dict):
============ ==================== ===========================================================
Name Type Descritption
============ ==================== ===========================================================
*flatfield* (str, None or array) flat field intensities, if None d onot correct image for
illumination, if True the
*background* (str, None or array) background image as file name or array
if None background is assumed to be zero
*scaling* (str or None) scale the corrected result by this factor
if 'max'/'mean' scale to keep max/mean invariant
*save* (str or None) save the corrected image to file
*verbose* (bool or int) print / plot information about this step
============ ==================== ===========================================================
subStack (dict or None): sub-stack information
verbose (bool): print progress info
out (object): object to write progress info to
Returns:
array: illumination corrected image
References:
Fundamentals of Light Microscopy and Electronic Imaging, p 421
See Also:
:const:`DefaultFlatFieldLineFile`
"""
flatfield = getParameter(correctIlluminationParameter, "flatfield", flatfield);
background = getParameter(correctIlluminationParameter, "background", background);
scaling = getParameter(correctIlluminationParameter, "scaling", scaling);
save = getParameter(correctIlluminationParameter, "save", save);
verbose = getParameter(correctIlluminationParameter, "verbose", verbose);
if verbose:
if flatfield is None or isinstance(flatfield, str) or flatfield is True:
fld = flatfield;
else:
fld = "image of size %s" % str(flatfield.shape);
if background is None or isinstance(background, str):
bkg = background;
else:
bkg = "image of size %s" % str(background.shape);
writeParameter(out = out, head = 'Illumination correction:', flatfield = fld, background = bkg, scaling = scaling, save = save);
print subStack;
if not subStack is None:
x = subStack["x"];
y = subStack["y"];
else:
x = all;
y = all;
#print "sizes", x, y, img.shape
#read data
timer = Timer();
if flatfield is None:
return img;
elif flatfield is True:
# default flatfield correction
if subStack is None:
flatfield = flatfieldFromLine(DefaultFlatFieldLineFile, img.shape[0]);
else:
dataSize = io.dataSize(subStack["source"]);
flatfield = flatfieldFromLine(DefaultFlatFieldLineFile, dataSize[0]);
elif isinstance(flatfield, str):
# point or image file
if io.isPointFile(flatfield):
if subStack is None:
flatfield = flatfieldFromLine(flatfield, img.shape[0]);
else:
#.........这里部分代码省略.........