def meetRequirement(self): images = Images( (self.getDenoisingImage("dwi", 'denoise'), 'denoise'), (self.getPreparationImage("dwi"), 'diffusion weighted')) if not images.isAtLeastOneImageExists(): return False images = Images( (self.getParcellationImage('norm'), 'freesurfer normalize'), (self.getParcellationImage('mask'), 'freesurfer mask'), (self.getPreparationImage('grad', None, 'bvals'), 'gradient .bvals encoding file'), (self.getPreparationImage( 'grad', None, 'bvecs'), 'gradient .bvecs encoding file'), (self.getPreparationImage('grad', None, 'b'), 'gradient .b encoding file')) # if fieldmap available if Images(self.getPreparationImage("mag"), self.getPreparationImage("phase")).isAllImagesExists(): images.append((self.getParcellationImage('anat', 'freesurfer'), "freesurfer anatomical")) return images
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"), (dwiDenoised, "denoised"), (dwiCorrected, "Corrected")) 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.append((maskPng, description)) return qaImages
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: imageQa = self.plot3dVolume(b0, edges=image, fov=image) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'fsl' #Get images mask = self.getRegistrationImage('mask', 'resample') #Build qa images tags = ( ('fa', 0.7, 'Fractional anisotropy'), ('ad', 0.005, 'Axial Diffusivity'), ('md', 0.005, 'Mean Diffusivity'), ('rd', 0.005, 'Radial Diffusivity'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume( image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) #Build SSE image sse = self.getImage('dwi', 'sse') sseQa = self.plot3dVolume( sse, fov=mask, postfix=softwareName, colorbar=True) qaImages.append((sseQa, 'Sum of squared errors')) return qaImages
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', 5, 'nufo'), ('afd', 5,'afd') ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume( image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'mrtrix' #Set information information = "Estimation using WLS with {} iteration(s)".format(self.get('iter')) qaImages.setInformation(information) #Get images mask = self.getRegistrationImage('mask', 'resample') #Build qa images tags = ( ('fa', 0.7, 'Fractional anisotropy'), ('ad', 0.005, 'Axial Diffusivity'), ('md', 0.005, 'Mean Diffusivity'), ('rd', 0.005, 'Radial Diffusivity'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume( image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
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'), (dwiDenoised, 'denoised'), (dwiCorrected, 'Corrected'), ) 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.append((maskPng, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() information = "Warning: due to storage restriction, streamlines were " \ "downsampled. Even if there is no difference in structural " \ "connectivity, you should be careful before computing any " \ "metrics along these streamlines.\n To run toad without this " \ "downsampling, please refer to the documentation." if self.defaultQuery: # get images norm = self.getRegistrationImage("norm", "resample") self.__buildNameTractQuerierOutputs() # images production tags = ( (self.queries[0], 'Corpus Callosum', 95, 60, 40, -80, 0, 160), (self.queries[1], 'Inferior Fronto Occipital tract left', 95, 80, 40, -90, 0, 90), (self.queries[2], 'Inferior Fronto Occipital tract right', 95, 80, 40, -90, 0, -90), (self.queries[3], 'inferior Longitudinal Fasciculus left', 95, 80, 40, -90, 0, 90), (self.queries[4], 'Inferior Longitudinal Fasciculus right', 95, 80, 40, -90, 0, -90), (self.queries[5], 'Uncinate Fasciculus left', 95, 80, 40, -90, 0, 90), (self.queries[6], 'Uncinate Fasciculus right', 95, 80, 40, -90, 0, -90), (self.queries[7], 'Corticospinal tract Left', 95, 80, 40, -90, 0, 160), (self.queries[8], 'Corticospinal tract right', 95, 80, 40, -90, 0, 200), ) for data, description, xSlice, ySlice, zSlice, xRot, yRot, zRot in tags: if data: imageQa = self.plotTrk(data, norm, None, xSlice, ySlice, zSlice, xRot, yRot, zRot) qaImages.append((imageQa, description)) else: information = """ Because you didn't choose default queries and dictionnary, we are not able to create proper screenshots of the output bundles. """ qaImages.setInformation(information) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() information = "Warning: due to storage restriction, streamlines were " \ "downsampled. Even if there is no difference in structural " \ "connectivity, you should be careful before computing any " \ "metrics along these streamlines.\n To run toad without this " \ "downsampling, please refer to the documentation." if self.defaultQuery: # get images norm = self.getRegistrationImage("norm", "resample") self.__buildNameTractfilteringOutputs() # images production tags = ( (self.outputs[0], 'Corpus Callosum', 95, 60, 40, -80, 0, 160), (self.outputs[1], 'Inferior Fronto Occipital tract left', 95, 80, 40, -90, 0, 90), (self.outputs[2], 'Inferior Fronto Occipital tract right', 95, 80, 40, -90, 0, -90), (self.outputs[3], 'inferior Longitudinal Fasciculus left', 95, 80, 40, -90, 0, 90), (self.outputs[4], 'Inferior Longitudinal Fasciculus right', 95, 80, 40, -90, 0, -90), (self.outputs[5], 'Uncinate Fasciculus left', 95, 80, 40, -90, 0, 90), (self.outputs[6], 'Uncinate Fasciculus right', 95, 80, 40, -90, 0, -90), (self.outputs[7], 'Corticospinal tract Left', 95, 80, 40, -90, 0, 160), (self.outputs[8], 'Corticospinal tract right', 95, 80, 40, -90, 0, 200), ) for data, description, xSlice, ySlice, zSlice, xRot, yRot, zRot in tags: if data is not None: imageQa = self.plotTrk(data, norm, None, xSlice, ySlice, zSlice, xRot, yRot, zRot) qaImages.append((imageQa, description)) else: # Add message about QA pass else: information = """ Because you didn't choose default queries and dictionnary, we are not able to create proper screenshots of the output bundles. """ qaImages.setInformation(information) return qaImages
def meetRequirement(self): images = Images((self.getPreparationImage('dwi'), 'diffusion weighted'), (self.getParcellationImage('norm'), 'freesurfer normalize'), (self.getParcellationImage('mask'), 'freesurfer mask'), (self.getPreparationImage('grad', None, 'bvals'), 'gradient .bvals encoding file'), (self.getPreparationImage('grad', None, 'bvecs'), 'gradient .bvecs encoding file'), (self.getPreparationImage('grad', None, 'b'), 'gradient .b encoding file')) #if fieldmap available if Images(self.getPreparationImage("mag") , self.getPreparationImage("phase")).isAllImagesExists(): images.append((self.getParcellationImage('anat', 'freesurfer'),"freesurfer anatomical")) return images
def isDirty(self): images = Images() dwi = self.getUpsamplingImage('dwi', 'upsample') if mriutil.getNbDirectionsFromDWI(dwi) <= 45 and not self.get('forceHardi'): if 'deterministic' in self.get('algorithm'): images.append(( self.getImage('dwi', 'tensor_det', 'trk'), "deterministic tensor connectome matrix from a streamlines" )) if 'probabilistic' in self.get('algorithm'): images.append(( self.getImage('dwi', 'tensor_prob', 'trk'), "probabilistic tensor connectome matrix from a streamlines" )) else: images.append(( self.getImage('dwi', 'hardi_prob', 'trk'), "tckgen hardi probabilistic streamlines tractography" )) if self.get('sift'): images.append(( self.getImage('dwi', 'tcksift', 'trk'), 'tcksift')) return images
def isDirty(self): images = Images() dwi = self.getUpsamplingImage('dwi', 'upsample') if mriutil.getNbDirectionsFromDWI(dwi) <= 45 and not self.get( 'forceHardi'): if 'deterministic' in self.get('algorithm'): images.append(( self.getImage('dwi', 'tensor_det', 'trk'), "deterministic tensor connectome matrix from a streamlines" )) if 'probabilistic' in self.get('algorithm'): images.append(( self.getImage('dwi', 'tensor_prob', 'trk'), "probabilistic tensor connectome matrix from a streamlines" )) else: images.append( (self.getImage('dwi', 'hardi_prob', 'trk'), "tckgen hardi probabilistic streamlines tractography")) if self.get('sift'): images.append((self.getImage('dwi', 'tcksift', 'trk'), 'tcksift')) return images
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
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() information = "Warning: due to storage restriction, streamlines were " \ "downsampled. Even if there is no difference in structural " \ "connectivity, you should be careful before computing any " \ "metrics along these streamlines.\n To run toad without this " \ "downsampling, please refer to the documentation." qaImages.setInformation(information) #get images norm = self.getRegistrationImage("norm", "resample") mask253 = self.getMaskingImage('aparc_aseg', ['253', 'mask']) #images production if self.__nbDirections <= 45 and not self.get('forceHardi'): tags = ( (self.__tckDetRoiTrk, 'fiber crossing aparc_aseg area 253 from a deterministic tensor streamlines' ), (self.__tckProbRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic tensor streamlines' ), ) else: tags = ( (self.__tckgenRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic hardi streamlines' ), (self.__tcksiftRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic hardi streamlines with sift' ), ) for data, description in tags: if data is not None: imageQa = self.plotTrk(data, norm, mask253, None, None, 65, -70, 2.5, 185) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'dipy' #Set information information = "Fit method: {}".format(self.get('fitMethod')) qaImages.setInformation(information) # mask image mask = self.getRegistrationImage('mask', 'resample') # Produce tensor ellipsoids image dwi = self.getUpsamplingImage('dwi', 'upsample') cc = self.getMaskingImage('aparc_aseg', ['253', 'mask']) ellipsoidsQa = self.plotReconstruction(self.__fit, mask, cc, 'tensor', dwi) qaImages.append( (ellipsoidsQa, 'Coronal slice of tensor ellipsoids in the Corpus Callosum')) # Build qa images tags = ( #(['tensor', 'rgb'], 'RGB map'), ('fa', 0.7, 'Fractional anisotropy'), ('ad', 0.005, 'Axial Diffusivity'), ('md', 0.005, 'Mean Diffusivity'), ('rd', 0.005, 'Radial Diffusivity'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume(image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
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
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'fsl' #Set information information = "Fit method: {}".format(self.get('fitMethod')) qaImages.setInformation(information) #Get images mask = self.getRegistrationImage('mask', 'resample') #Build qa images tags = ( ('fa', 0.7, 'Fractional anisotropy'), ('ad', 0.005, 'Axial Diffusivity'), ('md', 0.005, 'Mean Diffusivity'), ('rd', 0.005, 'Radial Diffusivity'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume(image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) #Build SSE image sse = self.getImage('dwi', 'sse') sseQa = self.plot3dVolume(sse, fov=mask, postfix=softwareName, colorbar=True) qaImages.append((sseQa, 'Sum of squared errors')) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'dipy' #Set information information = "Fit method: {}".format(self.get('fitMethod')) qaImages.setInformation(information) # mask image mask = self.getRegistrationImage('mask', 'resample') # Produce tensor ellipsoids image dwi = self.getUpsamplingImage('dwi', 'upsample') cc = self.getMaskingImage('aparc_aseg', ['253','mask']) ellipsoidsQa = self.plotReconstruction( self.__fit, mask, cc, 'tensor', dwi) qaImages.append(( ellipsoidsQa, 'Coronal slice of tensor ellipsoids in the Corpus Callosum')) # Build qa images tags = ( #(['tensor', 'rgb'], 'RGB map'), ('fa', 0.7, 'Fractional anisotropy'), ('ad', 0.005, 'Axial Diffusivity'), ('md', 0.005, 'Mean Diffusivity'), ('rd', 0.005, 'Radial Diffusivity'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume( image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() tags = ( ('anat', self.plot3dVolume, 'High resolution anatomical image'), ('dwi', self.plot4dVolume, 'Diffusion weighted image'), ('b0_ap', self.plot3dVolume, 'B0 AP image'), ('b0_pa', self.plot3dVolume, 'B0 PA image'), ('mag', self.plot3dVolume, 'Magnitude image'), ('phase', self.plot3dVolume, 'Phase image'), ) for prefix, plotMethod, description in tags: source = self.getImage(prefix) if source: qaImage = plotMethod(source) qaImages.append((qaImage, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() tags = ( ('anat', self.plot3dVolume, 'High resolution anatomical image'), ('dwi', self.plot4dVolume, 'Diffusion weighted image'), ('b0_ap', self.plot3dVolume, 'B0 AP image'), ('b0_pa', self.plot3dVolume, 'B0 PA image'), ('mag', self.plot3dVolume, 'Magnitude image'), ('phase', self.plot3dVolume, 'Phase image'), ) for prefix, plotMethod, description in tags: source = self.getImage(prefix) if source: qaImage = plotMethod(source) qaImages.append((qaImage, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = "dipy" # Get images dwi = self.getUpsamplingImage("dwi", "upsample") cc = self.getMaskingImage("aparc_aseg", ["253", "mask"]) mask = self.getRegistrationImage("mask", "resample") # Produce hardi odfs image data = {"dwiData": self.__dwiData, "csdModel": self.__csdModel} odfsQa = self.plotReconstruction(data, mask, cc, "hardi_odf", dwi) qaImages.append((odfsQa, "Coronal slice of hardi CSD ODFs in the Corpus Callosum")) # Produce hardi peaks image peaksQa = self.plotReconstruction(self.__csdPeaks, mask, cc, "hardi_peak", dwi) qaImages.append((peaksQa, "Coronal slice of hardi CSD Peaks in the Corpus Callosum")) # Build qa images tags = (("gfa", 1.5, "Generalised Fractional Anisotropy"), ("nufo", 5, "nufo")) for postfix, vmax, description in tags: image = self.getImage("dwi", postfix) if image: imageQa = self.plot3dVolume(image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() information = "Warning: due to storage restriction, streamlines were " \ "downsampled. Even if there is no difference in structural " \ "connectivity, you should be careful before computing any " \ "metrics along these streamlines.\n To run toad without this " \ "downsampling, please refer to the documentation." qaImages.setInformation(information) #get images norm = self.getRegistrationImage("norm", "resample") mask253 = self.getMaskingImage('aparc_aseg',['253','mask']) #images production if self.__nbDirections <= 45 and not self.get('forceHardi'): tags = ( (self.__tckDetRoiTrk, 'fiber crossing aparc_aseg area 253 from a deterministic tensor streamlines'), (self.__tckProbRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic tensor streamlines'), ) else: tags = ( (self.__tckgenRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic hardi streamlines'), (self.__tcksiftRoiTrk, 'fiber crossing aparc_aseg area 253 from a probabilistic hardi streamlines with sift'), ) for data, description in tags: if data is not None: imageQa = self.plotTrk(data, norm, mask253, None, None, 65, -70, 2.5, 185) qaImages.append((imageQa, description)) return qaImages
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') #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
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', 5, 'nufo'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume(image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
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'), (dwiDenoised, 'denoised'), (dwiCorrected, 'Corrected'), ) 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.append((maskPng, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'dipy' #Get images dwi = self.getUpsamplingImage('dwi', 'upsample') cc = self.getMaskingImage('aparc_aseg', ['253', 'mask']) mask = self.getRegistrationImage('mask', 'resample') #Produce hardi odfs image data = {'dwiData': self.__dwiData, 'csdModel': self.__csdModel} odfsQa = self.plotReconstruction(data, mask, cc, 'hardi_odf', dwi) qaImages.append( (odfsQa, 'Coronal slice of hardi CSD ODFs in the Corpus Callosum')) #Produce hardi peaks image peaksQa = self.plotReconstruction(self.__csdPeaks, mask, cc, 'hardi_peak', dwi) qaImages.append( (peaksQa, "Coronal slice of hardi CSD Peaks in the Corpus Callosum")) #Build qa images tags = ( ('gfa', 1.5, 'Generalised Fractional Anisotropy'), ('nufo', 5, 'nufo'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume(image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
def qaSupplier(self): """Create and supply images for the report generated by qa task """ qaImages = Images() softwareName = 'dipy' #Get images dwi = self.getUpsamplingImage('dwi', 'upsample') cc = self.getMaskingImage('aparc_aseg', ['253','mask']) mask = self.getRegistrationImage('mask', 'resample') #Produce hardi odfs image data = {'dwiData':self.__dwiData, 'csdModel':self.__csdModel} odfsQa = self.plotReconstruction(data, mask, cc, 'hardi_odf', dwi) qaImages.append(( odfsQa, 'Coronal slice of hardi CSD ODFs in the Corpus Callosum')) #Produce hardi peaks image peaksQa = self.plotReconstruction( self.__csdPeaks, mask, cc, 'hardi_peak', dwi) qaImages.append(( peaksQa, "Coronal slice of hardi CSD Peaks in the Corpus Callosum")) #Build qa images tags = ( ('gfa', 1.5, 'Generalised Fractional Anisotropy'), ('nufo', 5, 'nufo'), ) for postfix, vmax, description in tags: image = self.getImage('dwi', postfix) if image: imageQa = self.plot3dVolume( image, fov=mask, vmax=vmax, colorbar=True, postfix=softwareName) qaImages.append((imageQa, description)) return qaImages
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
def isDirty(self): images = Images((self.getImage('aparc_aseg',['253','mask']), 'area 253 from aparc_aseg atlas'), (self.getImage('aparc_aseg',['1024','mask']), 'area 1024 from aparc_aseg atlas'), (self.getImage("tt5", ["resample", "wm", "mask"]), 'resample white segmented mask'), (self.getImage("tt5", ["register", "5tt2gmwmi"]), 'grey matter, white matter interface')) if self.get("start_seeds").strip() != "": images.append((self.getImage('aparc_aseg', ['resample', 'start', 'extract', 'mask']), 'high resolution, start, brain extracted mask')) images.append((self.getImage('aparc_aseg', ['resample', 'start', 'extract']), 'high resolution, start, brain extracted')) if self.get("stop_seeds").strip() != "": images.append((self.getImage('aparc_aseg', ['resample', 'stop', 'extract', 'mask']), 'high resolution, stop, brain extracted mask')) images.append((self.getImage('aparc_aseg', ['resample', 'stop', 'extract']), 'high resolution, stop, brain extracted')) if self.get("exclude_seeds").strip() != "": images.append((self.getImage('aparc_aseg', ['resample', 'exclude', 'extract', 'mask']), 'high resolution, excluded, brain extracted, mask')) images.append((self.getImage('aparc_aseg', ['resample', 'exclude', 'extract']), 'high resolution, excluded, brain extracted')) return images
def isDirty(self): images = Images((self.getImage( 'aparc_aseg', ['253', 'mask']), 'area 253 from aparc_aseg atlas'), (self.getImage('aparc_aseg', ['1024', 'mask']), 'area 1024 from aparc_aseg atlas'), (self.getImage("tt5", ["resample", "wm", "mask"]), 'resample white segmented mask'), (self.getImage("tt5", ["register", "5tt2gmwmi"]), 'grey matter, white matter interface')) if self.get("start_seeds").strip() != "": images.append( (self.getImage('aparc_aseg', ['resample', 'start', 'extract', 'mask']), 'high resolution, start, brain extracted mask')) images.append((self.getImage('aparc_aseg', ['resample', 'start', 'extract']), 'high resolution, start, brain extracted')) if self.get("stop_seeds").strip() != "": images.append( (self.getImage('aparc_aseg', ['resample', 'stop', 'extract', 'mask']), 'high resolution, stop, brain extracted mask')) images.append((self.getImage('aparc_aseg', ['resample', 'stop', 'extract']), 'high resolution, stop, brain extracted')) if self.get("exclude_seeds").strip() != "": images.append( (self.getImage('aparc_aseg', ['resample', 'exclude', 'extract', 'mask']), 'high resolution, excluded, brain extracted, mask')) images.append((self.getImage('aparc_aseg', ['resample', 'exclude', 'extract']), 'high resolution, excluded, brain extracted')) return images