コード例 #1
0
ファイル: protocol_batch.py プロジェクト: denisfortun/scipion
 def createMaskStep(self):
     inputObj = self.inputObj.get()
     maskFile=self.maskFile.get()
     samplingRate = None
     if(hasattr(inputObj, "getSamplingRate")):
         samplingRate = inputObj.getSamplingRate()
     else:
         for key, attr in inputObj.iterInputAttributes():
             print key
             if hasattr(attr.get(), "getSamplingRate"):
                 samplingRate = attr.get().getSamplingRate()
     if  not samplingRate:
         raise Exception("sampling rate required")
     
     mask = Mask()
     mask.setFileName(maskFile)
     mask.setSamplingRate(samplingRate)
     self._defineOutputs(outputMask=mask)
     self._defineSourceRelation(self.inputObj, self.outputMask)
コード例 #2
0
ファイル: protocol_batch.py プロジェクト: azazellochg/scipion
 def createMaskStep(self):
     inputObj = self.inputObj.get()
     maskSrc=self.maskFile.get()
     basename = os.path.basename(maskSrc)
     maskDst = self._getPath(basename)
     moveFile(maskSrc, maskDst)
     samplingRate = None
     if(hasattr(inputObj, "getSamplingRate")):
         samplingRate = inputObj.getSamplingRate()
     else:
         for key, attr in inputObj.iterInputAttributes():
             if hasattr(attr.get(), "getSamplingRate"):
                 samplingRate = attr.get().getSamplingRate()
     if  not samplingRate:
         raise Exception("sampling rate required")
     
     mask = Mask()
     mask.setFileName(maskDst)
     mask.setSamplingRate(samplingRate)
     self._defineOutputs(outputMask=mask)
     self._defineSourceRelation(self.inputObj, self.outputMask)
コード例 #3
0
    def importMaskStep(self, path, samplingRate):
        """ Copy mask from maskPath.
        """
        self.info("Using mask path: '%s'" % path)

        # Copy the image file into the project
        dst = self._getExtraPath(basename(path))
        pwutils.copyFile(path, dst)

        # Retrive image dimensions
        imgh = ImageHandler()
        _, _, z, n = imgh.getDimensions(dst)

        # Create a 2D or 3D Mask, consider the case of n>1
        # as the case of some volume maps in mrc format
        if z > 1 or n > 1:
            mask = VolumeMask()
        else:
            mask = Mask()

        mask.setFileName(dst)
        mask.setSamplingRate(samplingRate)

        self._defineOutputs(outputMask=mask)
コード例 #4
0
    def createMaskStep(self):
        inputObj = self.inputObj.get()
        maskSrc = self.maskFile.get()
        basename = os.path.basename(maskSrc)
        maskDst = self._getPath(basename)
        moveFile(maskSrc, maskDst)
        samplingRate = None
        if (hasattr(inputObj, "getSamplingRate")):
            samplingRate = inputObj.getSamplingRate()
        else:
            for key, attr in inputObj.iterInputAttributes():
                if hasattr(attr.get(), "getSamplingRate"):
                    samplingRate = attr.get().getSamplingRate()
        if not samplingRate:
            raise Exception("sampling rate required")

        mask = Mask()
        mask.setFileName(maskDst)
        mask.setSamplingRate(samplingRate)
        self._defineOutputs(outputMask=mask)
        self._defineSourceRelation(self.inputObj, self.outputMask)