Hi,
I wonder if there is a way to retrieve what is the name of (the last?) LUT applied to an image. I appreciate that LUTs can be changed on the fly without loading one from a file and therefore might not be a robust way of knowing what is being displayed. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Gabriel,
Some more expert people may probably deny what I will be writing below. But from my point of view, a LUT is just some kind of "sunglasses" that you can wear in order to look at your data (i.e. your picture) ; these data staying the same whatever sunglasses you try on. Thus I don't really see a reason why the name of last used LUT on a given picture should be saved. My best regards, Philippe Philippe CARL Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 42 89 ----- Mail original ----- De: "Gabriel Landini" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Mardi 23 Juin 2020 13:00:09 Objet: Current lut? Hi, I wonder if there is a way to retrieve what is the name of (the last?) LUT applied to an image. I appreciate that LUTs can be changed on the fly without loading one from a file and therefore might not be a robust way of knowing what is being displayed. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Philippe,
As you say the LUT simply changes how an image appears on the screen when it is reopened, But the LUT is saved with the image, so its name is useful - if I want to display another image using the same LUT. Or if the image came from another computer, possibly with a different list of LUTs, what its name was and therefore which name to use if I add the LUT to my computer. Gabriel is not making an unreasonable request, and the name adds only a tiny amount of data to the image file. At worst adding the name is harmless. Jeremy Adler =============================================== B i o V i s P l a t f o r m of Uppsala University Light & EM microscopy / FlowCytometry & Cell Sorting / Image Analysis =============================================== Jeremy Adler PhD - Senior research engineer Light, Confocal Microscopy, Image Analysis E-mail: [hidden email] 070-1679349 Dag Hammarskjölds v 20 751 85 UPPSALA, SWEDEN http://biovis.uu.se/ =============================================== -----Original Message----- From: ImageJ Interest Group <[hidden email]> On Behalf Of CARL Philippe (LBP) Sent: Tuesday, June 23, 2020 1:16 PM To: [hidden email] Subject: Re: Current lut? Dear Gabriel, Some more expert people may probably deny what I will be writing below. But from my point of view, a LUT is just some kind of "sunglasses" that you can wear in order to look at your data (i.e. your picture) ; these data staying the same whatever sunglasses you try on. Thus I don't really see a reason why the name of last used LUT on a given picture should be saved. My best regards, Philippe Philippe CARL Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 42 89 ----- Mail original ----- De: "Gabriel Landini" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Mardi 23 Juin 2020 13:00:09 Objet: Current lut? Hi, I wonder if there is a way to retrieve what is the name of (the last?) LUT applied to an image. I appreciate that LUTs can be changed on the fly without loading one from a file and therefore might not be a robust way of knowing what is being displayed. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by CARL Philippe (LBP)
Hi,
Sure, sunglasses... I hope there is nothing wrong if I want to know what sunglasses I am wearing? :-) specially if they change the appearance of the data I am looking at. What prompted me to ask this is I programmed a LUT button that cycles thought the many LUTs collected over the years. If I find one I like and dif not keep track of the name at the time of loading I do not know which one it is. It might be useful in other instances: is it a linear greyscale or stretched logarithmic greyscale LUT? They might look pretty close but to find out I have to through Show LUT, compare it to another LUT, etc. Also note that the "inverted LUT" is shown at the top of the frame but not other LUTs. That alone would be useful, but to clarify, I am not requesting this to be added. I am only asking if there is a way to know which one has been applied last to a given image. If there is no way of doing this, storing the LUT name might be one solution (thanks Jeremy), and might bring other issues: load a LUT and then programmatically (or via the LUT editor) change it. Would that require resetting the stored name? That issue happens with the current inverted LUT display, if you edit, the window still says (inverting LUT) although it might not be so anymore). Cheers Gabriel On Tuesday, 23 June 2020 12:15:47 BST [hidden email] wrote: > Dear Gabriel, > Some more expert people may probably deny what I will be writing below. > But from my point of view, a LUT is just some kind of "sunglasses" that you > can wear in order to look at your data (i.e. your picture) ; these data > staying the same whatever sunglasses you try on. Thus I don't really see a > reason why the name of last used LUT on a given picture should be saved. My > best regards, > Philippe > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Gabriel,
the most convenient way to achieve what you want is the display of the LUT-name as a subtitle-label, as with the inverted LUT. I think you can easily write either some simple macro- or plugin-code to achieve this. Another, less obvious way would be to set a checkmark in the LUT-menu indicating the currently applied LUT. This appears more involved however. Presently, the image info doesn't show the applied LUT (but of course it could or you could use the new properties feature to show it). Furthermore, the LUT-name is presently not included as tif-tag. Kind regards Herbie ::::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 14:04 schrieb Gabriel Landini: > Hi, > Sure, sunglasses... I hope there is nothing wrong if I want to know what > sunglasses I am wearing? :-) specially if they change the appearance of the > data I am looking at. > > What prompted me to ask this is I programmed a LUT button that cycles thought > the many LUTs collected over the years. If I find one I like and dif not keep > track of the name at the time of loading I do not know which one it is. > > It might be useful in other instances: is it a linear greyscale or stretched > logarithmic greyscale LUT? They might look pretty close but to find out I have > to through Show LUT, compare it to another LUT, etc. > > Also note that the "inverted LUT" is shown at the top of the frame but not > other LUTs. That alone would be useful, but to clarify, I am not requesting > this to be added. I am only asking if there is a way to know which one has > been applied last to a given image. > > If there is no way of doing this, storing the LUT name might be one solution > (thanks Jeremy), and might bring other issues: load a LUT and then > programmatically (or via the LUT editor) change it. Would that require > resetting the stored name? > That issue happens with the current inverted LUT display, if you edit, the > window still says (inverting LUT) although it might not be so anymore). > > Cheers > > Gabriel > > On Tuesday, 23 June 2020 12:15:47 BST [hidden email] wrote: >> Dear Gabriel, >> Some more expert people may probably deny what I will be writing below. >> But from my point of view, a LUT is just some kind of "sunglasses" that you >> can wear in order to look at your data (i.e. your picture) ; these data >> staying the same whatever sunglasses you try on. Thus I don't really see a >> reason why the name of last used LUT on a given picture should be saved. My >> best regards, >> Philippe >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Herbie and Gabriel,
If I would like to save the used LUT data, I would rather store them within the picture meta data (maybe using the new info features Wayne implemented some weeks ago) than within the subtitle-label . But as I understand the request of Gabriel (but since my last exchanges with Fred, who is drastically differentiating two sentences which are fully identical for me, I may probably have understanding issues in English) he would like to have these informations saved within the meta data as default. Take care, Philippe ----- Mail original ----- De: "l16" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Mardi 23 Juin 2020 14:33:40 Objet: Re: Current lut? Dear Gabriel, the most convenient way to achieve what you want is the display of the LUT-name as a subtitle-label, as with the inverted LUT. I think you can easily write either some simple macro- or plugin-code to achieve this. Another, less obvious way would be to set a checkmark in the LUT-menu indicating the currently applied LUT. This appears more involved however. Presently, the image info doesn't show the applied LUT (but of course it could or you could use the new properties feature to show it). Furthermore, the LUT-name is presently not included as tif-tag. Kind regards Herbie ::::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 14:04 schrieb Gabriel Landini: > Hi, > Sure, sunglasses... I hope there is nothing wrong if I want to know what > sunglasses I am wearing? :-) specially if they change the appearance of the > data I am looking at. > > What prompted me to ask this is I programmed a LUT button that cycles thought > the many LUTs collected over the years. If I find one I like and dif not keep > track of the name at the time of loading I do not know which one it is. > > It might be useful in other instances: is it a linear greyscale or stretched > logarithmic greyscale LUT? They might look pretty close but to find out I have > to through Show LUT, compare it to another LUT, etc. > > Also note that the "inverted LUT" is shown at the top of the frame but not > other LUTs. That alone would be useful, but to clarify, I am not requesting > this to be added. I am only asking if there is a way to know which one has > been applied last to a given image. > > If there is no way of doing this, storing the LUT name might be one solution > (thanks Jeremy), and might bring other issues: load a LUT and then > programmatically (or via the LUT editor) change it. Would that require > resetting the stored name? > That issue happens with the current inverted LUT display, if you edit, the > window still says (inverting LUT) although it might not be so anymore). > > Cheers > > Gabriel > > On Tuesday, 23 June 2020 12:15:47 BST [hidden email] wrote: >> Dear Gabriel, >> Some more expert people may probably deny what I will be writing below. >> But from my point of view, a LUT is just some kind of "sunglasses" that you >> can wear in order to look at your data (i.e. your picture) ; these data >> staying the same whatever sunglasses you try on. Thus I don't really see a >> reason why the name of last used LUT on a given picture should be saved. My >> best regards, >> Philippe >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Herbie
On Tuesday, 23 June 2020 13:33:40 BST [hidden email] wrote:
> the most convenient way to achieve what you want is the display of the > LUT-name as a subtitle-label, as with the inverted LUT. I think you can > easily write either some simple macro- or plugin-code to achieve this. Hi Herbie, Yes that would work, if the LUT is stored in the TIFF header, it could store the name as well but the problem of how that name gets updated remains. So I am guessing that the answer to my question is "no" (we cannot retrieve the name). There is always brute: generate a dictionary of the LUTs in the LUT folder and try to match the current image LUT with an entry in the dictionary. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by CARL Philippe (LBP)
Dear Philippe,
there is not much difference with showing the LUT-name as a subtitle-label and with storing it as a property and with storing it in the tif-header. In fact all three are essentially the same... 1. In general, if you store some (text)data, or more generally *meta-data*, with the image, you need to write it to the (tif)image-header. 2. If you set a LUT, it is mentioned in the image info (currently not the name) and of course the data is in the image and in the image-header. 3. If you write to the subtitle, it is stored in the image-header: " *setMetadata("Label", string)* Sets string as the label of the current image or stack slice. The first 60 characters, or up to the first newline, of the label are displayed as part of the image subtitle. The labels are saved as part of the TIFF header. " 4. If you write a property, I'm sure it is also stored in the image-header. Where else (see 1.)? Meta-data is meta-data -- no? The difference consists in how and where it is displayed. Kind regards Herbie ::::::::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 15:05 schrieb CARL Philippe (LBP): > Dear Herbie and Gabriel, > If I would like to save the used LUT data, I would rather store them within the picture meta data (maybe using the new info features Wayne implemented some weeks ago) than within the subtitle-label . > But as I understand the request of Gabriel (but since my last exchanges with Fred, who is drastically differentiating two sentences which are fully identical for me, I may probably have understanding issues in English) he would like to have these informations saved within the meta data as default. > Take care, > Philippe > > ----- Mail original ----- > De: "l16" <[hidden email]> > À: "imagej" <[hidden email]> > Envoyé: Mardi 23 Juin 2020 14:33:40 > Objet: Re: Current lut? > > Dear Gabriel, > > the most convenient way to achieve what you want is the display of the > LUT-name as a subtitle-label, as with the inverted LUT. I think you can > easily write either some simple macro- or plugin-code to achieve this. > > Another, less obvious way would be to set a checkmark in the LUT-menu > indicating the currently applied LUT. This appears more involved however. > > Presently, the image info doesn't show the applied LUT (but of course it > could or you could use the new properties feature to show it). > Furthermore, the LUT-name is presently not included as tif-tag. > > Kind regards > > Herbie > > ::::::::::::::::::::::::::::::::::::::::::::: > Am 23.06.20 um 14:04 schrieb Gabriel Landini: >> Hi, >> Sure, sunglasses... I hope there is nothing wrong if I want to know what >> sunglasses I am wearing? :-) specially if they change the appearance of the >> data I am looking at. >> >> What prompted me to ask this is I programmed a LUT button that cycles thought >> the many LUTs collected over the years. If I find one I like and dif not keep >> track of the name at the time of loading I do not know which one it is. >> >> It might be useful in other instances: is it a linear greyscale or stretched >> logarithmic greyscale LUT? They might look pretty close but to find out I have >> to through Show LUT, compare it to another LUT, etc. >> >> Also note that the "inverted LUT" is shown at the top of the frame but not >> other LUTs. That alone would be useful, but to clarify, I am not requesting >> this to be added. I am only asking if there is a way to know which one has >> been applied last to a given image. >> >> If there is no way of doing this, storing the LUT name might be one solution >> (thanks Jeremy), and might bring other issues: load a LUT and then >> programmatically (or via the LUT editor) change it. Would that require >> resetting the stored name? >> That issue happens with the current inverted LUT display, if you edit, the >> window still says (inverting LUT) although it might not be so anymore). >> >> Cheers >> >> Gabriel >> >> On Tuesday, 23 June 2020 12:15:47 BST [hidden email] wrote: >>> Dear Gabriel, >>> Some more expert people may probably deny what I will be writing below. >>> But from my point of view, a LUT is just some kind of "sunglasses" that you >>> can wear in order to look at your data (i.e. your picture) ; these data >>> staying the same whatever sunglasses you try on. Thus I don't really see a >>> reason why the name of last used LUT on a given picture should be saved. My >>> best regards, >>> Philippe >>> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
Dear Gabriel,
I'm not perfectly sure where you see a problem. "if the LUT is stored in the TIFF header" Do you mean the values or the LUT-name? If you write the LUT-name to the subtitle (so that is immediately visible) it is of course stored in the TIFF header when you save the image. The values are 8bit-color and there is a TIFF-tag that tells this fact. BITS_PER_SAMPLE = 8 PHOTOMETRIC_INTERPRETATION = 3 I guess this information is also used for the image info. "Bits per pixel: 8 (color LUT)" "the problem of how that name gets updated remains." If you have the LUT-name in the subtitle and save the image, the name is saved as well. If you replace the LUT-name in the subtitle and again save the image, it will be stored. If you don't save the image you can recall the current LUT-name form the subtitle. In short, I don't understand the problem. "So I am guessing that the answer to my question is "no" (we cannot retrieve the name)." Without some code, e.g. using *setMetadata("Label", string)*, it appears that currently it is impossible to retrieve the name. At least I didn't find it in the TIFF-header. "There is always brute: generate a dictionary of the LUTs in the LUT folder and try to match the current image LUT with an entry in the dictionary." I'd prefer to store the LUT-name with the image in which way ever. Kind regards Herbie ::::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 15:36 schrieb Gabriel Landini: > On Tuesday, 23 June 2020 13:33:40 BST [hidden email] wrote: >> the most convenient way to achieve what you want is the display of the >> LUT-name as a subtitle-label, as with the inverted LUT. I think you can >> easily write either some simple macro- or plugin-code to achieve this. > > Hi Herbie, > Yes that would work, if the LUT is stored in the TIFF header, it > could store the name as well but the problem of how that name gets updated > remains. > > So I am guessing that the answer to my question is "no" (we cannot retrieve > the name). > > There is always brute: generate a dictionary of the LUTs in the LUT folder and > try to match the current image LUT with an entry in the dictionary. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Herbie,
> I'm not perfectly sure where you see a problem. I do not see any :-) I meant (probably expressed it wrong): If the LUT is stored in the image then one could store the LUT name too. I did not want to suggest the values (as they are already stored in a palette somewhere in the TIFF file). > "the problem of how that name gets updated remains." > In short, I don't understand the problem. The problem is this: You apply a LUT (which has a name, let's say Fire) then when imagine changing the LUT programmatically, not by loading a new LUT file but by editing some (or all) palette entries. What results from the editing is not the Fire LUT anymore, so unless one catches that the LUT has been edited, one risks storing the Fire name in the header when saving that image. That seems to be current situation with the Inverted LUT. If you edit it via LUT Edit, the image frame still says that there is an Inverting LUT active, but the original entries have been changed and so there is no guarantee that the LUT looks like the one in the name, i.e. "inverting LUT". Perhaps there should be a flag that records whether the LUT values have been altered/edited. If so, the LUT name is not really a valid name and should be changed or added a "*" at the end or something similar to indicate that fact. Hope it clarifies it. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Gabriel!
"Hope it clarifies it." It does, and it explains that the problem is not with the LUT-name per se, but with the fact that an edited LUT doesn't immediately get a new name! This sounds to possibly become an interesting suggestion. As you write: A LUT that has been modified but not yet save under a new name should receive an indicator similar to files that have been modified but not yet saved... If this may perhaps be realized by Wayne, storing the current LUT-name could accompany this endeavour... Thanks Herbie ::::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 16:31 schrieb Gabriel Landini: > Hi Herbie, > >> I'm not perfectly sure where you see a problem. > > I do not see any :-) I meant (probably expressed it wrong): If the LUT is > stored in the image then one could store the LUT name too. I did not want to > suggest the values (as they are already stored in a palette somewhere in the > TIFF file). > >> "the problem of how that name gets updated remains." >> In short, I don't understand the problem. > > The problem is this: You apply a LUT (which has a name, let's say Fire) then > when imagine changing the LUT programmatically, not by loading a new LUT file > but by editing some (or all) palette entries. > What results from the editing is not the Fire LUT anymore, so unless one > catches that the LUT has been edited, one risks storing the Fire name in the > header when saving that image. > > That seems to be current situation with the Inverted LUT. If you edit it via > LUT Edit, the image frame still says that there is an Inverting LUT active, > but the original entries have been changed and so there is no guarantee that > the LUT looks like the one in the name, i.e. "inverting LUT". > > Perhaps there should be a flag that records whether the LUT values have been > altered/edited. If so, the LUT name is not really a valid name and should be > changed or added a "*" at the end or something similar to indicate that fact. > > Hope it clarifies it. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
> On Jun 23, 2020, at 7:00 AM, Gabriel Landini <[hidden email]> wrote:
> > Hi, > I wonder if there is a way to retrieve what is the name of (the last?) LUT > applied to an image. > I appreciate that LUTs can be changed on the fly without loading one from a > file and therefore might not be a robust way of knowing what is being > displayed. Starting with the ImageJ 1.53c60 daily build, the LUT name is saved as an image property and displayed when you type “i” (Image>Show Info). The LUT name can be retrieved in a macro using Property.get("CurrentLUT”) and in a plugin or script using imp.getProp("CurrentLUT”). The name will have “(edited)” appended to it if the LUT has been edited by the Image>Color>Edit LUT tool. -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Wayne,
that's great news and a more than fast reaction! Thanks and kind regards Herbie ::::::::::::::::::::::::::::::::::::::::::: Am 23.06.20 um 18:32 schrieb Wayne Rasband: >> On Jun 23, 2020, at 7:00 AM, Gabriel Landini <[hidden email]> wrote: >> >> Hi, >> I wonder if there is a way to retrieve what is the name of (the last?) LUT >> applied to an image. >> I appreciate that LUTs can be changed on the fly without loading one from a >> file and therefore might not be a robust way of knowing what is being >> displayed. > > Starting with the ImageJ 1.53c60 daily build, the LUT name is saved as an image property and displayed when you type “i” (Image>Show Info). The LUT name can be retrieved in a macro using Property.get("CurrentLUT”) and in a plugin or script using imp.getProp("CurrentLUT”). The name will have “(edited)” appended to it if the LUT has been edited by the Image>Color>Edit LUT tool. > > -wayne > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Here's a alternative solution with the linked menu tool that provides two
commands : - Store LUT in Prefs - Restore LUT from Prefs https://gist.github.com/mutterer/51021eb24d117bb9d4f43e5f020b6bb8 Jerome. On Tue, 23 Jun 2020 at 18:42, Herbie <[hidden email]> wrote: > Dear Wayne, > > that's great news and a more than fast reaction! > > Thanks and kind regards > > Herbie > > ::::::::::::::::::::::::::::::::::::::::::: > Am 23.06.20 um 18:32 schrieb Wayne Rasband: > >> On Jun 23, 2020, at 7:00 AM, Gabriel Landini <[hidden email]> > wrote: > >> > >> Hi, > >> I wonder if there is a way to retrieve what is the name of (the last?) > LUT > >> applied to an image. > >> I appreciate that LUTs can be changed on the fly without loading one > from a > >> file and therefore might not be a robust way of knowing what is being > >> displayed. > > > > Starting with the ImageJ 1.53c60 daily build, the LUT name is saved as > an image property and displayed when you type “i” (Image>Show Info). The > LUT name can be retrieved in a macro using Property.get("CurrentLUT”) and > in a plugin or script using imp.getProp("CurrentLUT”). The name will have > “(edited)” appended to it if the LUT has been edited by the > Image>Color>Edit LUT tool. > > > > -wayne > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |