Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

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

Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

SaralaT

Hi everyone,


Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution. 


I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..


Thanks a lot!


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: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

SaralaT

Hello everyone,


I am still pretty much stuck with this topic...any one has any ideas on if this is possible? 


Thanks a lot!


Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige <[hidden email]>
Sent: Tuesday, December 5, 2017 6:11:02 PM
To: [hidden email]
Subject: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin
 

Hi everyone,


Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution. 


I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..


Thanks a lot!


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: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

Matthijs

Hi Sarala,

 

Depending on how many images you are taking, you could store them in memory (just add the image objects to a list or map) and write them out as a single multi-page tiff afterwards perhaps? This was the approach I took for one of my plugins; you can see the relevant source here:

 

https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java

 

This uses the uManager TaggedImageStorageMultipageTiff class to handle most of the difficult bits.

 

It may also be fast enough if you open one multipage tiff file, and write to that file asynchronously during acquisition. I believe the core SequenceAcquisition and CircularBuffer functions may be helpful here?

 

All the best, and good luck!

 

                Matthijs

 

From: Sarala Neomi Tantirimudalige [mailto:[hidden email]]
Sent: 06 December 2017 08:34
To: [hidden email]
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hello everyone,

 

I am still pretty much stuck with this topic...any one has any ideas on if this is possible? 

 

Thanks a lot!

 

Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige <[hidden email]>
Sent: Tuesday, December 5, 2017 6:11:02 PM
To: [hidden email]
Subject: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hi everyone,

 

Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution. 

 

I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..

 

Thanks a lot!

 

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: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

SaralaT

Hi Matthijs,


Thanks a lot! I will explore this :)


Best Regards,

Sarala


From: Matthijs Dorst <[hidden email]>
Sent: Wednesday, December 6, 2017 5:13:04 PM
To: Micro-Manager General
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin
 

Hi Sarala,

 

Depending on how many images you are taking, you could store them in memory (just add the image objects to a list or map) and write them out as a single multi-page tiff afterwards perhaps? This was the approach I took for one of my plugins; you can see the relevant source here:

 

https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java

 

This uses the uManager TaggedImageStorageMultipageTiff class to handle most of the difficult bits.

 

It may also be fast enough if you open one multipage tiff file, and write to that file asynchronously during acquisition. I believe the core SequenceAcquisition and CircularBuffer functions may be helpful here?

 

All the best, and good luck!

 

                Matthijs

 

From: Sarala Neomi Tantirimudalige [mailto:[hidden email]]
Sent: 06 December 2017 08:34
To: [hidden email]
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hello everyone,

 

I am still pretty much stuck with this topic...any one has any ideas on if this is possible? 

 

Thanks a lot!

 

Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige <[hidden email]>
Sent: Tuesday, December 5, 2017 6:11:02 PM
To: [hidden email]
Subject: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hi everyone,

 

Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution. 

 

I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..

 

Thanks a lot!

 

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: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

SaralaT

Hi Matthijs,


I took a look at the code on your program  https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java


But I am a bit confused with the flow of it... could you please help me understand the steps in how this works?


What I want to use it for is as below in pseudo code;


{

for (i=0 ; i<50 ; i++){


take a snap from the camera and have an image imp1

Store this image without saving as TaggedImageStorageMultipageTiff (keep adding each tiff as the for loop cycles.) 

//is there some simple way to implement this? Like simply calling a class/method? I do not know how to use the JSONObject...it looks quite complex


}


save the TaggedImageStorageMultipageTiff (with 50 tiff images in sequence) at the end, after the loop is completed

}


How can I modify your program to do this? I am getting confused with the CalciumImage and the TreeMap. Would be great if you could give me some pointers. 


Thanks a lot in advance! And sorry about the very low knowledge I have in this topic :)



Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige
Sent: Wednesday, December 13, 2017 10:20:19 AM
To: Micro-Manager General
Subject: Re: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin
 

Hi Matthijs,


Thanks a lot! I will explore this :)


Best Regards,

Sarala


From: Matthijs Dorst <[hidden email]>
Sent: Wednesday, December 6, 2017 5:13:04 PM
To: Micro-Manager General
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin
 

Hi Sarala,

 

Depending on how many images you are taking, you could store them in memory (just add the image objects to a list or map) and write them out as a single multi-page tiff afterwards perhaps? This was the approach I took for one of my plugins; you can see the relevant source here:

 

https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java

 

This uses the uManager TaggedImageStorageMultipageTiff class to handle most of the difficult bits.

 

It may also be fast enough if you open one multipage tiff file, and write to that file asynchronously during acquisition. I believe the core SequenceAcquisition and CircularBuffer functions may be helpful here?

 

All the best, and good luck!

 

                Matthijs

 

From: Sarala Neomi Tantirimudalige [mailto:[hidden email]]
Sent: 06 December 2017 08:34
To: [hidden email]
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hello everyone,

 

I am still pretty much stuck with this topic...any one has any ideas on if this is possible? 

 

Thanks a lot!

 

Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige <[hidden email]>
Sent: Tuesday, December 5, 2017 6:11:02 PM
To: [hidden email]
Subject: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

 

Hi everyone,

 

Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution. 

 

I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..

 

Thanks a lot!

 

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: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin

SaralaT
Hi everyone,


I just found an easier approach for this problem... and wanted to share it, if anyone else is facing a similar issue. :)

ImageStack stack1 = new ImageStack((int) r.getWidth(),(int) r.getHeight());  //to creat a virtual stack.....
IJ.log("just created a virtual image stack of ROI size ");


for (i=0; i<10; i++){
imp = ij.IJ.getImage();

ImageProcessor impip = imp.getProcessor();
stack1.addSlice(impip);
}


//save the total stack of 10 images....
 ImagePlus stackIP = new ImagePlus("name", stack1);
 IJ.saveAs(stackIP, "Tiff", path and fileName );







Best Regards,

Sarala


________________________________
From: Sarala Neomi Tantirimudalige
Sent: Wednesday, February 7, 2018 8:07 PM
To: Micro-Manager General
Subject: Re: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin


Hi Matthijs,


I took a look at the code on your program  https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java


But I am a bit confused with the flow of it... could you please help me understand the steps in how this works?


What I want to use it for is as below in pseudo code;


{

for (i=0 ; i<50 ; i++){


take a snap from the camera and have an image imp1

Store this image without saving as TaggedImageStorageMultipageTiff (keep adding each tiff as the for loop cycles.)

//is there some simple way to implement this? Like simply calling a class/method? I do not know how to use the JSONObject...it looks quite complex


}


save the TaggedImageStorageMultipageTiff (with 50 tiff images in sequence) at the end, after the loop is completed

}


How can I modify your program to do this? I am getting confused with the CalciumImage and the TreeMap. Would be great if you could give me some pointers.


Thanks a lot in advance! And sorry about the very low knowledge I have in this topic :)



Best Regards,

Sarala

________________________________
From: Sarala Neomi Tantirimudalige
Sent: Wednesday, December 13, 2017 10:20:19 AM
To: Micro-Manager General
Subject: Re: Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin


Hi Matthijs,


Thanks a lot! I will explore this :)


Best Regards,

Sarala

________________________________
From: Matthijs Dorst <[hidden email]>
Sent: Wednesday, December 6, 2017 5:13:04 PM
To: Micro-Manager General
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin


Hi Sarala,



Depending on how many images you are taking, you could store them in memory (just add the image objects to a list or map) and write them out as a single multi-page tiff afterwards perhaps? This was the approach I took for one of my plugins; you can see the relevant source here:



https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java

[https://avatars1.githubusercontent.com/u/20702686?s=400&v=4]<https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java>

MattNeuro/CalciumImaging<https://github.com/MattNeuro/CalciumImaging/blob/master/src/se/karolinska/corticostriatal/calciumImaging/FileSaver.java>
github.com
CalciumImaging - Micromanager plugin for Calcium Imaging





This uses the uManager TaggedImageStorageMultipageTiff class to handle most of the difficult bits.



It may also be fast enough if you open one multipage tiff file, and write to that file asynchronously during acquisition. I believe the core SequenceAcquisition and CircularBuffer functions may be helpful here?



All the best, and good luck!



                Matthijs



From: Sarala Neomi Tantirimudalige [mailto:[hidden email]]
Sent: 06 December 2017 08:34
To: [hidden email]
Subject: Re: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin



Hello everyone,



I am still pretty much stuck with this topic...any one has any ideas on if this is possible?



Thanks a lot!



Best Regards,

Sarala

________________________________

From: Sarala Neomi Tantirimudalige <[hidden email]<mailto:[hidden email]>>
Sent: Tuesday, December 5, 2017 6:11:02 PM
To: [hidden email]<mailto:[hidden email]>
Subject: [micro-manager-general] Store Tiff images in temporary memory, and saving the whole set at completion of loop - MM1.4 plugin



Hi everyone,



Right now I have a plugin, which loops a number of times and at each loop, it takes a "snap" from camera, and I save it in a file as  tiff image in each loop. This is making my loop run very slowly. I would like to speed the loop up, by storing each tiff as it loop in some temporary location and write all the tiff files out into a folder once the loop has finished execution.



I did a bit of searching, but couldn't really find much. Would be great if some one could help me out as to whether this is doable..



Thanks a lot!



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

winmail.dat (44K) Download Attachment