Click here to Skip to main content
16,004,727 members

Comments by rfrank5356 (Top 5 by date)

rfrank5356 12-Apr-11 19:37pm View    
This is looking promising - but I am running into a structure challenge - I am defining
Public Structure SpectralBands
Public SpectralValue() As UShort
End Structure
and I want the length to be 120 occurances to the spectral band.


Here is where I am at

Dim TotalFileLength As Long = 49184768


Using CubeData = MemoryMappedFile.CreateFromFile(InputImageName, FileMode.Open)
Using BandReader = CubeData.CreateViewAccessor(HeaderCharLength, 0)

Dim SpectralBand As UShort()
Dim i As Long = 0

Do While i < TotalFileLength
BandReader.Read(->> lost here
Loop
End Using

So I have a data structure and type problem - I'll hit this again in the am as I have one more project to solve today (aviation crab control software . . :))
rfrank5356 12-Apr-11 18:28pm View    
No -I didn't have to pay - but it still cost me as I have spun my wheels :)

The extra code is just to display progress - the final will reference a parameter file and look for cell values within a set range in particular bands in any row/column.

Looking at the MemoryMappedViewAccessor description - Back in a few
rfrank5356 12-Apr-11 16:32pm View    
The data will always be a single record file, and I plan to use dispose to free up memory after each read. The ultimate file sizes will be in the 100MB range, and I have a control file tht lists the files to be processed.
rfrank5356 12-Apr-11 16:30pm View    
Hi - I have a Imports System.IO statement which seems to make Streamreader visable. I suspect that the read to end might be the solution, but when I tried to implement it - I ran into problems defining the data. I thought a fixed length record would be a solution but ran into problems with initializing the aray, type conversions etc. Could you suggest a data structure that would work? Thanks
- bob
rfrank5356 12-Apr-11 16:24pm View    
Wow - that was a fast response - thanks -

I posted the wrong c code - here is the code from the hardware mfg

<pre lang="cs">integer*2 datacube[640][640][120] // array of two-byte integers (column, row, band)
byte dummy[32768);

fread(in, sizeof(byte), 32768, dummy)
for(int column=0;column<640;column++){
for(int band=0;band<120;band++){
for(int row=0;row<640;row++){
fread(in, sizeof(integer*2),1,datacube[row][column][band]);
}
}
}</pre>


I have looked at the interop and it looks like a complex process to implement.

More on the next post