Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

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

Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

Nihar Dhruva
Hi all,

I want to do one thing..

My aim is to display an image using ImageJ tool. But I don't want to display
the file using Open File Dialog Box. Instead, I want to pass the height,
width and pixel array through my code, and it should display the image on my
applet.

Is it possible? How can I do that?

Kindly reply as early as possible, as it's very urgent for me.

waiting for your reply,

thanks,

Nihar Dhruva (Jr. Software Engineer)
Decision Craft Analytics Pvt ltd.
Phone:-+91-79-26870656/57/58 Ext: 145
Email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

dscho
Hi,

On Tue, 14 Feb 2006, Nihar Dhruva wrote:

> My aim is to display an image using ImageJ tool. But I don't want to display
> the file using Open File Dialog Box. Instead, I want to pass the height,
> width and pixel array through my code, and it should display the image on my
> applet.

Why don't you just use the "url1" parameter? You can open up to 9 images
by setting the "url1", ..., "url9" parameters to the applet.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

Nihar Dhruva
Hi,

Thanks for your suggestion, but I don't get the image as file, instead, I
have image as single dimensional pixel array of int type (the way .png files
are stored basically). I don't have to convert it to an Image, that's my
restriction. So, ultimately, I need some way to display it on the applet.

please suggest me some way to do that.

Nihar Dhruva (Jr. Software Engineer)
Decision Craft Analytics Pvt ltd.
Phone:-+91-79-26870656/57/58 Ext: 145
Email: [hidden email]


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
Johannes Schindelin
Sent: Tuesday, February 14, 2006 10:51 PM
To: [hidden email]
Subject: Re: Show an Image without opening file but by directly passing
height, width, pixels array. VERY URGENT.


Hi,

On Tue, 14 Feb 2006, Nihar Dhruva wrote:

> My aim is to display an image using ImageJ tool. But I don't want to
display
> the file using Open File Dialog Box. Instead, I want to pass the height,
> width and pixel array through my code, and it should display the image on
my
> applet.

Why don't you just use the "url1" parameter? You can open up to 9 images
by setting the "url1", ..., "url9" parameters to the applet.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

dscho
Hi,

On Wed, 15 Feb 2006, Nihar Dhruva wrote:

> Thanks for your suggestion, but I don't get the image as file, instead, I
> have image as single dimensional pixel array of int type (the way .png files
> are stored basically). I don't have to convert it to an Image, that's my
> restriction. So, ultimately, I need some way to display it on the applet.
>
> please suggest me some way to do that.

In that case you'll have to adapt ImageJApplet.java. Just add another "if"
after the "for", where you check that certain Parameters are there. Then,
constructing the ImagePlus from the array is just a matter of converting
the types of the parameters accordingly. If all succeded, you can "show()"
the image.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

Nihar Dhruva
So, it means, that if I put following code after "for" in ImageJApplet.java,
will it do?

ip = new ColorProcessor(width, height, (int[])pixels);
imp = new ImagePlus("TEST", ip);

If i need to do something else, kindly explain me the things in details, as
the code is very difficult to understand, and I don't have much time to go
deep in code.

Thanks for your support, and sorry that i am disturbing you a lot.


Thanks again,

Nihar.


----- Original Message -----
From: "Johannes Schindelin" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, February 15, 2006 1:55 PM
Subject: Re: Show an Image without opening file but by directly passing
height, width, pixels array. VERY URGENT.


> Hi,
>
> On Wed, 15 Feb 2006, Nihar Dhruva wrote:
>
> > Thanks for your suggestion, but I don't get the image as file, instead,
I
> > have image as single dimensional pixel array of int type (the way .png
files
> > are stored basically). I don't have to convert it to an Image, that's my
> > restriction. So, ultimately, I need some way to display it on the
applet.

> >
> > please suggest me some way to do that.
>
> In that case you'll have to adapt ImageJApplet.java. Just add another "if"
> after the "for", where you check that certain Parameters are there. Then,
> constructing the ImagePlus from the array is just a matter of converting
> the types of the parameters accordingly. If all succeded, you can "show()"
> the image.
>
> Hth,
> Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

Nihar Dhruva
In reply to this post by dscho
Hi, it means that if i do following, will it do?

imp = new ImagePlus("TEST", new ColorProcessor(width, height, pixels));
if (imp!=null) imp.show();



----- Original Message -----
From: "Johannes Schindelin" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, February 15, 2006 1:55 PM
Subject: Re: Show an Image without opening file but by directly passing
height, width, pixels array. VERY URGENT.


> Hi,
>
> On Wed, 15 Feb 2006, Nihar Dhruva wrote:
>
> > Thanks for your suggestion, but I don't get the image as file, instead,
I
> > have image as single dimensional pixel array of int type (the way .png
files
> > are stored basically). I don't have to convert it to an Image, that's my
> > restriction. So, ultimately, I need some way to display it on the
applet.

> >
> > please suggest me some way to do that.
>
> In that case you'll have to adapt ImageJApplet.java. Just add another "if"
> after the "for", where you check that certain Parameters are there. Then,
> constructing the ImagePlus from the array is just a matter of converting
> the types of the parameters accordingly. If all succeded, you can "show()"
> the image.
>
> Hth,
> Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

dscho
Hi,

On Wed, 15 Feb 2006, Nihar Dhruva wrote:

> imp = new ImagePlus("TEST", new ColorProcessor(width, height, pixels));
> if (imp!=null) imp.show();

That is the idea. However, you have to decide how you want to deploy it:

        - either you hardcode the image in ImageJApplet.java, which easy
          but ugly,
        - or you pass the image as applet parameters, which is a bit more
          involved, as these are passed as strings, and have to be
          converted to int, int and int[] respectively.

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Show an Image without opening file but by directly passing height, width, pixels array. VERY URGENT.

Nihar Dhruva
Thanks for your help. Still, if i'll find any doubt,, i'll ask you again.

Thanks a lot for your support.

Nihar Dhruva (Jr. Software Engineer)
Decision Craft Analytics Pvt ltd.
Phone:-+91-79-26870656/57/58 Ext: 145
Email: [hidden email]


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
Johannes Schindelin
Sent: Wednesday, February 15, 2006 4:38 PM
To: [hidden email]
Subject: Re: Show an Image without opening file but by directly passing
height, width, pixels array. VERY URGENT.


Hi,

On Wed, 15 Feb 2006, Nihar Dhruva wrote:

> imp = new ImagePlus("TEST", new ColorProcessor(width, height, pixels));
> if (imp!=null) imp.show();

That is the idea. However, you have to decide how you want to deploy it:

        - either you hardcode the image in ImageJApplet.java, which easy
          but ugly,
        - or you pass the image as applet parameters, which is a bit more
          involved, as these are passed as strings, and have to be
          converted to int, int and int[] respectively.

Ciao,
Dscho