Path: news.mathworks.com!not-for-mail
From: "Arvind " <ab835@georgetown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Creating an image from a binary mask file using RESHAPE
Date: Tue, 3 Nov 2009 19:33:03 +0000 (UTC)
Organization: Georgetown University
Lines: 21
Message-ID: <hcq0hf$r5g$1@fred.mathworks.com>
Reply-To: "Arvind " <ab835@georgetown.edu>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257276783 27824 172.30.248.38 (3 Nov 2009 19:33:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Nov 2009 19:33:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1971406
Xref: news.mathworks.com comp.soft-sys.matlab:582145


Hello superior MATLABers...

    My problem is in dealing with creating an image from a mask file (from drawing regions of interests- ROIs).  I successfully read the ROI image data from a 192x256x20 file (image is 192x256, with 20 slices) using fopen and fread; this dumps the values into a large 1 dimensional vector.  

    I attempt to reshape the data back into its 192x256x20 form by simply writing:
reshape(imagevector,192,256,20)
and my image looks the data is not lining up and is skewed (there should only be 4 shapes; further below I provide an image that's close to the ROI that I actually drew).  

Here's the output from the first line of code (looks like a mess):
http://img38.imageshack.us/i/rowsandcolumnscorrect.jpg/

  By accident, I accidentally wrote this previously (I swapped the rows and columns):
reshape(imagevector,256,192,20), and I get an image that has the shapes at least as solid objects, but the image is flipped on the y=-x axis (I guess that goes along with putting in wrong dimensions).   Here's what that image looks like:

(objects flipped around, but not looking like a total mess)
http://img266.imageshack.us/i/rowsandcolumnsflipped.jpg/

I'd appreciate any insight to what's going on!  I have a feeling I'd have to take a close look at how exactly how my image viewer is outputting its ROI image file...

Thanks!
-Arvind