本文整理汇总了Python中lib.images.Images.extend方法的典型用法代码示例。如果您正苦于以下问题:Python Images.extend方法的具体用法?Python Images.extend怎么用?Python Images.extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.images.Images
的用法示例。
在下文中一共展示了Images.extend方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
softwareName = 'dipy'
#Get images
mask = self.getRegistrationImage('mask', 'resample')
#Build qa images
tags = (
('fa', 'Fractional anisotropy'),
('ad', 'Axial Diffusivity'),
('md', 'Mean Diffusivity'),
('rd', 'Radial Diffusivity'),
)
for postfix, description in tags:
image = self.getImage('dwi', postfix)
if image:
qaImage = self.buildName(image, softwareName, 'png')
self.slicerPng(image, qaImage, boundaries=mask)
qaImages.extend(Images((qaImage, description)))
return qaImages
示例2: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
#Get images
dwiNative = self.getPreparationImage('dwi')
dwiCorrected = self.getCorrectionImage('dwi', 'corrected')
dwiDenoised = self.getDenoisingImage('dwi', 'denoise')
noiseMask = self.getImage('mask', ['corrected', 'noisemask'])
ccMask = self.getImage('aparc_aseg', ['253', 'mask', 'downsample'])
b0 = self.getCorrectionImage('b0', 'corrected')
#Build qa images
tags = (
(dwiNative, 'Native'),
(dwiCorrected, 'Corrected'),
(dwiDenoised, 'denoised'),
)
for dwi, description in tags:
if dwi:
qaImages = self.__noiseAnalysis(dwi, noiseMask, ccMask, qaImages, description)
#Build qa masks images
tags = (
(noiseMask, 'Noise mask'),
(ccMask, 'Corpus callosum mask'),
)
for mask, description in tags:
maskPng = self.buildName(mask, None, 'png')
self.slicerPng(b0, maskPng, maskOverlay=mask, boundaries=mask)
qaImages.extend(Images((maskPng, description)))
return qaImages
示例3: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
#Get images
b0 = self.getUpsamplingImage('b0', 'upsample')
whiteMatter = self.getImage("tt5", ["resample", "wm", "mask"])
interfaceGmWm = self.getImage("tt5", ["register", "5tt2gmwmi"])
area253 = self.getImage('aparc_aseg',['253','mask'])
area1024 = self.getImage('aparc_aseg',['1024','mask'])
#Build qa images
tags = (
(whiteMatter, 'resample white segmented mask'),
#(interfaceGmWm, 'grey matter, white matter interface'),
#(area253, 'area 253 from aparc_aseg atlas'),
#(area1024, 'area 1024 from aparc_aseg atlas'),
)
for image, description in tags:
qaImage = self.buildName(image, None, 'png')
self.slicerPng(b0, qaImage, maskOverlay=image, boundaries=image)
qaImages.extend(Images((qaImage, description)))
return qaImages
示例4: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
softwareName = 'dipy'
#Produce tensor ellipsoids png image
rgb = self.getImage('dwi', ['tensor', 'rgb'])
cc = self.getMaskingImage('aparc_aseg', ['253','mask'])
ellipsoidsPng = self.buildName(rgb, 'ellipsoids', 'png')
self.tensorPng(self.__fit, cc, ellipsoidsPng)
qaImages.extend(Images((ellipsoidsPng, 'Tensor ellipsoids in a part of the CC')))
#Get images
mask = self.getRegistrationImage('mask', 'resample')
#Build qa images
tags = (
#(['tensor', 'rgb'], 'RGB map'),
('fa', 'Fractional anisotropy'),
('ad', 'Axial Diffusivity'),
('md', 'Mean Diffusivity'),
('rd', 'Radial Diffusivity'),
)
for postfix, description in tags:
image = self.getImage('dwi', postfix)
if image:
qaImage = self.buildName(image, softwareName, 'png')
self.slicerPng(image, qaImage, boundaries=mask)
qaImages.extend(Images((qaImage, description)))
return qaImages
示例5: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
#Information on denoising algorithm
information = 'Denoising was done using the {} algorithm'.format(self.algorithm)
if self.algorithm == "nlmeans" and \
self.config.get("denoising", "number_array_coil") == "32":
information = "NLMEANS algorithm is not yet implemented for 32 " \
"coils channels images, "
if self.config.getboolean("general", "matlab_available"):
information += "set algorithm to `lpca` or `aonlm` or "
information += "set `ignore: True` into the [denoising] section " \
"of your config.cfg file."
if self.matlabWarning:
information = "Algorithm `aonlm` or `lpca` was set for the " \
"denoising, but Matlab is not available for this server. "\
"Please install and configure Matlab or set `ignore: True`"\
" into the [denoising] section of your config.cfg file."
qaImages.extend(Images((False, 'Denoised diffusion image')))
qaImages.setInformation(information)
#Get images
dwi = self.getPreparationImage("dwi")
dwiDenoised = self.getImage('dwi', 'denoise')
brainMask = self.getImage('mask', 'resample')
b0 = self.getImage('b0')
noiseMask = self.getImage('dwi', 'noise_mask')
#Build qa images
if dwiDenoised:
dwiDenoisedQa = self.plot4dVolume(dwiDenoised, fov=brainMask)
qaImages.append((dwiDenoisedQa, 'Denoised diffusion image'))
dwiCompareQa = self.compare4dVolumes(
dwi, dwiDenoised, fov=brainMask)
qaImages.append((dwiCompareQa, 'Before and after denoising'))
if self.algorithm == "nlmeans":
if self.sigmaVector != None:
sigmaQa = self.plotSigma(self.sigmaVector, dwiDenoised)
qaImages.append(
(sigmaQa, 'Sigmas from the nlmeans algorithm'))
if noiseMask:
noiseMaskQa = self.plot3dVolume(
b0, edges=noiseMask, fov=noiseMask)
qaImages.append(
(noiseMaskQa, 'Noise mask from the nlmeans algorithm'))
return qaImages
示例6: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
#Information on distorsion correction
b0_ap = self.getPreparationImage('b0_ap')
b0_pa = self.getPreparationImage('b0_pa')
mag = self.getPreparationImage('mag')
phase = self.getPreparationImage('phase')
information = ''
if b0_ap and b0_pa:
information = 'Distortion correction done with AP and PA images'
elif mag and phase:
information = 'Distorsion correction done with fieldmap images'
else:
information = 'No distortion correction done'
qaImages.setInformation(information)
#Get images
dwi = self.getPreparationImage('dwi')
dwiCorrected = self.getImage('dwi', 'corrected')
brainMask = self.getImage('mask', 'corrected')
eddyParameterFiles = self.getImage('dwi', None, 'eddy_parameters')
bVecs= self.getPreparationImage('grad', None, 'bvecs')
bVecsCorrected = self.getImage('grad', None, 'bvecs')
#Build qa names
dwiCorrectedGif = self.buildName(dwiCorrected, None, 'gif')
dwiCompareGif = self.buildName(dwiCorrected, 'compare', 'gif')
translationsPng = self.buildName(dwiCorrected, 'translations', 'png')
rotationPng = self.buildName(dwiCorrected, 'rotations', 'png')
bVecsGif = self.buildName(dwiCorrected, 'vectors', 'gif')
#Build qa images
self.slicerGif(dwiCorrected, dwiCorrectedGif, boundaries=brainMask)
self.slicerGifCompare(dwi, dwiCorrected, dwiCompareGif, boundaries=brainMask)
self.plotMovement(eddyParameterFiles, translationsPng, rotationPng)
self.plotvectors(bVecs, bVecsCorrected, bVecsGif)
qaImages.extend(Images(
(dwiCorrectedGif, 'DWI corrected'),
(dwiCompareGif, 'Before and after corrections'),
(translationsPng, 'Translation correction by eddy'),
(rotationPng, 'Rotation correction by eddy'),
(bVecsGif, 'Gradients vectors on the unitary sphere. Red : raw bvec | Blue : opposite bvec | Black + : movement corrected bvec'),
))
return qaImages
示例7: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
algorithm = self.get("algorithm")
#Information on denoising algorithm
information = 'Algorithm {} is set'.format(algorithm)
if self.matlabWarning:
information += ' but matlab is not available on this server'
qaImages.setInformation(information)
#Get images
dwi = self.__getDwiImage()
dwiDenoised = self.getImage('dwi', 'denoise')
brainMask = self.getCorrectionImage('mask', 'corrected')
b0 = self.getCorrectionImage('b0', 'corrected')
noiseMask = self.getImage('dwi', 'noise_mask')
#Build qa images
if dwiDenoised:
dwiDenoisedGif = self.buildName(dwiDenoised, None, 'gif')
dwiCompareGif = self.buildName(dwiDenoised, 'compare', 'gif')
self.slicerGif(dwiDenoised, dwiDenoisedGif, boundaries=brainMask)
self.slicerGifCompare(dwi, dwiDenoised, dwiCompareGif, boundaries=brainMask)
qaImages.extend(Images(
(dwiDenoisedGif, 'Denoised diffusion image'),
(dwiCompareGif, 'Before and after denoising'),
))
if algorithm == "nlmeans":
sigmaPng = self.buildName(dwiDenoised, 'sigma', 'png')
noiseMaskPng = self.buildName(noiseMask, None, 'png')
self.plotSigma(self.sigmaVector, sigmaPng)
self.slicerPng(b0, noiseMaskPng, maskOverlay=noiseMask, boundaries=noiseMask)
qaImages.extend(Images(
(sigmaPng, 'Sigmas from nlmeans algorithm'),
(noiseMaskPng, 'Noise mask from nlmeans algorithm'),
))
return qaImages
示例8: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
tags = (
('anat', 'png', self.slicerPng, 'High resolution anatomical image'),
('dwi', 'gif', self.slicerGif, 'Diffusion weighted image'),
('b0_ap', 'png', self.slicerPng, 'B0 AP image'),
('b0_pa', 'png', self.slicerPng, 'B0 PA image'),
('mag', 'png', self.slicerPng, 'Magnitude image'),
('phase', 'png', self.slicerPng, 'Phase image'),
)
for prefix, imageFormat, slicerMethod, description in tags:
image = self.getImage(prefix)
if image:
qaImage = self.buildName(image, None, imageFormat)
slicerMethod(image, qaImage)
qaImages.extend(Images((qaImage, description)))
return qaImages
示例9: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
softwareName = 'mrtrix'
#Get images
mask = self.getRegistrationImage('mask', 'resample')
#Build qa images
tags = (
('nufo', 'nufo'),
)
for postfix, description in tags:
image = self.getImage('dwi', postfix)
if image:
qaImage = self.buildName(image, softwareName, 'png')
self.slicerPng(image, qaImage, boundaries=mask)
qaImages.extend(Images((qaImage, description)))
return qaImages
示例10: isDirty
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def isDirty(self):
images = Images()
if self.__nbDirections <= 45:
if 'deterministic' in self.get('algorithm'):
images.extend(Images((self.getImage('dwi', 'tensor_det', 'tck'), "deterministic tensor connectome matrix from a streamlines")))
if 'probabilistic' in self.get('algorithm'):
images.extend(Images((self.getImage('dwi', 'tensor_prob', 'tck'), "probabilistic tensor connectome matrix from a streamlines")))
else:
if 'hardi' in self.get('algorithm'):
images.append((self.getImage('dwi', 'hardi_prob', 'tck'), "tckgen hardi probabilistic streamlines tractography"))
if 'sift' in self.get('algorithm'):
images.extend(Images((self.getImage('dwi', 'tcksift', 'tck'), 'tcksift')))
return images
示例11: qaSupplier
# 需要导入模块: from lib.images import Images [as 别名]
# 或者: from lib.images.Images import extend [as 别名]
def qaSupplier(self):
"""Create and supply images for the report generated by qa task
"""
qaImages = Images()
#Information on denoising algorithm
information = 'Denoising was done using the {} algorithm'.format(self.algorithm)
if self.matlabWarning:
information = "Algorithm `aonlm` or `lpca` was set for the " \
"denoising, but Matlab is not available for this server. "\
"Please install and configure Matlab or set `ignore: True`"\
" into the [denoising] section of your config.cfg file."
qaImages.extend(Images((False, 'Denoised diffusion image')))
qaImages.setInformation(information)
#Get images
dwi = self.getPreparationImage("dwi")
dwiDenoised = self.getImage('dwi', 'denoise')
brainMask = self.getImage('mask', 'resample')
b0 = self.getImage('b0')
noiseMask = self.getImage('dwi', 'noise_mask')
noise = self.getImage('dwi','noise')
residuals = self.getImage('dwi', 'residuals')
#Build qa images
if dwiDenoised:
dwiDenoisedQa = self.plot4dVolume(dwiDenoised, fov=brainMask)
qaImages.append((dwiDenoisedQa, 'Denoised diffusion image'))
dwiCompareQa = self.compare4dVolumes(
dwi, dwiDenoised, fov=brainMask)
qaImages.append((dwiCompareQa, 'Before and after denoising'))
if self.algorithm == "nlmeans":
if self.sigmaVector != None:
sigmaQa = self.plotSigma(self.sigmaVector, dwiDenoised)
qaImages.append(
(sigmaQa, 'Sigmas from the nlmeans algorithm'))
if noiseMask:
noiseMaskQa = self.plot3dVolume(
b0, edges=noiseMask, fov=noiseMask)
qaImages.append(
(noiseMaskQa, 'Noise mask from the mp-pca algorithm'))
if self.algorithm == "mp-pca":
if noise:
noiseQa = self.plot3dVolume(
noise, fov=noise)
qaImages.append(
(noiseQa, 'Noise from the mp-pca algorithm'))
if residuals:
resQa = self.plot4dVolume(
residuals, fov=residuals)
qaImages.append(
(resQa, 'Residuals from the mp-pca algorithm'))
return qaImages