Extracting iso-surface in n dimensional space

PK (view profile)

on 24 Mar 2018
Latest activity Edited by Ahmet Cecen

Ahmet Cecen (view profile)

on 25 Mar 2018
[f,v] = isosurface(X,Y,Z,V,isovalue) extracts the iso-surface of value 'isovalue' and vertices are stored in 'v'. Above function works only in 3-D space.But can some one let me know how to do the same for n-dimensional space. I have a 10-dimensional spaces and I need to extract the vertices of the iso-surface. Any help would be appreciated. Thanks

Answer by Ahmet Cecen

Ahmet Cecen (view profile)

on 25 Mar 2018
Edited by Ahmet Cecen

Ahmet Cecen (view profile)

on 25 Mar 2018

You can actually get a semi-accurate pixelized estimation of this very fast (O(nlogn)) regardless of dimensions using a mean filter (which assumes linear interpolation). I would prefer this especially if your 10D space is large and pixelized dimensions are not causing much of an error.
• Just make a filter of ones that has a 3x3x3x3x3.... (n-dimensions) and divide that by numel(filter).
• Use ffts or imfilter or something similar to run this filter over your image.
• Find the locations that have values near your isovalue. (TADA)
If you wanted to be more accurate, you can instead start by converting your entire n-d space into an adjacency matrix, and operate on a 2D graph instead. This will enable you to systematically locate actual coordinate intersects for the isosurface by traversing the graph only at the locations near the isovalue. O(n^2) ish

Answer by John D'Errico

John D'Errico (view profile)

on 25 Mar 2018

You won't do this easily. It would be a significant computational effort. No, there is no code that I know of (in the public domain) that would do this.
isosurface takes an array in 3 dimensions, then looks for places where the iso-level crosses through cells of the array.
Suppose you start with a 20x20x20 array, in 3-d. Much smaller than that, and the linear interpolation just won't be adequate.
But in 10 dimensions? How many cells are there in a 20^10 array?
19^10
ans =
6.1311e+12
So something like 6 trillion cells to investigate. Yes, you can do things where you chase the surface across the domain. Do some reading about marching cubes on line. The link will get you started. Regardless, in 10 dimensions, it will get complex, and still VERY time consuming.
A common way of doing the linear interpolation across a cell in R^n would be to dissect the n-cube into simplices. And, well, you will need to determine how the surface passes through a given hypercube. A simplicial dissection of the hypercube allows you to do exactly that.
In two dimensions, we would dissect a square into two triangles. In three dimensions, a unit cube gets dissected into 6 tetrahedra. In n-dimensions, we dissect a unit hypercube into factorial(n) simplexes.
factorial(10)
ans =
3628800
So this becomes a huge problem very fast, growing exponentially with dimension, because you will be chasing a surface through a lattice in 10 dimensions, and inside each hypercube of that lattice, you will need to chase the surface through hundreds of thousands of simplexes.
In fact, I played around with similar problems in lower dimensions. Typically I found that my code started to get bogged down when I went past 6 dimensions, and even an iso-surface on a 6-dimensional lattice that was only 8x8x8x8x8x8, so of size 8^6 was barely tractable. Yes, that was at least 15 years ago. I was unable to solve a similar problem in 7 dimensions at that time, but I was also uninterested in going as far as 10 dimensions then. Computers are faster now, so I might be able to go further now, and I have gained more experience in the area since. And maybe you are better at writing MATLAB code than I am.
Have fun.
{"ft_lang_label":"__label__en","ft_lang_prob":0.96073216,"math_prob":0.81145275,"size":2192,"snap":"2019-43-2019-47","text_gpt3_token_len":515,"char_repetition_ratio":0.12065814,"word_repetition_ratio":0.0,"special_character_ratio":0.22764598,"punctuation_ratio":0.11633109,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9748425,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-19T21:06:20Z\",\"WARC-Record-ID\":\"<urn:uuid:4e2aa190-3e0b-45d8-9c22-e513c8828ef5>\",\"Content-Length\":\"100554\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:23f06c7f-79f2-425b-b6d6-c8ea8333e31d>\",\"WARC-Concurrent-To\":\"<urn:uuid:b4e7baae-3c36-446e-adc9-9cbaa17790bf>\",\"WARC-IP-Address\":\"104.110.193.39\",\"WARC-Target-URI\":\"https://au.mathworks.com/matlabcentral/answers/390474-extracting-iso-surface-in-n-dimensional-space\",\"WARC-Payload-Digest\":\"sha1:ECQXLXROZWEVG5RKDA5MUS3JVQJXAAI6\",\"WARC-Block-Digest\":\"sha1:7UIG5TFEY55JEQS7TB4V47A4GFYTVDOQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570986697760.44_warc_CC-MAIN-20191019191828-20191019215328-00190.warc.gz\"}"}