File Exchange

image thumbnail

decodeOBJ v2: Analyze Object Maps Reader v2

version (2.11 KB) by David Johnson
decodeOBJ v2 reads Mayo Clinic Analyze 6.0 ROI Object Map format (*.OBJ) files with more header fiel

1 Download

Updated 23 Apr 2007

No License

decodeOBJ reads Mayo Clinic Analyze 6.0 ROI Object Map format (*.OBJ) files. This is version 2, which can read more fields than version 1.

Please see version 1 for usage.

Thank you to those of you who sent me comments. I am sorry that I am too busy to respond to all of you. I do not provide support or maintenance for this code. I cannot fix your data, so don't email it to me.

Please don't sue me for writing this simple file utility which does not hurt sales of Analyze. I have not used the Analyze developers kit in any way.

You may also be interested in encodeOBJ, which is available on this website. encodeOBJ writes Analyze 6.0 ROI Object Map format (*.OBJ) from matlab data structures.

(C) Copyright Jan 11, 2006, David Johnson <monorail at>

(C) Copyright Apr 20, 2007, David Johnson <monorail at>

Rights to "rude: a pedestrian run-length decoder-encoder" remain the property of their respective owner(s).

Cite As

David Johnson (2021). decodeOBJ v2: Analyze Object Maps Reader v2 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)


Thank you very much for the script.
I am still working on it, but so far it seems to run without error after a small change to the code:
It seems that the current Analyze version (12.0) has added another 32 bit value at the end of the fileheader.
Therefore, change line 37 to:
fileheader=fread(fid,6,'uint32=>uint32','ieee-be'); %6 uint32 instead of 5

Line 87 has to be changed accordingly to reflect the 4 additional bytes in the header:
fseek(fid,24+double(numObjects)*152,'bof'); % 24 bytes instead of 20


Thank you very much for your work.It took me a long time to find such a function.
But when I used decodeOBJ to reads Analyze Pro ROI Object Map format (*.OBJ) files the decodeOBJ gets an error saying:
??? Error using ==> reshape
To RESHAPE the number of elements
must not change.

It seems like that the size of decoded RLE data does not match the size of matrix.How can I fixed this problem?

BTW,The website was not available. It may be removed to other places.Where can I find the latest site?

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!