Help to starting write example code based on ImageJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help to starting write example code based on ImageJ

Miguel-Angel Manso-Callejo (UPM)
Dear all,
I am interested on store a two dimensional array of float data in a tiff
file.

I have looking for libraries and i have found this.
I am exciting to start writing a simple code in java that using this
libraries store an image of float data pixels stored in a two
dimensional array of float. I suppose that this is "simple".

Can any one help me?
Best regards,

Miguel A.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Help to starting write example code based on ImageJ

Cammer, Michael
Make a new image of type 32 bit.

Use putPixel(x,y, value)  to populate the image with the floating point values.

SaveAs TIFF.

=========================================================================
 Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
                          Cell:  914-309-3270     Temporary location:  SK2-7
          http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Miguel-Angel Manso-Callejo (UPM)
Sent: Wednesday, April 22, 2015 11:12 AM
To: [hidden email]
Subject: Help to starting write example code based on ImageJ

Dear all,
I am interested on store a two dimensional array of float data in a tiff file.

I have looking for libraries and i have found this.
I am exciting to start writing a simple code in java that using this libraries store an image of float data pixels stored in a two dimensional array of float. I suppose that this is "simple".

Can any one help me?
Best regards,

Miguel A.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Help to starting write example code based on ImageJ

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Miguel-Angel Manso-Callejo (UPM)
On Apr 22, 2015, at 11:11 AM, Miguel-Angel Manso-Callejo (UPM) <[hidden email]> wrote:
>
> Dear all,
> I am interested on store a two dimensional array of float data in a tiff file.
>
> I have looking for libraries and i have found this.
> I am exciting to start writing a simple code in java that using this libraries store an image of float data pixels stored in a two dimensional array of float. I suppose that this is "simple”.

It is relatively simple. Here is an example that creates a 2D float array, creates an ImageProcessor from the array, creates an ImagePlus from the ImageProcessor, saves the ImagePlus in the user’s home directory as a TIFF file, opens the TIFF file and displays it.

-wayne

  int n = 256;
  float[][] array = new float[n][n];
  for (int y=0; y<n; y++)
     for (int x=0; x<n; x++)
        array[x][y] = x;
  ImageProcessor ip = new FloatProcessor(array);
  ImagePlus img = new ImagePlus("Float Array", ip);
  String dir = IJ.getDirectory("home");
  IJ.saveAs(img, "tif", dir+"test.tif");
  ImagePlus img2 = IJ.openImage(dir+"test.tif");
  img2.show();




--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html