Image IO py plugin

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

Image IO py plugin

Lothar Leidner
Hello,

thank you all for your help so far. I have now learned that there is no
permanent connection between a FileInfo object and the ImagePlus object.
In the meantime I've tried to solve the problem of communication between
the two classes B16Reader_ and B16Writer_, but without success. How can
I pass the Reader's FileInfo "fi" object to a (not yet existing) writer
object?

 > Do you also see this problem with the imp.getOriginalFileInfo() method?

The implementation below did not work:

B16Reader:
imp.setFileInfo(fi);

B16Writer:
fi = imp.getOriginalFileInfo();

In that case even the number of pixels gets lost and the following error
code pops up:
java.io.IOException: ImageWriter: fi.pixels==null

I must admit I don't understand how the method setFileInfo should work.
As there is no FileInfo object located in the ImagePlus class field it
is not surprising for me that the information gets lost.

As I found that in the case of Sensicam images both header size and byte
order are always the same there is no longer any need to pass these data
from the reader to the writer class. So I can live with the plugin as it is.

Thanks again

Lothar Leidner


--
===============================================
Lothar Leidner
Institute of Theoretical and Physical Chemistry
University of Tuebingen
Auf der Morgenstelle 18
D-72076 Tübingen
E-Mail: [hidden email]
Phone: +49-7071-29-72651
Reply | Threaded
Open this post in threaded view
|

Antwort: Image IO py plugin

Joachim Wesner
Hi Lothar,

did you resolve your problem? I actually encountered a similar situation
with a pair of plugins that read and write binary Zygo interferometer
files (.dat) (BTW anybody working ininterferometry and using ImageJ
and wanting to share stuff and knowledge?)

These files have quite a lot of extra info in the header that I want
to be retained or at least to be accessible after reading stuff and
probably
later write back the original or modified info (Should also be accessible
via a macro, at best)

I do this using the ImagePlus setProperty and getProperty methods,
you can in principle attach any named object (denoted a a key string)
to an ImagePlus, but if you want to read/write those from a macro too,
you need to restrict to strings. (From a macro, you can load a simple
class and read/write the properties through the added static method:

http://rsb.info.nih.gov/ij/plugins/imp-props.html
)

However, in further processing, this info will be lost, i.e. not appear
in the result ImagePlus IIRC, so you have to take care to move the info you
want to the output ImagePlus!

Mit freundlichen Grüßen / Best regards

Joachim Wesner


Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
Martyr | Colin Davis


                                                                           
             Lothar Leidner                                                
             <lothar.leidner@I                                            
             PC.UNI-TUEBINGEN.                                          An
             DE>                        [hidden email]                
             Gesendet von:                                           Kopie
             ImageJ Interest                                              
             Group                                                   Thema
             <[hidden email].          Image IO py plugin                
             GOV>                                                          
                                                                           
                                                                           
             07.04.2009 12:41                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




Hello,

thank you all for your help so far. I have now learned that there is no
permanent connection between a FileInfo object and the ImagePlus object.
In the meantime I've tried to solve the problem of communication between
the two classes B16Reader_ and B16Writer_, but without success. How can
I pass the Reader's FileInfo "fi" object to a (not yet existing) writer
object?

 > Do you also see this problem with the imp.getOriginalFileInfo() method?

The implementation below did not work:

B16Reader:
imp.setFileInfo(fi);

B16Writer:
fi = imp.getOriginalFileInfo();

In that case even the number of pixels gets lost and the following error
code pops up:
java.io.IOException: ImageWriter: fi.pixels==null

I must admit I don't understand how the method setFileInfo should work.
As there is no FileInfo object located in the ImagePlus class field it
is not surprising for me that the information gets lost.

As I found that in the case of Sensicam images both header size and byte
order are always the same there is no longer any need to pass these data
from the reader to the writer class. So I can live with the plugin as it
is.

Thanks again

Lothar Leidner


--
===============================================
Lothar Leidner
Institute of Theoretical and Physical Chemistry
University of Tuebingen
Auf der Morgenstelle 18
D-72076 Tübingen
E-Mail: [hidden email]
Phone: +49-7071-29-72651



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: Image IO py plugin

Lothar Leidner
Hello Joachim,

I'm sorry for the late answer, I was out of office.

Joachim Wesner schrieb:
> Hi Lothar,
>
> did you resolve your problem? I actually encountered a similar situation
> with a pair of plugins that read and write binary Zygo interferometer
> files (.dat) (BTW anybody working ininterferometry and using ImageJ
> and wanting to share stuff and knowledge?)
>
>  

I haven't really resolved the problem. But as I know all the relevant
header data of my b16 image files I can create a FileInfo object in both
B16Reader and B16Writer classes. There is no need for me at the moment
to communicate between these classes. I use ImageJ only to do some
filter operations and store the image back into a new B16 file. The
subsequent image processing is unparalleled and is done by my "private"
image processing software.

Thank you for your help. Kind regards,

Lothar Leidner


> These files have quite a lot of extra info in the header that I want
> to be retained or at least to be accessible after reading stuff and
> probably
> later write back the original or modified info (Should also be accessible
> via a macro, at best)
>
> I do this using the ImagePlus setProperty and getProperty methods,
> you can in principle attach any named object (denoted a a key string)
> to an ImagePlus, but if you want to read/write those from a macro too,
> you need to restrict to strings. (From a macro, you can load a simple
> class and read/write the properties through the added static method:
>
> http://rsb.info.nih.gov/ij/plugins/imp-props.html
> )
>
> However, in further processing, this info will be lost, i.e. not appear
> in the result ImagePlus IIRC, so you have to take care to move the info you
> want to the output ImagePlus!
>
> Mit freundlichen Grüßen / Best regards
>
> Joachim Wesner
>
>
> Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
> Wetzlar  HRB 2432
> Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David Roy
> Martyr | Colin Davis
>
>
>                                                                            
>              Lothar Leidner                                                
>              <lothar.leidner@I                                            
>              PC.UNI-TUEBINGEN.                                          An
>              DE>                        [hidden email]                
>              Gesendet von:                                           Kopie
>              ImageJ Interest                                              
>              Group                                                   Thema
>              <[hidden email].          Image IO py plugin                
>              GOV>                                                          
>                                                                            
>                                                                            
>              07.04.2009 12:41                                              
>                                                                            
>                                                                            
>               Bitte antworten                                              
>                     an                                                    
>               ImageJ Interest                                              
>                    Group                                                  
>              <[hidden email].                                            
>                    GOV>                                                    
>                                                                            
>                                                                            
>
>
>
>
> Hello,
>
> thank you all for your help so far. I have now learned that there is no
> permanent connection between a FileInfo object and the ImagePlus object.
> In the meantime I've tried to solve the problem of communication between
> the two classes B16Reader_ and B16Writer_, but without success. How can
> I pass the Reader's FileInfo "fi" object to a (not yet existing) writer
> object?
>
>  > Do you also see this problem with the imp.getOriginalFileInfo() method?
>
> The implementation below did not work:
>
> B16Reader:
> imp.setFileInfo(fi);
>
> B16Writer:
> fi = imp.getOriginalFileInfo();
>
> In that case even the number of pixels gets lost and the following error
> code pops up:
> java.io.IOException: ImageWriter: fi.pixels==null
>
> I must admit I don't understand how the method setFileInfo should work.
> As there is no FileInfo object located in the ImagePlus class field it
> is not surprising for me that the information gets lost.
>
> As I found that in the case of Sensicam images both header size and byte
> order are always the same there is no longer any need to pass these data
> from the reader to the writer class. So I can live with the plugin as it
> is.
>
> Thanks again
>
> Lothar Leidner
>
>
> --
> ===============================================
> Lothar Leidner
> Institute of Theoretical and Physical Chemistry
> University of Tuebingen
> Auf der Morgenstelle 18
> D-72076 Tübingen
> E-Mail: [hidden email]
> Phone: +49-7071-29-72651
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________
>  


--
===============================================
Lothar Leidner
Institute of Theoretical and Physical Chemistry
University of Tuebingen
Auf der Morgenstelle 18
D-72076 Tübingen
E-Mail: [hidden email]
Phone: +49-7071-29-72651
Fax: +49-7071-29-5772