Beanshell script for extracting configuraitons

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

Beanshell script for extracting configuraitons

AustinBlanco
Curious if anyone has found a solution for this. 

I want to pull some device data out of a group & preset. 
There’s an example on the programming page on how to do so here - https://micro-manager.org/wiki/Micro-Manager_Programming_Guide
StrVector configs = core.getAvailableConfigGroups();
for (int i=0; i<configs.size(); i++){
Configuration cdata = core.getConfigData(configs.get(i));
System.out.println("Configuration " + configs.get(i));
for (int j=0; j<cdata.size(); j++) {
PropertySetting s = cdata.getSetting(j);
System.out.println(" " + s.getDeviceLabel() + ", " + s.getPropertyName() + ", " + s.getPropertyValue());
}
}

I’ve modded that to use the mmc.* header, but I’m stuck on the Configuration data = portion.
I’m assuming it’s a declaration issue on the data var. Anyone have any suggestions?

Here’s what I’ve got working so far.
It works until the CDATA declaration. 

mmcorej.StrVector configs = mmc.getAvailableConfigGroups();
for (int i=0; i<configs.size(); i++){
//Configuration cdata = mmc.getConfigData(configs.get(i)); //original line
CDATA = mmc.getConfigData(configs.get(i)); //test line (not working)
System.out.println("Configuration " + configs.get(i));
for (int j=0; j<cdata.size(); j++) {
PropertySetting s = cdata.getSetting(j);
System.out.println(" " + s.getDeviceLabel() + ", " + s.getPropertyName() + ", " + s.getPropertyValue());
}
}


Austin Blanco
Advanced Research Consulting Corporation
e. [hidden email]
w. www.advancedresearch.co
c. 510.708.2995







_______________________________________________
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: Beanshell script for extracting configuraitons

Stuurman, Nico
Hi Austin,

> Curious if anyone has found a solution for this.
>
> I want to pull some device data out of a group & preset.
> There’s an example on the programming page on how to do so here -
> https://micro-manager.org/wiki/Micro-Manager_Programming_Guide 
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__micro-2Dmanager.org_wiki_Micro-2DManager-5FProgramming-5FGuide&d=DwMFaQ&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=za97c6OK5Pi0HfHlj1Zh3Sgc3XJzmOf9FSloYzxUpX0&s=rRWLoeMVaFrq_HP6ndJJlaMLqRSSr2PZR-ZwjBkNrqA&e=>
> StrVector configs = core.getAvailableConfigGroups();
> for (int i=0; i<configs.size(); i++){
> Configuration cdata = core.getConfigData(configs.get(i));
> System.out.println("Configuration " + configs.get(i));
> for (int j=0; j<cdata.size(); j++) {
> PropertySetting s = cdata.getSetting(j);
> System.out.println(" " + s.getDeviceLabel() + ", " +
> s.getPropertyName() + ", " + s.getPropertyValue());
> }
> }
>
> I’ve modded that to use the mmc.* header, but I’m stuck on the
> Configuration data = portion.
> I’m assuming it’s a declaration issue on the data var. Anyone have any
> suggestions?



This works for me:

mmcorej.StrVector configGroups = mmc.getAvailableConfigGroups();
for (int i=0; i<configGroups.size(); i++) {
     mmcorej.StrVector presets = mmc.getAvailableConfigs((configs.get(i)));
     for (int j=0;  j<presets.size(); j++) {
         mmcorej.Configuration config =
mmc.getConfigData(configs.get(i), presets.get(j));
         mm.scripter().message("Configuration " + configs.get(i) + "-" +
presets.get(j));
         for (int k=0; k<config.size(); k++) {
             mmcorej.PropertySetting s = config.getSetting(k);
             mm.scripter().message(" " + s.getDeviceLabel() + ", " +
s.getPropertyName() + ", " + s.getPropertyValue());
         }
     }
}

_______________________________________________
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: Beanshell script for extracting configuraitons

AustinBlanco
Awesome Nico - thanks man!!!


Austin Blanco
Advanced Research Consulting Corporation
e. [hidden email]
w. www.advancedresearch.co
c. 510.708.2995





On Jun 27, 2019, at 5:41 PM, Stuurman, Nico <[hidden email]> wrote:

Hi Austin,
Curious if anyone has found a solution for this.

I want to pull some device data out of a group & preset.
There’s an example on the programming page on how to do so here -
https://micro-manager.org/wiki/Micro-Manager_Programming_Guide
<https://urldefense.proofpoint.com/v2/url?u=https-3A__micro-2Dmanager.org_wiki_Micro-2DManager-5FProgramming-5FGuide&d=DwMFaQ&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=za97c6OK5Pi0HfHlj1Zh3Sgc3XJzmOf9FSloYzxUpX0&s=rRWLoeMVaFrq_HP6ndJJlaMLqRSSr2PZR-ZwjBkNrqA&e=>
StrVector configs = core.getAvailableConfigGroups();
for (int i=0; i<configs.size(); i++){
Configuration cdata = core.getConfigData(configs.get(i));
System.out.println("Configuration " + configs.get(i));
for (int j=0; j<cdata.size(); j++) {
PropertySetting s = cdata.getSetting(j);
System.out.println(" " + s.getDeviceLabel() + ", " +
s.getPropertyName() + ", " + s.getPropertyValue());
}
}

I’ve modded that to use the mmc.* header, but I’m stuck on the
Configuration data = portion.
I’m assuming it’s a declaration issue on the data var. Anyone have any
suggestions?



This works for me:

mmcorej.StrVector configGroups = mmc.getAvailableConfigGroups();
for (int i=0; i<configGroups.size(); i++) {
    mmcorej.StrVector presets = mmc.getAvailableConfigs((configs.get(i)));
    for (int j=0;  j<presets.size(); j++) {
        mmcorej.Configuration config =
mmc.getConfigData(configs.get(i), presets.get(j));
        mm.scripter().message("Configuration " + configs.get(i) + "-" +
presets.get(j));
        for (int k=0; k<config.size(); k++) {
            mmcorej.PropertySetting s = config.getSetting(k);
            mm.scripter().message(" " + s.getDeviceLabel() + ", " +
s.getPropertyName() + ", " + s.getPropertyValue());
        }
    }
}



_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general