scifio / scifio-bf-compat

SCIFIO (@scifio/scifio) plug-in allowing use of Bio-Formats readers.
http://scif.io/
BSD 2-Clause "Simplified" License
3 stars 5 forks source link

ColorTable Cache #9

Closed hinerm closed 10 years ago

hinerm commented 10 years ago

Adds a weak cache for ColorTables to avoid re-creating them unnecessarily.

hinerm commented 10 years ago

@dietzc Thanks for pointing this out... do you mind testing this PR in the workflow where you observed unnecessary ColorTable creation?

dietzc commented 10 years ago

@hinerm thanks for the fix, but I don't understand why it is actually producing Z_Time_Channel number of LUTs (for each invididual plane/channel combination one LUT).

Isn't it enough to have only three LUTs (for each channel one) if we actually do auto-generate them?

hinerm commented 10 years ago

@dietzc I think it depends on the format. The idea was we made the framework to attach ColorTables to Planes. It's up to the Metadata to know if a particular dataset/format has 1 table per plane, 1 per channel, a single global table, etc...

dietzc commented 10 years ago

@hinerm Ok, I understand. So plane-wise colortables are default if you auto-create them. I understand. But is there a way to ask a ImgPlus if there exists a ColorTable for a certain plane / cube etc? Because currently we have to check two things: Does the number of color tables match any dimension (e.g. channel = 3) or any dimension combination (e.g. Z_Time_Channel). Of course here the assumption is that the planes are defined over X,Y. Do I miss something?

ctrueden commented 10 years ago

See also https://github.com/imagej/imagej-common/issues/31

hinerm commented 10 years ago

@dietzc - all the ImgPlus API supports is asking "what is the color table for plane X?"

Does the number of color tables match any dimension (e.g. channel = 3) or any dimension combination (e.g. Z_Time_Channel)

I'm sorry, it's not quite clear to me why you need to check this..? It sounds like you want to ask "how many unique color tables are there and how do they map to the planes?" right..? Why is it not sufficient to say "what is the color table for this plane?"

the planes are defined over X,Y. Do I miss something?

Technically planes are supposed to be defined as the first planar axis count number of axes. For all the formats we have right now I would expect this to be X,Y; plus Channel for RGB data.

dietzc commented 10 years ago

great. this explanation helped me a lot I think. thank you!

hinerm commented 10 years ago

Of course, @dietzc ... let me know if you have any other questions. We can discuss at the hackathon, too. :)