CIL icon indicating copy to clipboard operation
CIL copied to clipboard

Readers to accept Binner

Open epapoutsellis opened this issue 4 years ago • 6 comments

It would be nice when we are using Readers to set up a Binner directly, e.g.,

reader = TXRMDataReader()
angle_unit = AcquisitionGeometry.RADIAN

reader.set_up(file_name=filename, angle_unit=angle_unit,
                        roi={'angle':(None, None, 4),
                                'horizontal':(None,None,4), 
                                'vertical':(None,None,4)})
data = reader.read()

epapoutsellis avatar Apr 28 '21 12:04 epapoutsellis

We have developed something along these lines in the CILViewer with the cilBaseResampleReader and subclasses. These are different from the normal Readers that would return you the whole dataset. The push there is not to load the whole dataset in memory for visualisation but create a smaller version that would "trick" the user and allow them to navigate in arbitrary large datasets. A resample reader would want to know how much memory you want to use in Mb, then it'll come with a resampling that would be adequate.

I understand what you want to achieve but my feeling is that we should develop a new type of reader to do this job. At this stage using Binner after the reader does the trick, and the code wouldn't look terribly longer or difficult. I think it should look like this.


reader = TXRMDataReader()
reader.set_up(file_name=filename, angle_unit=AcquisitionGeometry.RADIAN)

rebin = Binner(roi={'angle':(None, None, 4), 'horizontal':(None,None,4), 
    'vertical':(None,None,4)})
rebin.set_input(reader.read())

data = rebin.get_output()

paskino avatar Apr 29 '21 06:04 paskino

A bit unrelated but is it really necessary to specify angle_unit? Can't that be handled by the reader to spare the user from worrying about it?

On Wed, 28 Apr 2021, 14:16 Vaggelis Papoutsellis, @.***> wrote:

It would be nice when we are using Readers to set up a Binner directly, e.g.,

reader = TXRMDataReader()angle_unit = AcquisitionGeometry.RADIAN reader.set_up(file_name=filename, angle_unit=angle_unit, roi={'angle':(None, None, 4), 'horizontal':(None,None,4), 'vertical':(None,None,4)})data = reader.read()

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vais-ral/CCPi-Framework/issues/842, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMDSCE2TYOGFHHOSGSIX7TTK74BNANCNFSM43W6VN2Q .

jakobsj avatar Apr 29 '21 06:04 jakobsj

The TiffReader has this, and the NikonReader (which uses the TiffReader) exposes this too.

https://github.com/vais-ral/CCPi-Framework/blob/6975a047492d3794edf75d7419ff4e5839bea4d4/Wrappers/Python/cil/io/TIFF.py#L146-L149

gfardell avatar Apr 29 '21 08:04 gfardell

@jakobsj we have a default for angle unit. The angle unit is not written in the Zeiss file. So, even if it's not needed it's nice to specify it.

paskino avatar May 25 '21 21:05 paskino

see #926

gfardell avatar Sep 20 '21 11:09 gfardell

With the restructure and speed up of binner in #1385 we can now update the TIFF and Nikon readers to create a binned geometry and use it.

gfardell avatar Jan 24 '23 12:01 gfardell