[Zooimage-commits] r77 - in pkg/zooimage/src/src/org/sciviews/zooimage: . files

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 15 15:42:33 CEST 2009


Author: romain
Date: 2009-04-15 15:42:33 +0200 (Wed, 15 Apr 2009)
New Revision: 77

Modified:
   pkg/zooimage/src/src/org/sciviews/zooimage/ImageFileProcessor.java
   pkg/zooimage/src/src/org/sciviews/zooimage/ZimFileProcessor.java
   pkg/zooimage/src/src/org/sciviews/zooimage/ZooImage.java
   pkg/zooimage/src/src/org/sciviews/zooimage/files/ZimFile.java
Log:
create the dat1.zim file in the sample directory 

Modified: pkg/zooimage/src/src/org/sciviews/zooimage/ImageFileProcessor.java
===================================================================
--- pkg/zooimage/src/src/org/sciviews/zooimage/ImageFileProcessor.java	2009-04-15 13:16:50 UTC (rev 76)
+++ pkg/zooimage/src/src/org/sciviews/zooimage/ImageFileProcessor.java	2009-04-15 13:42:33 UTC (rev 77)
@@ -295,7 +295,9 @@
 		String pathZIM2 = zim.getDirectory() + File.separator + 
 			zim.getSampleDir() + File.separator +
 			zim.getSample() + FileExtensions.extDAT ;
-		FileUtilities.copyFile( zim.getFile().getAbsolutePath() , pathZIM2 );
+		zim.makeDATFile( plugin.getParams(), getResults(), 
+				getZimProcessor().getCount(), pathZIM2 ) ;
+		// FileUtilities.copyFile( zim.getFile().getAbsolutePath() , pathZIM2 );
 		
 		// Possibly sharpen the vignettes
 		if (options.get("sharpenvigs") ) {

Modified: pkg/zooimage/src/src/org/sciviews/zooimage/ZimFileProcessor.java
===================================================================
--- pkg/zooimage/src/src/org/sciviews/zooimage/ZimFileProcessor.java	2009-04-15 13:16:50 UTC (rev 76)
+++ pkg/zooimage/src/src/org/sciviews/zooimage/ZimFileProcessor.java	2009-04-15 13:42:33 UTC (rev 77)
@@ -87,6 +87,7 @@
 				im.moveToRawDirectory() ;
 				addCount( ) ;
 				file.makeDATFile( plugin.getParams() , ifp.getResults(), count ) ;
+				
 			} catch( ZooImageException e){
 				// this is where we catch whatever exception that gets
 				// generated by ZooImage, we log it and move on to the next image

Modified: pkg/zooimage/src/src/org/sciviews/zooimage/ZooImage.java
===================================================================
--- pkg/zooimage/src/src/org/sciviews/zooimage/ZooImage.java	2009-04-15 13:16:50 UTC (rev 76)
+++ pkg/zooimage/src/src/org/sciviews/zooimage/ZooImage.java	2009-04-15 13:42:33 UTC (rev 77)
@@ -4,12 +4,10 @@
 import ij.io.FileOpener;
 import ij.plugin.PlugIn;
 
-import java.awt.Dimension;
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.util.HashMap;
 
-import org.sciviews.zooimage.gui.ZooImageGui;
 import org.sciviews.zooimage.log.Log;
 
 /**

Modified: pkg/zooimage/src/src/org/sciviews/zooimage/files/ZimFile.java
===================================================================
--- pkg/zooimage/src/src/org/sciviews/zooimage/files/ZimFile.java	2009-04-15 13:16:50 UTC (rev 76)
+++ pkg/zooimage/src/src/org/sciviews/zooimage/files/ZimFile.java	2009-04-15 13:42:33 UTC (rev 77)
@@ -267,6 +267,13 @@
 		return map ;
 	}
 	
+	public void makeDATFile(Vector<String> parameters, ResultsTable table, int count ){
+		String output = getDirectory() + File.separator + 
+			Directories.wrkDir + File.separator + 
+			getSample() + "." + count + FileExtensions.extDAT ;
+		makeDATFile( parameters, table, count, output) ;
+	}
+	
 	/**
 	 * Copy this file, append process parameters, then measurements to cazfile
 	 * if the file already exist, measurements will be appended to the file
@@ -276,32 +283,34 @@
 	 * @param txtfile Text file to append
 	 * @return the file path of the created file
 	 */
-	public void makeDATFile(Vector<String> parameters, ResultsTable table, int count ) {
+	public void makeDATFile(Vector<String> parameters, ResultsTable table, int count, String output ) {
 		
-		String output = getDirectory() + File.separator + 
-			Directories.wrkDir + File.separator + 
-			getSample() + "." + count + FileExtensions.extDAT ;
-		
 		Log.debug( "saving zim file to " + output ) ;
 		
 		try{
 			
 			// The output file
-			BufferedWriter out = new BufferedWriter(new FileWriter(output));
+			BufferedWriter out ; 
+			
+			if( new File( output).exists() ){
+				out = new BufferedWriter(new FileWriter(output, true)) ;
+			} else {
+				out = new BufferedWriter(new FileWriter(output));
+				// Write data from zim file
+				BufferUtilities.copy( new BufferedReader(new FileReader( getFile() )) , out );
+				
+				// Write parameters data
+				out.write("\n");
+				out.write("[Process]\n");
+				BufferUtilities.writeLines( out, parameters) ;
+				out.write("\n");
 
-			// Write data from zim file
-			BufferUtilities.copy( new BufferedReader(new FileReader( getFile() )) , out );
+				out.write("[Data]\n");
+				out.write("!Item\tLabel");
+				out.write( table.getColumnHeadings( ) + "\n" );
+	
+			}
 
-			// Write parameters data
-			out.write("\n");
-			out.write("[Process]\n");
-			BufferUtilities.writeLines( out, parameters) ;
-			out.write("\n");
-
-			out.write("[Data]\n");
-			out.write("!Item\tLabel");
-			out.write( table.getColumnHeadings( ) + "\n" );
-
 			// Write data from the txt file
 			for( int i=0; i<table.getCounter(); i++){ 
 				table.setLabel(getSample(), i);



More information about the Zooimage-commits mailing list