This file is indexed.

/usr/share/pyshared/fabio/templateimage.py is in python-fabio 0.1.4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python
#coding: utf8
#This is a template for adding new file formats to FabIO

# We hope it will be relatively easy to add new file formats to fabio in the future. The basic idea is the following:
# 1) inherit from fabioimage overriding the methods _readheader, read and optionally write.
#    Name your new module XXXimage where XXX means something (eg tifimage).
#
# 2) readheader fills in a dictionary of "name":"value" pairs in self.header.
#    No one expects to find anything much in there.
#
# 3) read fills in self.data with a numpy array holding the image.
#    Some redundant info which also appears are self.dim1 and self.dim2: the image dimensions,
#    self.bpp is the bytes per pixel and self.bytecode is the numpy.dtype.type of the data.
#
# 4) The member variables "_need_a_seek_to_read" and "_need_a_real_file" are there in case you have
#    trouble with the transparent handling of bz2 and gz files.
#
# 5) Register the file type (extension naming) in fabioutils.FILETYPES
#
# 6) Add your new module as an import into fabio.openimage
#
# 7) Fill out the magic numbers for your format in fabio.openimage if you know them
#    (the characteristic first few bytes in the file)
#
# 8) Upload a testimage to the file release system and create a unittest testcase
#    which opens an example of your new format, confirming the image has actually
#    been read in successfully (eg check the mean, max, min and esd are all correct,
#    perhaps orientation too)
#
# 9) Run pylint on your code and then please go clean it up. Have a go at mine while you are at it.
#
#10) Bask in the warm glow of appreciation when someone unexpectedly learns they don't need to convert
#    their data into another format

"""
Template for FabIO

Authors: Who are you ?
email:  Where can you be reached ?

"""
# Get ready for python3:
from __future__ import with_statement, print_function, division

__authors__ = ["author"]
__contact__ = "name@institut.org"
__license__ = "GPLv3+"
__copyright__ = "Institut"
__version__ = "17 Oct 2012"

import logging
logger = logging.getLogger("templateimage")
import numpy
from .fabioimage import fabioimage



class templateimage(fabioimage):
    """
    FabIO image class for Images for XXX detector
    """
    def __init__(self, *arg, **kwargs):
        """
        Generic constructor
        """
        fabioimage.__init__(self, *arg, **kwargs)
        self.data = None
        self.header = {}
        self.dim1 = self.dim2 = 0
        self.m = self.maxval = self.stddev = self.minval = None
        self.header_keys = self.header.keys()
        self.bytecode = None

    def _readheader(self, infile):
        """
        Read and decode the header of an image:
        
        @param infile: Opened python file (can be stringIO or bipped file)  
        """
        #list of header key to keep the order (when writing)
        self.header = {}
        self.header_keys = []


    def read(self, fname, frame=None):
        """
        try to read image 
        @param fname: name of the file
        @param frame: 
        """

        self.resetvals()
        infile = self._open(fname)
        self._readheader(infile)

        #read the image data
        self.data = numpy.zeros((self.dim2, self.dim1), dtype=self.bytecode)
        return self