Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
0
    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
Beispiel #4
0
    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
Beispiel #5
0
    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
Beispiel #6
0
    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
Beispiel #7
0
    def qaSupplier(self):
        """Create and supply images for the report generated by qa task

        """
        # Get images
        dwi = self.getDenoisingImage('dwi', 'denoise')
        if not dwi:
            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 images
        dwiCorrectedQa = self.plot4dVolume(dwiCorrected, fov=brainMask)
        dwiCompareQa = self.compare4dVolumes(dwi, dwiCorrected, fov=brainMask)
        translationsQa, rotationsQa = self.plotMovement(
            eddyParameterFiles, dwiCorrected)
        bVecsQa = self.plotVectors(bVecs, bVecsCorrected, dwiCorrected)

        qaImages = Images(
            (dwiCorrectedQa, 'DWI corrected'),
            (dwiCompareQa, 'Before and after corrections'),
            (translationsQa, 'Translation corrections by Eddy'),
            (rotationsQa, 'Rotation corrections by Eddy'),
            (bVecsQa,
             "Gradients vectors on the unitary sphere. " \
             "Red: raw bvec | Blue: opposite bvec | " \
             "Black +: movement corrected bvec. The more corrected, " \
             "the more the + is from the center of the circle."))

        # Information on distorsion correction
        information = "Eddy movement corrections were applied to the images "
        correctionMethod = self.get('method')
        if correctionMethod == 'topup':
            information += "and distortion corrections were conducted on the " \
                           "AP and PA images."
        elif correctionMethod == 'fieldmap':
            information += "using the fieldmap images."
        else:
            information += "with no distortion correction"

        qaImages.setInformation(information)

        return qaImages
Beispiel #8
0
    def qaSupplier(self):
        """Create and supply images for the report generated by qa task

        """
        # Get images
        dwi = self.getDenoisingImage('dwi', 'denoise')
        if not dwi:
            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 images
        dwiCorrectedQa = self.plot4dVolume(dwiCorrected, fov=brainMask)
        dwiCompareQa = self.compare4dVolumes(dwi, dwiCorrected, fov=brainMask)
        translationsQa, rotationsQa = self.plotMovement(
            eddyParameterFiles, dwiCorrected)
        bVecsQa = self.plotVectors(bVecs, bVecsCorrected, dwiCorrected)

        qaImages = Images(
            (dwiCorrectedQa, 'DWI corrected'),
            (dwiCompareQa, 'Before and after corrections'),
            (translationsQa, 'Translation corrections by Eddy'),
            (rotationsQa, 'Rotation corrections by Eddy'),
            (bVecsQa,
             "Gradients vectors on the unitary sphere. " \
             "Red: raw bvec | Blue: opposite bvec | " \
             "Black +: movement corrected bvec. The more corrected, " \
             "the more the + is from the center of the circle."))

        # Information on distorsion correction
        information = "Eddy movement corrections were applied to the images "
        correctionMethod = self.get('method')
        if correctionMethod == 'topup':
            information += "and distortion corrections were conducted on the " \
                           "AP and PA images."
        elif correctionMethod == 'fieldmap':
            information += "using the fieldmap images."
        else:
            information += "with no distortion correction"

        qaImages.setInformation(information)

        return qaImages
Beispiel #9
0
    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
Beispiel #10
0
    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
Beispiel #11
0
    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
Beispiel #12
0
    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
Beispiel #13
0
    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
Beispiel #14
0
    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
Beispiel #15
0
    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
Beispiel #16
0
    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