Login  Register

Re: Flex to Tiff conversion problem

Posted by Md Tamjidul Hoque on Jun 09, 2010; 12:14am
URL: http://imagej.273.s1.nabble.com/Flex-to-Tiff-conversion-problem-tp3687967p3687968.html

By the way, the following code is working ... seems not a good solution
though ...
------------------------------------------------------------------------
ImagePlus imp = IJ.openImage("I:\\small flex file\\006003000.flex");
ImagePlus imp100 = WindowManager.getCurrentImage();
IJ.saveAs(imp100, "Tiff", "I:\\small flex file\\006003000.tif");
imp100.close();  
//imp.close(); // Note the value of 'imp' remains 'null', so imp.close()
will not work, that is  IJ.openImage(...) is returning null to imp.
--------------------------------------------------------------------------------------------------------------

I am still after converting .flex file to .tiff (or to any) but by not
opening the image window.

Any solution is much appreciated.

Thanks
Tamjid


Tamjid wrote:

> Dear All
>
>           I am using using MBF_ImageJ version to open  .flex file (I
> think Bio-format plugin is working for it or so ... ).
>
> With an intention to convert many flex file into tiff,
>
>       the following macro code is working:
>          -------------------------------------------------------------
>          open("I:\\small flex file\\006003000.flex");
>          saveAs("Tiff", "I:\\small flex file\\006003000.tif");
>          close();
>         --------------------------------------------------------------
>
> but the equivalent, java code is not working with .flex file (but
> working fine with other image type though):
>    
> ---------------------------------------------------------------------------------------------------------------
>
>      Line#1:   ImagePlus imp = IJ.openImage("I:\\small flex
> file\\006003000.flex");
>      Line#2:   IJ.saveAs(imp, "Tiff", "I:\\small flex
> file\\006003000.tif");
>      Line#3:   imp.close();
>    
> ------------------------------------------------------------------------------------------------------------
>
>  
>  
> I was actually after the following code as I was running batch mode
> for my java application:
> ------------------------------------------------------------------------------------------------------
>         Line#x:  ImagePlus imp = new ImagePlus("I:\\small flex
> file\\006003000.flex");
>        Line#y:  IJ.saveAs(imp, "Tiff", "I:\\small flex
> file\\006003000.tif");
>        Line#z:  imp.close();
> -----------------------------------------------------------------------------------------------------
> but as Line#x was always opening the image window for .flex file (but
> not for the other type of images) I am using Line #1 instead, thinking,
> it needs to load and then to save ...
>
> I have actually tried in couple different ways .. like the following ...
> ------------------------------------------------------------------
> imp = IJ.openImage("I:\\small flex file\\006003000.flex");
> int[] wList = WindowManager.getIDList();
> ImagePlus imp1 = WindowManager.getImage(wList[0]);                  
> ImageWindow winimp1 = imp.getWindow();
>  WindowManager.setCurrentWindow(winimp1);
>  //imp1 = WindowManager.getCurrentImage(); //used before
>
> ... etc - nothing working
>
>
> Also, the same problem is not allowing to get the stack size of the
> .flex file within the java application ...
>
>
> Is the Lines #x executed as thread within java application?
>
> I have loaded 3 flex file as examples online indicated below to check
> the problem:
>
> (1)
> http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006003000.zip?attredirects=0&d=1 
> <http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006003000.zip?attredirects=0&d=1>
> (2)
> http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006004000.zip?attredirects=0&d=1 
> <http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006004000.zip?attredirects=0&d=1>
> (3)
> http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006005000.zip?attredirects=0&d=1 
> <http://sites.google.com/site/tamjidulhoque/home/resume-of/useful-links/006005000.zip?attredirects=0&d=1>
>
>
> Any help is much appreciated.
>
> Thanks
> Tamjid
>
>