How to process a large amount of floating point data?

We have a binary file that contains a large amount of data float(about 80 MB). we must process it in our Java application. Data taken from a medical scanner. One file contains data from one Rotation. One Rotationcontains 960 Views. One Viewcontains 16 Rows, and one Rowscontains 1344 Cells. These numbers (their relationship) are fixed.

We need to read ALL the floats in our application with a code structure that reflects the structure above Rotation-view-row-cell.

Now we use float[]to store data for Cells, and then using ArrayListfor Rotation, Viewand Rowto store our data.

I have two questions:

  • how to fill in cell data (quickly read the floats in our float [])
  • Do you have an idea to save this data?
+3
source share
7 answers

To download data:

DataInputStream should work well. But make sure that you complete the underlying FileInputStream in a BufferedInputStream, otherwise you run the risk of performing I / O on each float, which may result in poor performance.

Several options for storing data:

  • (in the very smallest) most efficient way for memory would be to store the entire array in a large float [] and calculate the offsets in it as needed. A bit ugly to use, but it might make sense if you do a lot of computation or loop through the whole set.
  • " " - , , . , .
  • ArrayLists [1344] . , , - . ArrayLists .
  • float [rotationNum] [rowNum] [cellNum] . , ArrayLists, . , , , . .
+1

, ( ..), ? ArrayLists , , . , , ..

- , , , , .

, , , .

, , ArrayLists, , . , , .

+2
  • DataInputStream ( readFloat()), FileInputStream, , e BufferedInputStream (, ).
  • .
+2

- / ?

, , , - float [] [] .

+1

, float[][][] ( , ). , float[][][], - (960), - (16), - (1344): if , : .

+1

80 , . :

  • Java, / , ;
  • , , "" - ( InputStream.read() ) 16K . 16K/32K, ByteBuffer , ;
  • , , , .
0

, , , , , , .

0
source

All Articles