/*
 * #%L
 * SCIFIO Bio-Formats compatibility format.
 * %%
 * Copyright (C) 2013 Open Microscopy Environment:
 *   - Board of Regents of the University of Wisconsin-Madison
 *   - Glencoe Software, Inc.
 *   - University of Dundee
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-2.0.html>.
 * #L%
 */

import io.scif.Format;
import io.scif.FormatException;
import io.scif.Metadata;
import io.scif.Parser;
import io.scif.SCIFIO;

import java.io.File;
import java.io.IOException;

import javax.swing.JFileChooser;

import net.imglib2.meta.AxisType;

/**
 * A simple manual test for the SCIFIO Bio-Formats compatibility layer.
 * 
 * @author Curtis Rueden
 */
public class ReadFile {

  public static void main(String[] args) throws FormatException, IOException {
    final SCIFIO scifio = new SCIFIO();

    final JFileChooser opener = new javax.swing.JFileChooser(System.getProperty("user.home"));
    int result = opener.showOpenDialog(null);
    if (result != JFileChooser.APPROVE_OPTION) return;
    final File file = opener.getSelectedFile();

    final Format format = scifio.format().getFormat(file.getAbsolutePath());
    System.out.println("file = " + file);
    System.out.println("format = " + format);
    final Parser parser = format.createParser();
    final Metadata meta = parser.parse(file);
    for (int i=0; i<meta.getImageCount(); i++) {
      System.out.println("image #" + i + " dimensions:");
      for (int a=0; a<meta.getAxisCount(i); a++) {
        final AxisType axisType = meta.getAxisType(i, a);
        final int axisLength = meta.getAxisLength(i, a);
        System.out.println("\t" + axisLength + " : " + axisType);
      }
    }
  }

}

@@ -1288,18 +1288,17 @@
 File %7B%0A%0A
-  
+%09
 public s
@@ -1313,16 +1313,22 @@
 id main(
+final 
 String%5B%5D
@@ -1357,17 +1357,19 @@
 ception,
- 
+%0A%09%09
 IOExcept
@@ -1371,23 +1371,22 @@
 xception
- %7B%0A    
+%0A%09%7B%0A%09%09
 final SC
@@ -1410,28 +1410,26 @@
  SCIFIO();%0A%0A
-    
+%09%09
 final JFileC
@@ -1443,17 +1443,20 @@
 opener =
- 
+%0A%09%09%09
 new java
@@ -1510,19 +1510,23 @@
 ome%22));%0A
-   
+%09%09final
  int res
@@ -1560,20 +1560,18 @@
 (null);%0A
-    
+%09%09
 if (resu
@@ -1613,20 +1613,18 @@
 return;%0A
-    
+%09%09
 final Fi
@@ -1660,20 +1660,18 @@
 ile();%0A%0A
-    
+%09%09
 final Fo
@@ -1735,20 +1735,18 @@
 ath());%0A
-    
+%09%09
 System.o
@@ -1775,20 +1775,18 @@
  file);%0A
-    
+%09%09
 System.o
@@ -1819,20 +1819,18 @@
 ormat);%0A
-    
+%09%09
 final Pa
@@ -1866,20 +1866,18 @@
 rser();%0A
-    
+%09%09
 final Me
@@ -1910,20 +1910,18 @@
 (file);%0A
-    
+%09%09
 for (int
@@ -1926,14 +1926,18 @@
 nt i
-=
+ = 
 0; i
-%3C
+ %3C 
 meta
@@ -1961,22 +1961,19 @@
  i++) %7B%0A
-      
+%09%09%09
 System.o
@@ -2016,22 +2016,19 @@
 ons:%22);%0A
-      
+%09%09%09
 for (int
@@ -2033,14 +2033,18 @@
 nt a
-=
+ = 
 0; a
-%3C
+ %3C 
 meta
@@ -2068,24 +2068,20 @@
  a++) %7B%0A
-        
+%09%09%09%09
 final Ax
@@ -2122,24 +2122,20 @@
 (i, a);%0A
-        
+%09%09%09%09
 final in
@@ -2179,16 +2179,12 @@
 a);%0A
-        
+%09%09%09%09
 Syst
@@ -2241,24 +2241,18 @@
 e);%0A
-      %7D%0A    %7D%0A  
+%09%09%09%7D%0A%09%09%7D%0A%09
 %7D%0A%0A%7D

apply SCIFIO style formatting