Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

SaralaT

Hi All!


I am trying to run the code given in https://valelab4.ucsf.edu/~MM/files/Tutorial1.java to try load and initialize the demo cam by writing a plugin for it.


The below is my Java code....


import mmcorej.CMMCore;
import org.micromanager.api.MMPlugin;

public abstract class  MM_SPT_2 implements MMPlugin{
   public static void main(String[] args) throws Exception {
      CMMCore core = new CMMCore();
             
            try {
         core.loadDevice("Camera", "DemoCamera", "DCam");
         core.initializeDevice("Camera");

         core.setExposure(50);
         core.snapImage();
         if (core.getBytesPerPixel() == 1) {
            // 8-bit grayscale pixels
            byte[] img = (byte[])core.getImage();
            System.out.println("Image snapped, " + img.length + " pixels total, 8 bits each.");
            System.out.println("Pixel [0,0] value = " + img[0]);
         } else if (core.getBytesPerPixel() == 2){
            // 16-bit grayscale pixels
            short[] img = (short[])core.getImage();
            System.out.println("Image snapped, " + img.length + " pixels total, 16 bits each.");
            System.out.println("Pixel [0,0] value = " + img[0]);             
         } else {
            System.out.println("Dont' know how to handle images with " +
                  core.getBytesPerPixel() + " byte pixels.");             
         }
      } catch (Exception e) {
         System.out.println(e.getMessage());
         System.exit(1);
      }  
   }
}

But I get the below error when i try to run the code on Netbeans....


Camera not loaded or initialized.
C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

The thing is, I have already loaded and initialized the camera right..? or am i missing something here.. A bit new to Java and so a bit lost! Would be great if some one could point out what is going on here!

Thanks a lot!
Sarala


Best Regards,

Sarala


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

SaralaT

Hi All,


My ultimate objective is to build a GUI (Plugin) which is able to take images of sample on microscope. So I would probably need to load and initialize the camera first, then have a GUI to set the exposure time etc, and then have a button to say "snap image", which would initiate the snapping of image.


I think my previous code is sort of not proper at all as I am very new to Java and micromanager... and would be great if some one could help me fix it up... 


Thanks a lot! 


Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige
Sent: Monday, October 2, 2017 12:34:00 PM
To: [hidden email]
Subject: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)
 

Hi All!


I am trying to run the code given in https://valelab4.ucsf.edu/~MM/files/Tutorial1.java to try load and initialize the demo cam by writing a plugin for it.


The below is my Java code....


import mmcorej.CMMCore;
import org.micromanager.api.MMPlugin;

public abstract class  MM_SPT_2 implements MMPlugin{
   public static void main(String[] args) throws Exception {
      CMMCore core = new CMMCore();
             
            try {
         core.loadDevice("Camera", "DemoCamera", "DCam");
         core.initializeDevice("Camera");

         core.setExposure(50);
         core.snapImage();
         if (core.getBytesPerPixel() == 1) {
            // 8-bit grayscale pixels
            byte[] img = (byte[])core.getImage();
            System.out.println("Image snapped, " + img.length + " pixels total, 8 bits each.");
            System.out.println("Pixel [0,0] value = " + img[0]);
         } else if (core.getBytesPerPixel() == 2){
            // 16-bit grayscale pixels
            short[] img = (short[])core.getImage();
            System.out.println("Image snapped, " + img.length + " pixels total, 16 bits each.");
            System.out.println("Pixel [0,0] value = " + img[0]);             
         } else {
            System.out.println("Dont' know how to handle images with " +
                  core.getBytesPerPixel() + " byte pixels.");             
         }
      } catch (Exception e) {
         System.out.println(e.getMessage());
         System.exit(1);
      }  
   }
}

But I get the below error when i try to run the code on Netbeans....


Camera not loaded or initialized.
C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

The thing is, I have already loaded and initialized the camera right..? or am i missing something here.. A bit new to Java and so a bit lost! Would be great if some one could point out what is going on here!

Thanks a lot!
Sarala


Best Regards,

Sarala


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

Kyle Douglass

Hi Sarala,

My ultimate objective is to build a GUI (Plugin) which is able to take images of sample on microscope. So I would probably need to load and initialize the camera first, then have a GUI to set the exposure time etc, and then have a button to say "snap image", which would initiate the snapping of image.

All of what you have just described are already primary features of Micro-Manager. The MM GUI allows you to snap images, setup your hardware configuration, and set the exposure time without writing one bit of code.

I would suggest running the Micro-Manager GUI with the Demo camera and playing around with its features--if you haven't already--just to learn what it can do. Then, if you decide that the GUI is not sufficient for your workflow, you could try the Beanshell scripting interface. I only write plugins if I have a highly specialized feature that is not easily implemented in a script.

I hope this helps.

Best,
Kyle
-- 
Kyle M. Douglass, PhD
Post-doctoral researcher
The Laboratory of Experimental Biophysics
EPFL, Lausanne, Switzerland
http://kmdouglass.github.io
http://leb.epfl.ch

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

SaralaT

Hi Kyle,


Thanks for your reply. Could you help me as to how I can get the demo camera working? Right now I can't seem to see any option on MM 1.4 to start the democam... Sorry if I sound really silly!! I am quite new to micromanager!


Thanks a lot!


Best Regards,

Sarala


From: Kyle Douglass <[hidden email]>
Sent: Monday, October 2, 2017 3:01:09 PM
To: [hidden email]
Subject: Re: [micro-manager-general] Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)
 

Hi Sarala,

My ultimate objective is to build a GUI (Plugin) which is able to take images of sample on microscope. So I would probably need to load and initialize the camera first, then have a GUI to set the exposure time etc, and then have a button to say "snap image", which would initiate the snapping of image.

All of what you have just described are already primary features of Micro-Manager. The MM GUI allows you to snap images, setup your hardware configuration, and set the exposure time without writing one bit of code.

I would suggest running the Micro-Manager GUI with the Demo camera and playing around with its features--if you haven't already--just to learn what it can do. Then, if you decide that the GUI is not sufficient for your workflow, you could try the Beanshell scripting interface. I only write plugins if I have a highly specialized feature that is not easily implemented in a script.

I hope this helps.

Best,
Kyle
-- 
Kyle M. Douglass, PhD
Post-doctoral researcher
The Laboratory of Experimental Biophysics
EPFL, Lausanne, Switzerland
http://kmdouglass.github.io
http://leb.epfl.ch

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

Kyle Douglass

Hi Sarala,

Thanks for your reply. Could you help me as to how I can get the demo camera working? Right now I can't seem to see any option on MM 1.4 to start the democam...

No worries at all.

In your previous e-mails, were you compiling Micro-Manager from source? If yes, then I think it would be easier to download a pre-compiled binary (that is, a ".exe" file on Windows) and install it if you're brand new to Micro-Manager. You can find the links to the latest nightly build here: https://micro-manager.org/wiki/Micro-Manager_Nightly_Builds

I have noticed that the configuration with the demo camera is not always installed when compiling from source, which might explain why you don't see it.

Once you have Micro-Manager installed, run the executable whose shortcut has appeared in your Start menu or on your Desktop (or both). This should launch ImageJ and Micro-Manager together because, by default, Micro-Manager is installed as an ImageJ plugin. (It does not necessarily need to be, though.)

You should then see the Micro-Manager splash screen. I'm going by memory here so I might be wrong on the details, but you should see a drop down box in the splash screen that allows you to select a hardware configuration. Choose the one called MMCongif_demo (or something like it) that should already be present in the list. Click OK, and then Micro-Manager will load the configuration with the demo camera already set up. You can then snap images, change the settings, etc.

Finally, have you seen the user guide? It has most of the answers to your questions: https://micro-manager.org/wiki/Micro-Manager_User%27s_Guide

Cheers,
Kyle
-- 
Kyle M. Douglass, PhD
Post-doctoral researcher
The Laboratory of Experimental Biophysics
EPFL, Lausanne, Switzerland
http://kmdouglass.github.io
http://leb.epfl.ch

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

SaralaT

Hi Kyle,


Thanks a lot! Now my demo cam is setup and I shall explore!


Best Regards,

Sarala


From: Kyle Douglass <[hidden email]>
Sent: Monday, October 2, 2017 8:14:57 PM
To: [hidden email]
Subject: Re: [micro-manager-general] Camera not loaded or initialized. C:\Users\TWLab\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)
 

Hi Sarala,

Thanks for your reply. Could you help me as to how I can get the demo camera working? Right now I can't seem to see any option on MM 1.4 to start the democam...

No worries at all.

In your previous e-mails, were you compiling Micro-Manager from source? If yes, then I think it would be easier to download a pre-compiled binary (that is, a ".exe" file on Windows) and install it if you're brand new to Micro-Manager. You can find the links to the latest nightly build here: https://micro-manager.org/wiki/Micro-Manager_Nightly_Builds

I have noticed that the configuration with the demo camera is not always installed when compiling from source, which might explain why you don't see it.

Once you have Micro-Manager installed, run the executable whose shortcut has appeared in your Start menu or on your Desktop (or both). This should launch ImageJ and Micro-Manager together because, by default, Micro-Manager is installed as an ImageJ plugin. (It does not necessarily need to be, though.)

You should then see the Micro-Manager splash screen. I'm going by memory here so I might be wrong on the details, but you should see a drop down box in the splash screen that allows you to select a hardware configuration. Choose the one called MMCongif_demo (or something like it) that should already be present in the list. Click OK, and then Micro-Manager will load the configuration with the demo camera already set up. You can then snap images, change the settings, etc.

Finally, have you seen the user guide? It has most of the answers to your questions: https://micro-manager.org/wiki/Micro-Manager_User%27s_Guide

Cheers,
Kyle
-- 
Kyle M. Douglass, PhD
Post-doctoral researcher
The Laboratory of Experimental Biophysics
EPFL, Lausanne, Switzerland
http://kmdouglass.github.io
http://leb.epfl.ch

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general