Dear all,
I would like to generate a synthetic image from an excel file in which I have x, y and intensity... I went trough Google search and couldn't find a straightforward answer so far -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Fabrice,
if you can arrange the data in the form of an intensity array, i.e. without explicit x and y values, then you can import the data to ImageJ as a text image. Regards Herbie :::::::::::::::::::::::::::::::::::::::::::: Am 11.07.20 um 15:02 schrieb Fabrice Senger: > Dear all, > I would like to generate a synthetic image from an excel file in which I > have x, y and intensity... I went trough Google search and couldn't find a > straightforward answer so far > > -- > 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 fabrice senger-2
If you save the file as text (any delimiter), you can open the file in ImageJ and write a macro to get the text into a string, split the string into an array, convert the text to numbers, and use putPixel() to draw them into an image.
Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 [hidden email]<mailto:[hidden email]> http://nyulmc.org/micros http://microscopynotes.com/ Voice direct only, no text or messages: 1-914-309-3270 and 1-646-501-0567 ________________________________ From: Fabrice Senger <[hidden email]> Sent: Saturday, July 11, 2020 9:02:16 AM To: [hidden email] Subject: Create synthetic image [EXTERNAL] Dear all, I would like to generate a synthetic image from an excel file in which I have x, y and intensity... I went trough Google search and couldn't find a straightforward answer so far -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by fabrice senger-2
First, you probably need to convert the .xlsx file to .csv. This will make
it easier for the next step. Excel will do this for you. Second, you will need to write (or find someone to write for you) a very simple program. I would use Java, but perhaps it can be done as a macro. This would be easy for anyone with basic Java-plugin skills, but is at the boundary of “general purpose” and “custom code”. I estimate < half a day to deliver a tested and documented solution. Most of the time would be spent nailing down details (are x,y,value integers or reals? What are the ranges of each? Etc.) If you can’t find anyone local to write this, contact me off list. One of the main reasons I like ImageJ is the ease of extending it for custom situations like this. ImageJ users who do not have easy access to a Java programmer are missing out on much of the power of ImageJ. On Sat, Jul 11, 2020 at 08:03 Fabrice Senger <[hidden email]> wrote: > Dear all, > I would like to generate a synthetic image from an excel file in which I > have x, y and intensity... I went trough Google search and couldn't find a > straightforward answer so far > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- -Kenneth Sloan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Cammer, Michael-3
Hi Michael,
putPixel() is the java method which has the corresponding macro method setPixel(x, y, value): https://imagej.nih.gov/ij/developer/macro/functions.html#setPixel Also your described method will indeed work, I would similarly save the file as text but with the extension ".tsv". In this case by opening it within ImageJ, it will right away be in the form of a table from which it is possible to work right away the picture out (i.e. without creating the arrays). Have a nice week-end, 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: "Cammer, Michael" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Samedi 11 Juillet 2020 16:13:06 Objet: Re: Create synthetic image If you save the file as text (any delimiter), you can open the file in ImageJ and write a macro to get the text into a string, split the string into an array, convert the text to numbers, and use putPixel() to draw them into an image. Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 [hidden email]<mailto:[hidden email]> http://nyulmc.org/micros http://microscopynotes.com/ Voice direct only, no text or messages: 1-914-309-3270 and 1-646-501-0567 ________________________________ From: Fabrice Senger <[hidden email]> Sent: Saturday, July 11, 2020 9:02:16 AM To: [hidden email] Subject: Create synthetic image [EXTERNAL] Dear all, I would like to generate a synthetic image from an excel file in which I have x, y and intensity... I went trough Google search and couldn't find a straightforward answer so far -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I know it's not ImageJ, but this is really easy to do in MATLAB using the
image save command. Just copy and paste the Excel data into a new variable and then save it as an image. This functionality might be available in Octave as well. Best regards, Silas On Sat, Jul 11, 2020, 9:31 AM CARL Philippe (LBP) <[hidden email]> wrote: > Hi Michael, > putPixel() is the java method which has the corresponding macro method > setPixel(x, y, value): > https://imagej.nih.gov/ij/developer/macro/functions.html#setPixel > Also your described method will indeed work, I would similarly save the > file as text but with the extension ".tsv". > In this case by opening it within ImageJ, it will right away be in the > form of a table from which it is possible to work right away the picture > out (i.e. without creating the arrays). > Have a nice week-end, > 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: "Cammer, Michael" <[hidden email]> > À: "imagej" <[hidden email]> > Envoyé: Samedi 11 Juillet 2020 16:13:06 > Objet: Re: Create synthetic image > > If you save the file as text (any delimiter), you can open the file in > ImageJ and write a macro to get the text into a string, split the string > into an array, convert the text to numbers, and use putPixel() to draw them > into an image. > > > Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory > > NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY > 10016 > > [hidden email]<mailto:[hidden email]> > http://nyulmc.org/micros http://microscopynotes.com/ > > Voice direct only, no text or messages: 1-914-309-3270 and 1-646-501-0567 > > > > ________________________________ > From: Fabrice Senger <[hidden email]> > Sent: Saturday, July 11, 2020 9:02:16 AM > To: [hidden email] > Subject: Create synthetic image > > [EXTERNAL] > > Dear all, > I would like to generate a synthetic image from an excel file in which I > have x, y and intensity... I went trough Google search and couldn't find a > straightforward answer so far > > -- > ImageJ mailing list: > https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= > > -- > 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 Silas Leavesley
Thanks for the hint I was thinking about Matlab to do this BUT Matlab isn't
open source Le sam. 11 juil. 2020 à 18:46, Silas Leavesley <[hidden email]> a écrit : > I know it's not ImageJ, but this is really easy to do in MATLAB using the > image save command. Just copy and paste the Excel data into a new variable > and then save it as an image. This functionality might be available in > Octave as well. > > Best regards, > > Silas > > On Sat, Jul 11, 2020, 9:31 AM CARL Philippe (LBP) < > [hidden email]> > wrote: > > > Hi Michael, > > putPixel() is the java method which has the corresponding macro method > > setPixel(x, y, value): > > https://imagej.nih.gov/ij/developer/macro/functions.html#setPixel > > Also your described method will indeed work, I would similarly save the > > file as text but with the extension ".tsv". > > In this case by opening it within ImageJ, it will right away be in the > > form of a table from which it is possible to work right away the picture > > out (i.e. without creating the arrays). > > Have a nice week-end, > > 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: "Cammer, Michael" <[hidden email]> > > À: "imagej" <[hidden email]> > > Envoyé: Samedi 11 Juillet 2020 16:13:06 > > Objet: Re: Create synthetic image > > > > If you save the file as text (any delimiter), you can open the file in > > ImageJ and write a macro to get the text into a string, split the string > > into an array, convert the text to numbers, and use putPixel() to draw > them > > into an image. > > > > > > Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory > > > > NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY > > 10016 > > > > [hidden email]<mailto:[hidden email]> > > http://nyulmc.org/micros http://microscopynotes.com/ > > > > Voice direct only, no text or messages: 1-914-309-3270 and > 1-646-501-0567 > > > > > > > > ________________________________ > > From: Fabrice Senger <[hidden email]> > > Sent: Saturday, July 11, 2020 9:02:16 AM > > To: [hidden email] > > Subject: Create synthetic image > > > > [EXTERNAL] > > > > Dear all, > > I would like to generate a synthetic image from an excel file in which I > > have x, y and intensity... I went trough Google search and couldn't find > a > > straightforward answer so far > > > > -- > > ImageJ mailing list: > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= > > > > -- > > 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 Robert Smith
Dear Bob,
You are completely right as well, but let's "give back to Caesar what belongs to Caesar", Herbie already pointed out this solution at first place @ 15:42... Kindest regards, Philippe ----- Mail original ----- De: "Robert Smith" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Samedi 11 Juillet 2020 19:17:31 Objet: Re: Create synthetic image Please excuse me for butting in, but you can also save the Excell file as a TXT or CSV and then load it into Fiji/ImageJ as a text image. Bob Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: CARL Philippe (LBP)<mailto:[hidden email]> Sent: Saturday, July 11, 2020 10:31 AM To: [hidden email]<mailto:[hidden email]> Subject: Re: Create synthetic image Hi Michael, putPixel() is the java method which has the corresponding macro method setPixel(x, y, value): https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html%23setPixel&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725730012&sdata=3k4HEkc4IME0tDmjVgeUIFE79aIE2vRSxnkqk%2BY3Jtw%3D&reserved=0 Also your described method will indeed work, I would similarly save the file as text but with the extension ".tsv". In this case by opening it within ImageJ, it will right away be in the form of a table from which it is possible to work right away the picture out (i.e. without creating the arrays). Have a nice week-end, 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: "Cammer, Michael" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Samedi 11 Juillet 2020 16:13:06 Objet: Re: Create synthetic image If you save the file as text (any delimiter), you can open the file in ImageJ and write a macro to get the text into a string, split the string into an array, convert the text to numbers, and use putPixel() to draw them into an image. Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 [hidden email]<mailto:[hidden email]> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fnyulmc.org%2Fmicros&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725740006&sdata=vVNCde06R6ZcZaSDjXN35QG6vb%2BZjjunETjq9buFUFg%3D&reserved=0 https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmicroscopynotes.com%2F&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725740006&sdata=mboW7kc9NqkFmLz49qsGbUHpVouKKr%2BaXbZiEQHjv0w%3D&reserved=0 Voice direct only, no text or messages: 1-914-309-3270 and 1-646-501-0567 ________________________________ From: Fabrice Senger <[hidden email]> Sent: Saturday, July 11, 2020 9:02:16 AM To: [hidden email] Subject: Create synthetic image [EXTERNAL] Dear all, I would like to generate a synthetic image from an excel file in which I have x, y and intensity... I went trough Google search and couldn't find a straightforward answer so far -- ImageJ mailing list: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__imagej.nih.gov_ij_list.html%26d%3DDwIBaQ%26c%3Dj5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs%26r%3DE0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU%26m%3DcFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA%26s%3D1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU%26e%3D&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725740006&sdata=yszYDn15jPAS7pApdvmH9C1a3mE3FLEddj3JTYU4pPQ%3D&reserved=0 -- ImageJ mailing list: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725740006&sdata=HRZdmcv1FUwMZnPPTaMXW0wpTDVMYb0OHS6X5%2B1VZy4%3D&reserved=0 -- ImageJ mailing list: https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7C%7C380d1b0737b14a7c53c308d825a70ed9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637300746725740006&sdata=HRZdmcv1FUwMZnPPTaMXW0wpTDVMYb0OHS6X5%2B1VZy4%3D&reserved=0 -- 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 fabrice senger-2
R is free and can likely also do this.
-- politics is more difficult than physics. A. Einstein David Gene Morgan Electron Microscopy Center 047E Simon Hall IU Bloomington 812 856 1457 (office) 812 856 3221 (3200) http://iubemcenter.indiana.edu ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Fabrice Senger [[hidden email]] Sent: Saturday, July 11, 2020 1:24 PM To: [hidden email] Subject: [External] Re: Create synthetic image This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources. ------- Thanks for the hint I was thinking about Matlab to do this BUT Matlab isn't open source Le sam. 11 juil. 2020 à 18:46, Silas Leavesley <[hidden email]> a écrit : > I know it's not ImageJ, but this is really easy to do in MATLAB using the > image save command. Just copy and paste the Excel data into a new variable > and then save it as an image. This functionality might be available in > Octave as well. > > Best regards, > > Silas > > On Sat, Jul 11, 2020, 9:31 AM CARL Philippe (LBP) < > [hidden email]> > wrote: > > > Hi Michael, > > putPixel() is the java method which has the corresponding macro method > > setPixel(x, y, value): > > https://imagej.nih.gov/ij/developer/macro/functions.html#setPixel > > Also your described method will indeed work, I would similarly save the > > file as text but with the extension ".tsv". > > In this case by opening it within ImageJ, it will right away be in the > > form of a table from which it is possible to work right away the picture > > out (i.e. without creating the arrays). > > Have a nice week-end, > > 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: "Cammer, Michael" <[hidden email]> > > À: "imagej" <[hidden email]> > > Envoyé: Samedi 11 Juillet 2020 16:13:06 > > Objet: Re: Create synthetic image > > > > If you save the file as text (any delimiter), you can open the file in > > ImageJ and write a macro to get the text into a string, split the string > > into an array, convert the text to numbers, and use putPixel() to draw > them > > into an image. > > > > > > Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory > > > > NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY > > 10016 > > > > [hidden email]<mailto:[hidden email]> > > http://nyulmc.org/micros http://microscopynotes.com/ > > > > Voice direct only, no text or messages: 1-914-309-3270 and > 1-646-501-0567 > > > > > > > > ________________________________ > > From: Fabrice Senger <[hidden email]> > > Sent: Saturday, July 11, 2020 9:02:16 AM > > To: [hidden email] > > Subject: Create synthetic image > > > > [EXTERNAL] > > > > Dear all, > > I would like to generate a synthetic image from an excel file in which I > > have x, y and intensity... I went trough Google search and couldn't find > a > > straightforward answer so far > > > > -- > > ImageJ mailing list: > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= > > > > -- > > 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 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by fabrice senger-2
> On Jul 11, 2020, at 9:02 AM, Fabrice Senger <[hidden email]> wrote:
> > Dear all, > I would like to generate a synthetic image from an excel file in which I > have x, y and intensity... I went trough Google search and couldn't find a > straightforward answer so far You can create a relatively simple macro that opens the excel file as a table and converts it into an image. The following example macro opens the blobs sample images, uses Analyze>Tools>Save XY Coordinates to save it as an xyz table, opens the table and converts it into a 32-bit image. -wayne run("Blobs (25K)"); run("Select All"); path = getDir("downloads")+"xyz-table.csv"; run("Save XY Coordinates...", "save=&path"); close; open(path); x = Table.getColumn("X"); y = Table.getColumn("Y"); z = Table.getColumn("Value"); Array.getStatistics(x, ymin, xmax); Array.getStatistics(y, ymin, ymax); newImage("Untitled", "32-bit black", xmax+1, ymax+1, 1); for (i=0; i<x.length; i++) setPixel(x[i], y[i], z[i]); resetMinAndMax; -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by David Gene Morgan
It's trivial to import a csv into R and relatively easy to export it in a
form readable by IJ. R is free and works with Windows. Can you describe the intensity values and location data? I might be willing to provide an R script - gratis. On Sat, Jul 11, 2020 at 1:15 PM Morgan, David Gene <[hidden email]> wrote: > R is free and can likely also do this. > > -- > politics is more difficult than physics. > A. Einstein > > David Gene Morgan > Electron Microscopy Center > 047E Simon Hall > IU Bloomington > 812 856 1457 (office) > 812 856 3221 (3200) > http://iubemcenter.indiana.edu > > ________________________________________ > From: ImageJ Interest Group [[hidden email]] on behalf of Fabrice > Senger [[hidden email]] > Sent: Saturday, July 11, 2020 1:24 PM > To: [hidden email] > Subject: [External] Re: Create synthetic image > > This message was sent from a non-IU address. Please exercise caution when > clicking links or opening attachments from external sources. > ------- > > Thanks for the hint I was thinking about Matlab to do this BUT Matlab isn't > open source > > Le sam. 11 juil. 2020 à 18:46, Silas Leavesley <[hidden email] > > > a écrit : > > > I know it's not ImageJ, but this is really easy to do in MATLAB using the > > image save command. Just copy and paste the Excel data into a new > variable > > and then save it as an image. This functionality might be available in > > Octave as well. > > > > Best regards, > > > > Silas > > > > On Sat, Jul 11, 2020, 9:31 AM CARL Philippe (LBP) < > > [hidden email]> > > wrote: > > > > > Hi Michael, > > > putPixel() is the java method which has the corresponding macro method > > > setPixel(x, y, value): > > > https://imagej.nih.gov/ij/developer/macro/functions.html#setPixel > > > Also your described method will indeed work, I would similarly save the > > > file as text but with the extension ".tsv". > > > In this case by opening it within ImageJ, it will right away be in the > > > form of a table from which it is possible to work right away the > picture > > > out (i.e. without creating the arrays). > > > Have a nice week-end, > > > 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: "Cammer, Michael" <[hidden email]> > > > À: "imagej" <[hidden email]> > > > Envoyé: Samedi 11 Juillet 2020 16:13:06 > > > Objet: Re: Create synthetic image > > > > > > If you save the file as text (any delimiter), you can open the file in > > > ImageJ and write a macro to get the text into a string, split the > string > > > into an array, convert the text to numbers, and use putPixel() to draw > > them > > > into an image. > > > > > > > > > Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory > > > > > > NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, > NY > > > 10016 > > > > > > [hidden email]<mailto:[hidden email]> > > > http://nyulmc.org/micros http://microscopynotes.com/ > > > > > > Voice direct only, no text or messages: 1-914-309-3270 and > > 1-646-501-0567 > > > > > > > > > > > > ________________________________ > > > From: Fabrice Senger <[hidden email]> > > > Sent: Saturday, July 11, 2020 9:02:16 AM > > > To: [hidden email] > > > Subject: Create synthetic image > > > > > > [EXTERNAL] > > > > > > Dear all, > > > I would like to generate a synthetic image from an excel file in which > I > > > have x, y and intensity... I went trough Google search and couldn't > find > > a > > > straightforward answer so far > > > > > > -- > > > ImageJ mailing list: > > > > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwIBaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=cFpHcvoFXmA7aOdaFBxw5fQzChwHCuiQf1BKxF2zVmA&s=1xGdGPhS77tkE0drf8mXnnD-iOIAdr2OG6VF09qLTbU&e= > > > > > > -- > > > 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 > > -- > 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 Wayne Rasband-2
Dear Wayne,
Thanks a lot for your interesting macro which brings me up two questions. First I was convinced (up to now at least) that in order to be opened as a table, a file needs to have the extension ".tsv". But in your example the file can be opened as such by having the extension ".csv" and this whether it's separator is a coma or tabulation. So is this rule about the ".tsv" wrong or did it evolve lately ? Also the "save=&path" on the line 4 of your macro obviously replaces "save="+path. But can this & only be used following an = sign or in some other cases? Because within the following macro: str = "test"; print("show the &str"); the & is interpreted as an element of the string and not as introducing a parameter. My best regards, Philippe ----- Mail original ----- De: "Wayne Rasband" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Dimanche 12 Juillet 2020 00:21:35 Objet: Re: Create synthetic image > On Jul 11, 2020, at 9:02 AM, Fabrice Senger <[hidden email]> wrote: > > Dear all, > I would like to generate a synthetic image from an excel file in which I > have x, y and intensity... I went trough Google search and couldn't find a > straightforward answer so far You can create a relatively simple macro that opens the excel file as a table and converts it into an image. The following example macro opens the blobs sample images, uses Analyze>Tools>Save XY Coordinates to save it as an xyz table, opens the table and converts it into a 32-bit image. -wayne run("Blobs (25K)"); run("Select All"); path = getDir("downloads")+"xyz-table.csv"; run("Save XY Coordinates...", "save=&path"); close; open(path); x = Table.getColumn("X"); y = Table.getColumn("Y"); z = Table.getColumn("Value"); Array.getStatistics(x, ymin, xmax); Array.getStatistics(y, ymin, ymax); newImage("Untitled", "32-bit black", xmax+1, ymax+1, 1); for (i=0; i<x.length; i++) setPixel(x[i], y[i], z[i]); resetMinAndMax; -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Philippe,
concerning: > Also the "save=&path" on the line 4 of your macro obviously replaces "save="+path. > But can this & only be used following an = sign or in some other cases? > Because within the following macro: > str = "test"; > print("show the &str"); > the & is interpreted as an element of the string and not as introducing a parameter. In my experience, the &variableName notation is restricted to cases where the macro fills in values into what would be a dialog in interactive mode, and the macro argument String has 'key=value' pairs. The 'print' command has no interactive equivalent with a dialog, and there are no 'key=value' pairs. Concerning: > First I was convinced (up to now at least) that in order to be opened as a table, a file needs to have the extension ".tsv". > But in your example the file can be opened as such by having the extension ".csv" and this whether it's separator is a coma or tabulation. I am not sure that I understood your question correctly, but both csv (comma-separated values) and tsv (tab-separated values) can be read into a Results Table. In both cases, 'Open' opens them as Results Table. ImageJ takes the extension to determine which separator to use. In the current case, it seems that the file extension in "Save XY Coordinates..." determines which separator to use. With Save XY Coordinates...", this 'auto detection' of the separator unfortunately only works in the dialog-less version where the image has a selection (If there is no selection and one gets the dialog, for some reason it always uses tabs). --- By the way, for me it is a bit confusing to find "Save XY coordinates" saving the pixel values is in Analyze>Tools, while "File>Save As>XY Coordinates" writes the selection coordinates, not the pixel values. Michael ________________________________________________________________ On 12.07.20 01:42, CARL Philippe (LBP) wrote: > Dear Wayne, > Thanks a lot for your interesting macro which brings me up two questions. > First I was convinced (up to now at least) that in order to be opened as a table, a file needs to have the extension ".tsv". > But in your example the file can be opened as such by having the extension ".csv" and this whether it's separator is a coma or tabulation. > So is this rule about the ".tsv" wrong or did it evolve lately ? > Also the "save=&path" on the line 4 of your macro obviously replaces "save="+path. > But can this & only be used following an = sign or in some other cases? > Because within the following macro: > str = "test"; > print("show the &str"); > the & is interpreted as an element of the string and not as introducing a parameter. > My best regards, > Philippe > > ----- Mail original ----- > De: "Wayne Rasband" <[hidden email]> > À: "imagej" <[hidden email]> > Envoyé: Dimanche 12 Juillet 2020 00:21:35 > Objet: Re: Create synthetic image > >> On Jul 11, 2020, at 9:02 AM, Fabrice Senger <[hidden email]> wrote: >> >> Dear all, >> I would like to generate a synthetic image from an excel file in which I >> have x, y and intensity... I went trough Google search and couldn't find a >> straightforward answer so far > > You can create a relatively simple macro that opens the excel file as a table and converts it into an image. The following example macro opens the blobs sample images, uses Analyze>Tools>Save XY Coordinates to save it as an xyz table, opens the table and converts it into a 32-bit image. > > -wayne > > run("Blobs (25K)"); > run("Select All"); > path = getDir("downloads")+"xyz-table.csv"; > run("Save XY Coordinates...", "save=&path"); > close; > open(path); > x = Table.getColumn("X"); > y = Table.getColumn("Y"); > z = Table.getColumn("Value"); > Array.getStatistics(x, ymin, xmax); > Array.getStatistics(y, ymin, ymax); > newImage("Untitled", "32-bit black", xmax+1, ymax+1, 1); > for (i=0; i<x.length; i++) > setPixel(x[i], y[i], z[i]); > resetMinAndMax; > > -- > 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 |
Hi all,
On 13.07.20 11:55, Michael Schmid wrote: > In my experience, the &variableName notation is restricted to cases > where the macro fills in values into what would be a dialog in > interactive mode, and the macro argument String has 'key=value' pairs. We don't have to base our knowledge on mere experience here, the usage of & in option strings is also officially documented: https://imagej.net/ij/developer/macro/macros.html#run > With ImageJ 1.43 and later, there is an easier method that only requires adding "&" to the variable name in the options string: > > noise = 50; > output = "Point Selection"; > run("Find Maxima...", "noise=&noise output=&output light"); > > String variables passed using this method do not have to be enclosed in brackets. For more examples, see the ArgumentPassingDemo macro. Best, Jan -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Wayne Rasband-2
Dear all,
when I save my excel file as txt and next modify the extension to tsv (as suggested by Philippe, merci) the file opens in imageJ as a result table, using the code provided by Wayne (thank you) allows me to create an image from this table. That's just great, Thank you all for this very nice thread, Fabrice. Le dim. 12 juil. 2020 à 00:24, Wayne Rasband <[hidden email]> a écrit : > > On Jul 11, 2020, at 9:02 AM, Fabrice Senger <[hidden email]> > wrote: > > > > Dear all, > > I would like to generate a synthetic image from an excel file in which I > > have x, y and intensity... I went trough Google search and couldn't find > a > > straightforward answer so far > > You can create a relatively simple macro that opens the excel file as a > table and converts it into an image. The following example macro opens the > blobs sample images, uses Analyze>Tools>Save XY Coordinates to save it as > an xyz table, opens the table and converts it into a 32-bit image. > > -wayne > > run("Blobs (25K)"); > run("Select All"); > path = getDir("downloads")+"xyz-table.csv"; > run("Save XY Coordinates...", "save=&path"); > close; > open(path); > x = Table.getColumn("X"); > y = Table.getColumn("Y"); > z = Table.getColumn("Value"); > Array.getStatistics(x, ymin, xmax); > Array.getStatistics(y, ymin, ymax); > newImage("Untitled", "32-bit black", xmax+1, ymax+1, 1); > for (i=0; i<x.length; i++) > setPixel(x[i], y[i], z[i]); > resetMinAndMax; > > -- > 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 |