Changeset 2015 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Oct 17, 2015 4:32:42 PM (6 years ago)
Author:
toby
Message:

redo image read to avoid reloads; prevent open of Edit image parms on reread; fix multilevel TIF read error; cleanup self in GSASIIimage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r2013 r2015  
    351351   
    352352def ReadImageData(G2frame,imagefile,imageOnly=False):
    353     '''Read a single image with an image importer. replacement for GetImageData
     353    '''Read a single image with an image importer. Replacement for GetImageData
    354354
    355355    :param wx.Frame G2frame: main GSAS-II Frame and data object.
     
    388388                continue
    389389        rdbuffer = {} # create temporary storage for file reader
     390        if imageOnly:
     391            ParentFrame = None # prevent GUI access on reread
     392        else:
     393            ParentFrame = G2frame
    390394        if GSASIIpath.GetConfigValue('debug'):
    391             flag = rd.Reader(imagefile,fp,G2frame)
     395            flag = rd.Reader(imagefile,fp,ParentFrame)
    392396        else:
    393397            flag = False
    394398            try:
    395                 flag = rd.Reader(imagefile,fp,G2frame)
     399                flag = rd.Reader(imagefile,fp,ParentFrame)
    396400            except rd.ImportException as detail:
    397401                rd.errors += "\n  Read exception: "+str(detail)
     
    418422def GetImageData(G2frame,imagefile,imageOnly=False):
    419423    '''Read an image with the file reader keyed by the
    420     file extension
     424    file extension.
     425
     426    This routine will be replaced by ReadImageData, which will be renamed to this.
    421427
    422428    :param wx.Frame G2frame: main GSAS-II Frame and data object.
     
    967973        lines = ['not a known detector tiff file',]
    968974        return lines,0,0,0
     975
     976    if sizexy[1]*sizexy[0] != image.size: # test is resize is allowed
     977        lines = ['not a known detector tiff file',]
     978        return lines,0,0,0
    969979       
    970980    image = np.reshape(image,(sizexy[1],sizexy[0]))
     
    20622072        self.Image = None
    20632073
     2074    def LoadImage(self,ParentFrame,imagefile):
     2075        '''Optionally, call this after reading in an image to load it into the tree.
     2076        This does saves time by preventing a reread of the same information.
     2077        '''
     2078        if ParentFrame:
     2079            ParentFrame.ImageZ = self.Image   # store the image for plotting
     2080            ParentFrame.oldImagefile = imagefile # save the name of the last image file read
     2081           
     2082
    20642083######################################################################
    20652084class ExportBaseclass(object):
Note: See TracChangeset for help on using the changeset viewer.