Last change
on this file since 2065 was
2065,
checked in by toby, 7 years ago
|
Allow reading of multiple images from single file
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | # -*- coding: utf-8 -*- |
---|
2 | ########### SVN repository information ################### |
---|
3 | # $Date: 2014-12-27 11:14:59 -0600 (Sat, 27 Dec 2014) $ |
---|
4 | # $Author: $ |
---|
5 | # $Revision: $ |
---|
6 | # $URL: $ |
---|
7 | # $Id: $ |
---|
8 | ########### SVN repository information ################### |
---|
9 | ''' |
---|
10 | *Module G2img_G2: Python pickled image* |
---|
11 | --------------------------------------- |
---|
12 | |
---|
13 | Routine to read an image that has been pickled in Python. Images |
---|
14 | in this format are created by the "Sum image data" command. |
---|
15 | |
---|
16 | ''' |
---|
17 | |
---|
18 | import sys |
---|
19 | import os |
---|
20 | import cPickle |
---|
21 | import GSASIIIO as G2IO |
---|
22 | import GSASIIpath |
---|
23 | GSASIIpath.SetVersionNumber("$Revision: $") |
---|
24 | class G2_ReaderClass(G2IO.ImportImage): |
---|
25 | def __init__(self): |
---|
26 | super(self.__class__,self).__init__( # fancy way to self-reference |
---|
27 | extensionlist=('.G2img',), |
---|
28 | strictExtension=True, |
---|
29 | formatName = 'Summed GSAS-II image', |
---|
30 | longFormatName = 'Pickled image from GSAS-II "Sum image data" command' |
---|
31 | ) |
---|
32 | |
---|
33 | def ContentsValidator(self, filepointer): |
---|
34 | '''no test at this time |
---|
35 | ''' |
---|
36 | return True |
---|
37 | |
---|
38 | def Reader(self,filename,filepointer, ParentFrame=None, **unused): |
---|
39 | '''Read using scipy PNG reader |
---|
40 | ''' |
---|
41 | import scipy.misc |
---|
42 | Fp = open(filename,'rb') |
---|
43 | self.Comments,self.Data,self.Npix,self.Image = cPickle.load(Fp) |
---|
44 | Fp.close() |
---|
45 | self.LoadImage(ParentFrame,filename) |
---|
46 | return True |
---|
Note: See
TracBrowser
for help on using the repository browser.