def _validate(self): errors = ProtAlignMovies._validate(self) # Although getFirstItem is not recommended in general, here it is # used only once, for validation purposes, so performance # problems not should be appear. if not self.inputMovies.get() is None: inputSet = self.inputMovies.get() movie = inputSet.getFirstItem() if (not movie.hasAlignment()) and self.useAlignment: errors.append( "Your movies have no alignment. Please, set *No* " "the parameter _Use previous movie alignment to SUM" " frames?_") if self.doApplyDoseFilter: doseFrame = inputSet.getAcquisition().getDosePerFrame() if doseFrame == 0.0 or doseFrame is None: errors.append( 'Dose per frame for input movies is 0 or not ' 'set. You cannot apply dose filter.') if self.numberOfThreads > 1 and self.useGpu: errors.append("GPU and Parallelization can not be used together") return errors
def _validate(self): errors = ProtAlignMovies._validate(self) # Although getFirstItem is not recommended in general, here it is # used only once, for validation purposes, so performance # problems not should be appear. if not self.inputMovies.get() is None: inputSet = self.inputMovies.get() movie = inputSet.getFirstItem() if (not movie.hasAlignment()) and self.useAlignment: errors.append("Your movies have no alignment. Please, set *No* " "the parameter _Use previous movie alignment to SUM" " frames?_") if self.doApplyDoseFilter: doseFrame = inputSet.getAcquisition().getDosePerFrame() if doseFrame == 0.0 or doseFrame is None: errors.append('Dose per frame for input movies is 0 or not ' 'set. You cannot apply dose filter.') if self.numberOfThreads > 1 and self.useGpu: errors.append("GPU and Parallelization can not be used together") return errors
def _validate(self): if self.autoControlPoints.get(): self._setControlPoints() # make sure we work with proper values errors = ProtAlignMovies._validate(self) getXmippHome = self.getClassPackage().Plugin.getHome if self.doLocalAlignment.get(): cudaBinaryFn = getXmippHome( 'bin', 'xmipp_cuda_movie_alignment_correlation') if not os.path.isfile(cudaBinaryFn): errors.append('GPU version not found, make sure that Xmipp is ' 'compiled with GPU\n' '( *CUDA=True* in _scipion.conf_ + ' '_run_: $ *scipion installb xmippSrc* ).') return errors elif not self.useGpu.get(): errors.append("GPU is needed to do local alignment.") return errors if self.numberOfMpi.get() * self.numberOfThreads.get() > 1: errors.append( "Multiple threads and/or mpi is incompatible with" " useGPU.") else: cpuBinaryFn = getXmippHome('bin', 'xmipp_movie_alignment_correlation') if not os.path.isfile(cpuBinaryFn): errors.append( 'CPU version not found for some reason, try to GPU=True.') return errors if (self.controlPointX < 3): errors.append("You have to use at least 3 control points in X dim") return errors # to avoid possible division by zero later if (self.controlPointY < 3): errors.append("You have to use at least 3 control points in Y dim") return errors # to avoid possible division by zero later if (self.controlPointT < 3): errors.append("You have to use at least 3 control points in T dim") return errors # to avoid possible division by zero later _, _, frames = self.inputMovies.get().getDim() tPointsRatio = frames / (int(self.controlPointT) - 2) yPointsRatio = int(self.patchY) / (int(self.controlPointY) - 2) xPointsRatio = int(self.patchX) / (int(self.controlPointX) - 2) if (tPointsRatio < 2): errors.append( "You need at least 2 measurements per control point, " "i.e. use movie with more frames or decrease number of control points in T dimension." ) if (yPointsRatio < 2): errors.append( "You need at least 2 measurements per control point, " "i.e. use more patches in Y dimesion or decrease number of control points." ) if (xPointsRatio < 2): errors.append( "You need at least 2 measurements per control point, " "i.e. use more patches in X dimesion or decrease number of control points." ) return errors
def _validate(self): errors = ProtAlignMovies._validate(self) # Although getFirstItem is not recommended in general, here it is # used only once, for validation purposes, so performance # problems not should be appear. if not self.inputMovies.get() is None: inputSet = self.inputMovies.get() movie = inputSet.getFirstItem() if (not movie.hasAlignment()) and self.useAlignment: errors.append("Your movies have no alignment. Please, set *No* " "the parameter _Use previous movie alignment to SUM" " frames?_") if self.doApplyDoseFilter: doseFrame = inputSet.getAcquisition().getDosePerFrame() if doseFrame == 0.0 or doseFrame is None: errors.append('Dose per frame for input movies is 0 or not ' 'set. You cannot apply dose filter.') if self.numberOfThreads > 1 and self.useGpu: errors.append("GPU and Parallelization can not be used together") ofCpu = Plugin.getHome("bin", "xmipp_movie_optical_alignment_cpu") ofGpu = Plugin.getHome("bin", "xmipp_movie_optical_alignment_gpu") if not (exists(ofGpu) or exists(ofCpu)): errors.append("It seems that Xmipp Optical Alignment is not installed. " "OpenCV should be installed in the system to compile it.\n" "Please, install OpenCV in your system and, then, " "re-install Xmipp by running 'scipion installb xmippSrc'.") else: if self.useGpu and not exists(ofGpu): errors.append("It seems that Xmipp Optical Alignment has not been " "compiled with CUDA.\nPlease, try with *GPU=No*.\n" "Error: '%s' not found." % ofGpu) if not self.useGpu and not exists(ofCpu): errors.append("It seems that Xmipp Optical Alignment has been " "compiled with CUDA.\nPlease, try with *GPU=Yes*.\n" "Error: '%s' not found." % ofCpu) return errors
def _validate(self): # Check base validation before the specific ones for Motioncorr errors = ProtAlignMovies._validate(self) program = MOTIONCOR2_PATH if self.useMotioncor2 else MOTIONCORR_PATH if not os.path.exists(program): errors.append('Missing %s' % program) # Check CUDA paths cudaLib = getCudaLib(useMC2=self.useMotioncor2) cudaConst = (MOTIONCOR2_CUDA_LIB if self.useMotioncor2 else MOTIONCORR_CUDA_LIB) if cudaLib is None: errors.append("Do not know where to find CUDA lib path. " " %s or %s variables have None value or are not" " present in scipion configuration." % (cudaConst, CUDA_LIB)) elif not pwutils.existsVariablePaths(cudaLib): errors.append("Either %s or %s variables points to a non existing " "path (%s). Please, check scipion configuration." % (cudaConst, CUDA_LIB, cudaLib)) gpu = self.GPUIDs.get() if not self.useMotioncor2: bin = self.binFactor.get() if not (bin == 1.0 or bin == 2.0): errors.append("Binning factor can only be 1 or 2") if len(gpu) > 1: errors.append("Old motioncorr2.1 does not support multiple " "GPUs, use motioncor2.") else: if not self.doSaveAveMic: errors.append( 'Option not supported. Please select Yes for ' 'Save aligned micrograph. ' 'Optionally you could add -Align 0 to additional ' 'parameters so that protocol ' 'produces simple movie sum.') if self.doSaveMovie and not self._isOutStackSupport: errors.append('Saving aligned movies is not supported by ' 'this version of motioncor2. ' 'By default, the protocol will produce ' 'outputMovies equivalent to the input ' 'however containing alignment information.') if not self.useAlignToSum: errors.append('Frame range for ALIGN and SUM must be ' 'equivalent in case of motioncor2. \n Please, ' 'set *YES* _Use ALIGN frames range to SUM?_ ' 'flag or use motioncorr') if self.doApplyDoseFilter and self.inputMovies.get(): inputMovies = self.inputMovies.get() doseFrame = inputMovies.getAcquisition().getDosePerFrame() if doseFrame == 0.0 or doseFrame is None: errors.append( 'Dose per frame for input movies is 0 or not ' 'set. You cannot apply dose filter.') return errors
def _validate(self): # Check base validation before the specific ones for Motioncorr errors = ProtAlignMovies._validate(self) program = MOTIONCOR2_PATH if self.useMotioncor2 else MOTIONCORR_PATH if not os.path.exists(program): errors.append('Missing %s' % program) # Check CUDA paths cudaLib = getCudaLib(useMC2=self.useMotioncor2) cudaConst = (MOTIONCOR2_CUDA_LIB if self.useMotioncor2 else MOTIONCORR_CUDA_LIB) if cudaLib is None: errors.append("Do not know where to find CUDA lib path. " " %s or %s variables have None value or are not" " present in scipion configuration." % (cudaConst, CUDA_LIB)) elif not pwutils.existsVariablePaths(cudaLib): errors.append("Either %s or %s variables points to a non existing " "path (%s). Please, check scipion configuration." % (cudaConst, CUDA_LIB, cudaLib)) gpu = self.gpuList.get() if not self.useMotioncor2: bin = self.binFactor.get() if not (bin == 1.0 or bin == 2.0): errors.append("Binning factor can only be 1 or 2") if len(gpu) > 1: errors.append("Old motioncorr2.1 does not support multiple " "GPUs, use motioncor2.") else: if not self.doSaveAveMic: errors.append('Option not supported. Please select Yes for ' 'Save aligned micrograph. ' 'Optionally you could add -Align 0 to additional ' 'parameters so that protocol ' 'produces simple movie sum.') if self.doSaveMovie and not self._isOutStackSupport: errors.append('Saving aligned movies is not supported by ' 'this version of motioncor2. ' 'By default, the protocol will produce ' 'outputMovies equivalent to the input ' 'however containing alignment information.') if not self.useAlignToSum: errors.append('Frame range for ALIGN and SUM must be ' 'equivalent in case of motioncor2. \n Please, ' 'set *YES* _Use ALIGN frames range to SUM?_ ' 'flag or use motioncorr') if self.doApplyDoseFilter and self.inputMovies.get(): inputMovies = self.inputMovies.get() doseFrame = inputMovies.getAcquisition().getDosePerFrame() if doseFrame == 0.0 or doseFrame is None: errors.append('Dose per frame for input movies is 0 or not ' 'set. You cannot apply dose filter.') return errors
def _validate(self): # Check base validation before the specific ones for Motioncorr errors = ProtAlignMovies._validate(self) return errors