gov.nih.nci.caarray.services.mageloader
Class CustomDataCubeIOHelpers

java.lang.Object
  extended by gov.nih.nci.caarray.services.mageloader.CustomDataCubeIOHelpers

public class CustomDataCubeIOHelpers
extends java.lang.Object

Description: Class that provides static helper metheds for writing and reading external cube data to/from a file.


Constructor Summary
CustomDataCubeIOHelpers()
           
 
Method Summary
static java.lang.Object[][][] readExternalDataCubeFromFile(int dim1, int dim2, int dim3, java.lang.String filename)
          Description: Method for reading a text file formatted and written by the saveExternalDataCubeToFile method.
static void saveExternalDataCubeToFile(double[][][] cube, java.lang.String filename, boolean tmp)
          Description: Method for writing a cube of doubles to a text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomDataCubeIOHelpers

public CustomDataCubeIOHelpers()
Method Detail

saveExternalDataCubeToFile

public static void saveExternalDataCubeToFile(double[][][] cube,
                                              java.lang.String filename,
                                              boolean tmp)
Description: Method for writing a cube of doubles to a text file. (Cube : three dimensional matrix)

Parameters:
cube - The cube of doubles to be written.
filename - The name of the file.
tmp - Boolean to indicate if file is to be treated as a temporary file, being deleted upon exit of the virtual machine if the file still exists.

readExternalDataCubeFromFile

public static java.lang.Object[][][] readExternalDataCubeFromFile(int dim1,
                                                                  int dim2,
                                                                  int dim3,
                                                                  java.lang.String filename)
                                                           throws java.lang.Exception
Description: Method for reading a text file formatted and written by the saveExternalDataCubeToFile method.

Parameters:
dim1 - Size of first dimension of the result
dim2 - Size of second dimension of the result
dim3 - Size of third dimension of the result
filename - The name of the file to be loaded
Returns:
A cube of Objects (threedimensional matrix) with the same values as written in the saveExternalDataCubeToFile method.
Throws:
java.lang.Exception - IndexOutOfBoundsException if the dimension is different from the available data in the file.