Icy window as a component

19 views
Skip to first unread message

Masoud Ramuz

unread,
Feb 22, 2019, 11:19:42 AM2/22/19
to Icy imaging
Hello Icy community,

Does anyone know of a way to access the Icy internal area that holds the sequences as a component? If not maybe the whole window instead?
I'm trying to capture a screenshot of the sequences and their organisations (just to accompany exported data with an image of cells and final graphs). See example code:
void captureComponent(Component component) {
   
Rectangle rect = component.getBounds();
 
   
try {
       
String format = "png";
       
String fileName = component.getName() + "." + format;
       
BufferedImage captureImage =
               
new BufferedImage(rect.width, rect.height,
                                   
BufferedImage.TYPE_INT_ARGB);
        component
.paint(captureImage.getGraphics());
 
       
ImageIO.write(captureImage, format, new File(fileName));
 
       
System.out.printf("The screenshot of %s was saved!", component.getName());
   
} catch (IOException ex) {
       
System.err.println(ex);
   
}
}

I've tried to use the SequenceActionFrame, using the getExternalFrame, getFrame, getIcyExternalFrame, getIcyInternalFrame and getInternalFrame all resulted in nullpointerexceptions.


Cheers,

Masoud

Robert Smith

unread,
Feb 22, 2019, 6:19:00 PM2/22/19
to icy-so...@googlegroups.com
Hello Masoud,
ICY has a tool called ImageJ. In that tool there is a plugin folder, go to Plugins > Utilities > Capture screen (or ) Capture Delayed and either of these will capture the screen shot for you. The 'capture delayed' will wait for 10 seconds, or however long you wish to set it for before capture.  Use it as often as you want.
Good Luck and Good Day,
Bob



From: icy-so...@googlegroups.com <icy-so...@googlegroups.com> on behalf of Masoud Ramuz <masoud...@gmail.com>
Sent: Friday, February 22, 2019 11:19 AM
To: Icy imaging
Subject: [icy] Icy window as a component
 
--
You received this message because you are subscribed to the Google Groups "Icy imaging" group.
To unsubscribe from this group and stop receiving emails from it, send an email to icy-software...@googlegroups.com.
To post to this group, send email to icy-so...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/icy-software/1ab41fe4-1323-4822-8c04-0481c9ecfb52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephane

unread,
Feb 25, 2019, 4:18:45 AM2/25/19
to Icy imaging
Hi Masoud,

I guess you mean "programmatically" ?
Sequence are displayed in "Viewer" and you can get a Sequence representing current view :

// get viewer displaying the sequence
viewer
= sequence.getFirstViewer();
// get rendered view as sequence (the boolean parameter allow to specify if we want current view size or original image size)
seqView
= viewer.getRenderedSequence(true, null);
// save the result
Saver.save(seqView, new File(sequence.getName() + "_screenshot.png"));

That should do what you want :)

Best,

- Stephane

Masoud Ramuz

unread,
Feb 25, 2019, 6:57:36 AM2/25/19
to Icy imaging
Dear Stephane,

Yes I did, I should have clarified.
Furthermore what I meant was something like this:
Which is useful because as you can see, there's a lot going on and this would let people looking back at their data get a quick view of how the situation looked (i.e. if the experiment failed for one or more cells).

While what you posted wasn't what I was looking for, it is still interesting to know about and looking into it let me find my answer:
import icy.main.Icy;
       
//Get the Icy window
       
MainInterface MI = Icy.getMainInterface();
       
//Use with the method I posted above to screenshot full window..
        captureComponent
(MI.getMainFrame());
       
//..or just the area that holds the internal frames
        captureComponent
(MI.getDesktopPane());
Result:


Thanks for the help,

Masoud

Stephane

unread,
Feb 25, 2019, 12:12:55 PM2/25/19
to Icy imaging
Hi Masoud,

Oh indeed it was completely different from what i imagined. Glad you got it to work using another method !

Best,

- Stephane
Reply all
Reply to author
Forward
0 new messages