Message Boards Message Boards

GROUPS:

Process a .bin file from a C++ program?

Posted 1 year ago
2216 Views
|
2 Replies
|
2 Total Likes
|

I need help to open and graphic a 3d matrix from an C++ output file. This is open in Matlab, but can not open from Mathematica. can anyone give me a help on this. A sample of the file is found here. https://github.com/jecalderon/Tissue_Model_2019/blob/master/skinvessel_F.bin

This matrix is compose of the 3 coordinate locations and the fourth data for the intensity. I trying to construct a density 3D plot from this data. The information that I have is that this is a 150x150x150 8 bit unsigned integers.

2 Replies
Posted 1 year ago

I don't really know if this is what you are looking for. I think you would need to have some idea about what format the data are stored in.

In[23]:= stream = 
 OpenRead["~/Downloads/skinvessel_F.bin", "BinaryFormat" -> True]

In[24]:= data = BinaryReadList[stream, "Real64"];

In[25]:= Length@data

Out[25]= 4000000

but the data doesn't look right,

In[27]:= Partition[data, 4][[;; 5]]

Out[27]= {{7.53462*10^12, 0.387341, 3.18711*10^13, 
  3.53061*10^13}, {4.21261*10^12, 3.52798*10^10, 5.43781217*10^-315, 
  8.49333*10^9}, {399.019, 3.83559*10^10, 3.07557*10^8, 
  3.78863*10^12}, {1.97246*10^8, 2.4602*10^13, 4.28114*10^13, 
  1.73976*10^14}, {1.23685*10^15, 3.48269*10^14, 5.48375828*10^-315, 
  6.40988*10^11}}
Posted 17 days ago

Hello.. yes.looks ok.. The set of 4 elements. First 3 are the spatial references, the forth the density. But I am not sure hot to plot a 3D Density using this set of data. Any help

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract