How to use the fabio.edfimage.edfimage function in fabio

To help you get started, we’ve selected a few fabio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github silx-kit / fabio / test / testedfimage.py View on Github external
def setUp(self):
        self.multiFrameFilename = UtilsTest.getimage("MultiFrame.edf.bz2")[:-4]
        self.Frame0Filename = UtilsTest.getimage("MultiFrame-Frame0.edf.bz2")[:-4]
        self.Frame1Filename = UtilsTest.getimage("MultiFrame-Frame1.edf.bz2")[:-4]
        self.ref = edfimage()
        self.frame0 = edfimage()
        self.frame1 = edfimage()
        try:
            self.ref.read(self.multiFrameFilename)
        except:
            raise RuntimeError("Cannot read image multiFrameFilename image %s" % self.multiFrameFilename)
        try:
            self.frame0.read(self.Frame0Filename)
        except:
            raise RuntimeError("Cannot read image Frame0File image %s" % self.Frame0File)
        try:
            self.frame1.read(self.Frame1Filename)
        except:
            raise RuntimeError("Cannot read image Frame1File image %s" % self.Frame1File)
github silx-kit / fabio / test / testedfimage.py View on Github external
def setUp(self):
        self.multiFrameFilename = UtilsTest.getimage("MultiFrame.edf.bz2")[:-4]
        self.Frame0Filename = UtilsTest.getimage("MultiFrame-Frame0.edf.bz2")[:-4]
        self.Frame1Filename = UtilsTest.getimage("MultiFrame-Frame1.edf.bz2")[:-4]
        self.ref = edfimage()
        self.frame0 = edfimage()
        self.frame1 = edfimage()
        try:
            self.ref.read(self.multiFrameFilename)
        except:
            raise RuntimeError("Cannot read image multiFrameFilename image %s" % self.multiFrameFilename)
        try:
            self.frame0.read(self.Frame0Filename)
        except:
            raise RuntimeError("Cannot read image Frame0File image %s" % self.Frame0File)
        try:
            self.frame1.read(self.Frame1Filename)
        except:
            raise RuntimeError("Cannot read image Frame1File image %s" % self.Frame1File)
github silx-kit / fabio / test / testedfimage.py View on Github external
def setUp(self):
        self.multiFrameFilename = UtilsTest.getimage("MultiFrame.edf.bz2")[:-4]
        self.Frame0Filename = UtilsTest.getimage("MultiFrame-Frame0.edf.bz2")[:-4]
        self.Frame1Filename = UtilsTest.getimage("MultiFrame-Frame1.edf.bz2")[:-4]
        self.ref = edfimage()
        self.frame0 = edfimage()
        self.frame1 = edfimage()
        try:
            self.ref.read(self.multiFrameFilename)
        except:
            raise RuntimeError("Cannot read image multiFrameFilename image %s" % self.multiFrameFilename)
        try:
            self.frame0.read(self.Frame0Filename)
        except:
            raise RuntimeError("Cannot read image Frame0File image %s" % self.Frame0File)
        try:
            self.frame1.read(self.Frame1Filename)
        except:
            raise RuntimeError("Cannot read image Frame1File image %s" % self.Frame1File)
github silx-kit / pyFAI / pyFAI / app / eiger_mask.py View on Github external
logger.error("Python h5py module is expected to use this script")
        sys.exit(1)

    infile = os.path.abspath(options.input_file)
    if options.output_file is not None:
        outfile = options.output_file
    else:
        outfile = os.path.splitext(infile)[0] + "_mask.edf"

    mask = extract_mask(infile)
    if outfile.endswith("msk"):
        fabio.fit2dmaskimage.fit2dmaskimage(data=mask).write(outfile)
    elif outfile.endswith("tif"):
        fabio.tifimage.tifimage(data=mask).write(outfile)
    else:
        fabio.edfimage.edfimage(header={"data_file": infile}, data=mask).write(outfile)
github edna-site / edna / execPlugins / plugins / EDPluginGroupSPD-v1.0 / plugins / spline.py View on Github external
def writeEDF(self, basename):
        """save the distortion matrices into a couple of files called basename-x.edf and  basename-y.edf
        
        """
        try:
            from fabio.edfimage import edfimage
            #from EdfFile import EdfFile as EDF
        except ImportError:
            print "You will need the Fabio library available from the Fable sourceforge"
            return
        self.spline2array()

        edfDispX = edfimage(data=self.xDispArray.astype("float32"), header={})
        edfDispY = edfimage(data=self.yDispArray.astype("float32"), header={})
        edfDispX.write(basename + "-x.edf", force_type="float32")
        edfDispY.write(basename + "-y.edf", force_type="float32")
github silx-kit / pyFAI / pyFAI / massif.py View on Github external
def getBluredData(self):
        """
        :return: a blurred image
        """

        if self._blured_data is None:
            with self._sem:
                if self._blured_data is None:
                    logger.debug("Blurring image with kernel size: %s", self.valley_size)
                    self._blured_data = gaussian_filter(self.getBinnedData(), [self.valley_size / i for i in self.binning], mode="reflect")
                    if logger.getEffectiveLevel() == logging.DEBUG:
                        fabio.edfimage.edfimage(data=self._blured_data).write("blured_data.edf")
        return self._blured_data
github ronpandolfi / Xi-cam / xicam / plugins / viewer.py View on Github external
def exportimage(self):
        fabimg = edfimage.edfimage(np.rot90(self.getCurrentTab().imageitem.image))
        dialog = QtGui.QFileDialog(parent=None, caption=u"Export image as EDF",
                                   directory=unicode(os.path.dirname(self.getCurrentTab().paths[0])),
                                   filter=u"EDF (*.edf)")
        dialog.selectFile(unicode(os.path.dirname(self.getCurrentTab().paths[0])))
        filename, ok = dialog.getSaveFileName()
        if ok and filename:
            fabimg.write(filename)
github ronpandolfi / Xi-cam / pipeline / arc_finder.py View on Github external
def findgisaxsarcs2(img, experiment):
    img = img.T.copy()
    cake, _, _ = integration.cake(img, experiment, mask=experiment.mask)  # TODO: refactor these parameters and check .T
    maskcake, _, _ = integration.cake(experiment.mask.T, experiment)

    from fabio import edfimage

    fabimg = edfimage.edfimage(cake)
    filename = 'cake.edf'
    fabimg.write(filename)

    fabimg = edfimage.edfimage(maskcake)
    filename = 'cake_MASK.edf'
    fabimg.write(filename)

    img = inpaint(cake, maskcake)

    fabimg = edfimage.edfimage(img)
    filename = 'cake_LINEAR_INFILL.edf'
    fabimg.write(filename)

    maxchis, maxqs = findmaxs(img)

    out =[]

    for chi, q in zip(maxchis, maxqs):
        # roi=np.ones_like(img)
        #roi[chi - 10:chi + 10, q - 5:q + 5]=10