Skip to content

Commit

Permalink
enabled mosaic and roi counters for several images with EIGER_4MCdTes…
Browse files Browse the repository at this point in the history
…tack
  • Loading branch information
BM32ESRF committed Oct 7, 2024
1 parent 3567dc7 commit 4f379bc
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions LaueTools/IOimagefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,8 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
: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}. In progress')
# if CCDLabel == "EIGER_4MCdTestack":
# 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 @@ -1318,7 +1318,7 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
oneimagesize = (framedim[0] * framedim[1]) * nbBytesPerElement
offsetheader = filesize % oneimagesize

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

x = int(pixx)
Expand All @@ -1343,20 +1343,9 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
print("lineFirstElemIndex", lineFirstElemIndex)
print("lineLastElemIndex", lineLastElemIndex)

if CCDLabel not in ('EIGER_4MCdTe'):
band = readoneimage_band(fullpathfilename,
framedim=framedim,
dirname=None,
offset=offsetheader,
line_startindex=lineFirstElemIndex,
line_finalindex=lineLastElemIndex,
formatdata=formatdata)

nblines = lineLastElemIndex - lineFirstElemIndex + 1

band2D = np.reshape(band, (nblines, framedim[1]))


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

Expand All @@ -1368,6 +1357,19 @@ def readrectangle_in_image(filename, pixx, pixy, halfboxx, halfboxy, dirname=Non
_data, _dims, _ = readCCDimage(filename, CCDLabel=CCDLabel, dirname=dirname, stackimageindex=stackimageindex, verbose=0)
band2D = _data[ypixmin:ypixmax+1]

elif CCDLabel not in ('EIGER_4MCdTe', 'EIGER_4MCdTestack'):
band = readoneimage_band(fullpathfilename,
framedim=framedim,
dirname=None,
offset=offsetheader,
line_startindex=lineFirstElemIndex,
line_finalindex=lineLastElemIndex,
formatdata=formatdata)

nblines = lineLastElemIndex - lineFirstElemIndex + 1

band2D = np.reshape(band, (nblines, framedim[1]))

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

if verbose > 0:
Expand Down

0 comments on commit 4f379bc

Please sign in to comment.