Commit cddf4ff6 authored by kulvait's avatar kulvait

DEN.py formating

parent 20a4f235
......@@ -22,15 +22,14 @@ def timeToSeconds(naivetime):
totalsec = sec + 60 * mins + 60 * 60 * hod
return(totalsec)
# Get frame from DEN file
# i is the frame index
# Can get a subframe, where row_from is the first row index
# row_to is not included
# col_from is the first col index
# col_to is not included
def getFrame(fileName, i, row_from=None, row_to=None, col_from=None, col_to=None):
# i is the slice index
header = np.fromfile(fileName, np.dtype('<i2'), 3)
rows = np.uint32(header[0])
columns = np.uint32(header[1])
......@@ -103,6 +102,9 @@ def writeFrame(fileName, k, data, force=False):
def writeEmptyDEN(fileName, dimx, dimy, dimz, force=False):
if not force and os.path.exists(fileName):
raise IOError('File %s already exists, no header written' % fileName)
dimx = np.uint(dimx)
dimy = np.uint(dimy)
dimz = np.uint(dimz)
outfile = open(fileName, "w")
header = np.array([dimy, dimx, dimz])
header = np.array(header, dtype='<i2')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment