Reading data from a custom file extension

1

I am trying to import raw data from an ultrasound system. When it saves the data I want to analyze, it creates a file with it's custom file extension. The systems wiki gives me all of the header data, and the data enumeration. The file extension is a .cvv which is created and used by the ultrasound software.

I know some MATLAB, Java and C++, but I have no idea how to open a custom file type by just using the header and an enumerated type. I'm guessing I have to write some sort of script which imports the data raw data from the file and then organizes it using the variables in the header and enumeration. I would prefer to do it in MATLAB, as I can easily create matrices with the data, but I am open to using the other two languages that I am familiar with.

Header info:

struct uFileHeader {
    int type;    // data type (can be determined by file extensions)
    int frames;  // number of frames in file 
    int w;       // width (number of vectors for raw, image width for processed data)
    int h;       // height (number of samples for raw, image height for processed data)
    int ss;      // data sample size in bits
    int ulx;     // roi - upper left (x) 
    int uly;     // roi - upper left (y) 
    int urx;     // roi - upper right (x) 
    int ury;     // roi - upper right (y) 
    int brx;     // roi - bottom right (x) 
    int bry;     // roi - bottom right (y) 
    int blx;     // roi - bottom left (x) 
    int bly;     // roi - bottom left (y) 
    int probe;   // probe identifier - additional probe information can be found using this id   
    int txf;     // transmit frequency in Hz
    int sf;      // sampling frequency in Hz
    int dr;      // data rate (fps or prp in Doppler modes)
    int ld;      // line density (can be used to calculate element spacing if pitch and native # elements is known
    int extra;   // extra information (ensemble for color RF)
};

enumeration:

enum uData
{
    udtScreen                = 0x00000001,
    udtBPre                  = 0x00000002,
    udtBPost                 = 0x00000004,
    udtBPost32               = 0x00000008,
    udtRF                    = 0x00000010,
    udtMPre                  = 0x00000020,
    udtMPost                 = 0x00000040,
    udtPWRF                  = 0x00000080,
    udtPWSpectrum            = 0x00000100,
    udtColorRF               = 0x00000200,
    udtColorCombined         = 0x00000400,
    udtColorVelocityVariance = 0x00000800,
    udtContrast              = 0x00001000,
    udtElastoCombined        = 0x00002000,
    udtElastoOverlay         = 0x00004000,
    udtElastoPre             = 0x00008000,
    udtECG                   = 0x00010000,
    udtGPS1                  = 0x00020000,
    udtGPS2                  = 0x00040000,
    udtPNG                   = 0x10000000
};

The full wiki page is here.

java
matlab
enums
file-type
asked on Stack Overflow Mar 22, 2014 by 8ofspades • edited Jun 28, 2014 by Sam

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0