Skip to content

Commit

Permalink
ongoing dvpt of mosaic on stackedimages h5 file
Browse files Browse the repository at this point in the history
  • Loading branch information
BM32ESRF committed Oct 6, 2024
1 parent c38ca56 commit 0cedd8d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions LaueTools/IOimagefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def readCCDimage(filename, CCDLabel="MARCCD165", dirname=None, stackimageindex=-
dataimage = alldata[stackimageindex]
framedim = dataimage.shape

elif CCDLabel in ("EIGER_4MCdTestack" ): #made by ESRF BLISS software
elif CCDLabel in ("EIGER_4MCdTestack"): #made by ESRF BLISS software
if dirname is not None:
pathfile=os.path.join(dirname, filename)
else:
Expand Down Expand Up @@ -1274,15 +1274,16 @@ def readoneimage_crop_fast(filename, dirname=None, CCDLabel="MARCCD165",

def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=None,
CCDLabel="MARCCD165",
verbose=0):
verbose=0,
stackimageindex=-1):
r"""
returns a 2d array of integers from a binary image file. Data are taken only from a rectangle
centered on pixx, pixy
:return: dataimage : 2D array, image data pixel intensity
"""
if CCDLabel == "EIGER_4MCdTestack":
raise NotImplementedError(f'Mosaic and roi counters is not yet implemented for {CCDLabel}')
raise NotImplementedError(f'Mosaic and roi counters is not yet implemented for {CCDLabel}. In progress')

(framedim, _, _, fliprot, offsetheader, formatdata, _, _) = DictLT.dict_CCD[CCDLabel]

Expand Down Expand Up @@ -1313,7 +1314,11 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
# uint16
offsetheader = filesize - (framedim[0] * framedim[1]) * nbBytesPerElement

if verbose > 0:
if CCDLabel in ('EIGER_4MCdTe'): # not useful ?
oneimagesize = (framedim[0] * framedim[1]) * nbBytesPerElement
offsetheader = filesize % oneimagesize

if 1: #verbose > 0:
print("calculated offset of header from file size...", offsetheader)

x = int(pixx)
Expand All @@ -1331,9 +1336,6 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
ypixmin = y - boxy
ypixmax = y + boxy

# ymin= (y-boxy)*framedim[1]
# ymax= (y+boxy)*framedim[1]

lineFirstElemIndex = ypixmin
lineLastElemIndex = ypixmax

Expand All @@ -1360,6 +1362,12 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non

#print('shape of band2D', band2D.shape)

elif CCDLabel in ('EIGER_4MCdTestack'):
print('stackimageindex', stackimageindex)
print('filename',filename)
_data, _dims, _ = readCCDimage(filename, CCDLabel=CCDLabel, dirname=dirname, stackimageindex=stackimageindex, verbose=0)
band2D = _data[ypixmin:ypixmax+1]

rectangle2D = band2D[:, xpixmin : xpixmax + 1]

if verbose > 0:
Expand Down

0 comments on commit 0cedd8d

Please sign in to comment.