Hi, I have a .RAW file that represent a 3d volume using pixels (its basically a 3d matrix containing 1 or 0 wherever there is or there isnt colume).' I am using multibandread() to read it and it works great but, multibandread requires the dimensions of the inpt (the 3 sizes of the3d matrix). how can i get these values from the file ? thanks, itzik
No products are associated with this question.
If there is no header on the file, then it is not possible to determine the dimensions just by looking at the file. If the size of the file happens to be a composite number that is the product of three primes then you can determine the dimensions but not the order of the dimensions.
hmmm... thats a great question. I dont really know. is there a way/test to run that i can figure out the format? do you know where i can find a source specifying these different formats ( i tried googling it but couldnt find something)
There is no standard raw. Anybody can do whatever they want. A common one is just simply a pixel dump and nothing else. Just pixel after pixel until all of them are there. But someone could have gone down rows then over columns, or vice versa. But those are possibly the two most common ways. If you can take a look at the data in hex (unfortunately MATLAB's editor is missing this very useful capability) then you might see a difference after about 6 or 12 bytes or so in the appearance of the numbers. If that's true, then it's possible the creator wrote the rows, columns, and number of slices as the first 3 numbers in the file.
OK so i figured out 2 ways to do this, they both seem to work (the files are always symetric to all sides) 1.
fileID=fopen(file); [A, count] = fread(fileID); m_hight=nthroot(count,3); m_width=nthroot(count,3); m_depth=nthroot(count,3);
VoxelMat= multibandread(file, m_hight,m_width,m_depth],'uint8',0,'bip','ieee-le');