Matlab to Osirix

The following shows how to export a 3D dataset from Matlab to Osirix:

  1. Make an "image" in matlab with im=zeros(384,256,64);
  2. Make some pixels gray: im(101:300,65:192,9:56)=16000;
  3. Make some pixels white: im(151:250,129:160,25:40)=32000;
  4. Open a data file: fip = fopen('osirixtestfile','w');
  5. Write the data: fwrite(fip,im,'uint16');
  6. Close the file: fclose(fip);

Now go into Osirix, and select File --> Import --> Import Raw Data
Find the file, and fill out the window as shown. Note the row/column ordering! (Click to enlarge picture).
rawimport.jpg
(Click to Enlarge)

At this point, note that you may have to try different endian (big/little) etc to get this to work just right!

After you import the data, you can find the images in your database, as shown below:

(Click to Enlarge)

Selecting 2D/3D viewer should pop up a nice viewer that makes all of this worthwhile, as shown below:


(Click to Enlarge)