- From: Paul Holcomb <paul.holcomb@gmail.com>
- To: DANIEL PFEIFFER-KELLY <dmp5444@psu.edu>, seg3d@sci.utah.edu
- Subject: Re: [Seg3D] FW: Smoothing Isosurfaces after Segmentation
- Date: Mon, 11 Apr 2016 00:07:58 +0000
Daniel,
We use MeshLab to do our isosurface postprocessing, and not only does it work very well, it's free. I would suggest using the boolean filters in Seg3D to ensure no initial overlap between your surfaces, and then export to vtk. Unfortunately, MeshLab doesn't support VTK, but one of my colleagues wrote a simple vtk2obj converter in Python, which I've included. Let me know if you have any questions.
On Sun, Apr 10, 2016 at 8:00 PM DANIEL PFEIFFER-KELLY <
dmp5444@psu.edu> wrote:
---------------- Forwarded Message ----------------
From:
"DANIEL PFEIFFER-KELLY" <
dmp5444@psu.edu>
Date: Sun, Apr 10, 2016
03:16 PM
Subject: Smoothing Isosurfaces after Segmentation
To:
seg3d@sci.utah.eduTo whom it may
concern,
Hello my name is Dan Pfeiffer-Kelly a
junior mechanical engineering student at Penn State University. I am currently
conducting biomechanics and imaging research with one of my professor's (Daniel
Cortes). After reading a blog regarding smoothing isosurfaces after
segmentation
(
https://lists.sci.utah.edu/sympa/arc/seg3d/2014-01/msg00002.html), I
wanted to ask a few questions. Any help would be greatly
appreciated!
The primary goal
of our research is to develop
a multi-scale model of the lower leg. I wont go into all the details,
but I have attached to this email a more in depth goals and objectives
page if you would like to read it over for any clarifications. Right now I am
attempting to segment and generate an isosurface for each muscle in the lower
leg. However each muscle must be smooth with no overlap between each
isosurface. The primary problem I have come across is I have neither been
unable to properly smooth the muscle isosurfaces nor know how to prevent the
smoothed surfaces from overlapping. I have tried a few different methods
including built in smoothing tools in Seg3D (smooth binary dilate/erode) and
exporting an STL file to SketchUp and editing it there. However, none of the
methods have produced the results I am looking for. I was wondering if you had
any advice? What would be the most practical method to smoothing isosurfaces
while still allowing the two surfaces to fit together without overlap or
significant gaps?
After reading over
the blog I mentioned above,
the software SCIRun came to my attention. However, I have been having
trouble uploading the isosurfaces to SCIRun and using the program in general. I
was wondering if you could please clarify how to upload the files to SCIRun and
smooth them there? I am unsure if it is just my macbook causing the problem. I
plan to try the software on my colleagues PC. I hope to hear back soon and
thanks so much for any incite.
Best,
Daniel
Pfeiffer-Kelly
DANIEL PFEIFFER-KELLY
_______________________________________________
Seg3d mailing list: Seg3d@sci.utah.edu
http://www.sci.utah.edu/software/seg3d.html
To unsubscribe, email sympa@lists.sci.utah.edu with the "unsubscribe seg3d" in the message body.
import glob
import os
import sys
import subprocess
def main(path):
l = path
polygons = []
pointsTrigger = 0
polygonTrigger = 0
with open(l) as f:
for lines in f:
jj = lines.strip()
jj = jj.split(' ')
#print jj
if jj[0] == 'POINTS':
pointsTrigger = 1
points = []
continue
if jj[0] == 'POLYGONS':
pointsTrigger = 0
polygonTrigger = 1
continue
if pointsTrigger == 1:
if len(jj) == 1:
continue
#print jj
try:
numStr = jj
except:
print jj
points.append(numStr)
continue
if polygonTrigger == 1:
try:
numStr = [str(int(i) + 1) for i in
jj[1:]]
polygons.append(numStr)
except:
continue
print len(points[-1])
f = open(path[:-4]+'.obj', 'w')
for each in points:
if len(each) == 0:
continue
f.write('v ' + ' '.join(each) +'\r\n')
f.write('\r\n')
f.write('g mesh \r\n')
for each in polygons:
f.write('f ' + ' '.join(each) + '\r\n')
f.write('g')
f.close
def batch(path):
e = glob.glob(path+'/*.vtk')
print e
for ii,l in enumerate(e):
print 'building OBJ for VTK ' + str(l) + ' ' + str(ii+1)+ '
out of ' + str(len(e)+1)
polygons = []
pointsTrigger = 0
polygonTrigger = 0
with open(l) as f:
for lines in f:
jj = lines.strip()
jj = jj.split(' ')
#print jj
if jj[0] == 'POINTS':
pointsTrigger = 1
points = []
continue
if jj[0] == 'POLYGONS':
pointsTrigger = 0
polygonTrigger = 1
continue
if pointsTrigger == 1:
if len(jj) == 1:
continue
#print jj
try:
numStr = jj
except:
print jj
points.append(numStr)
continue
if polygonTrigger == 1:
try:
numStr = [str(int(i) + 1) for
i in jj[1:]]
polygons.append(numStr)
except:
continue
print len(points[-1])
f = open(l[:-4]+'.obj', 'w')
for each in points:
if len(each) == 0:
continue
f.write('v ' + ' '.join(each) +'\r\n')
f.write('\r\n')
f.write('g mesh \r\n')
for each in polygons:
f.write('f ' + ' '.join(each) + '\r\n')
f.write('g')
f.close
if __name__ == "__main__":
if len(sys.argv) < 2:
print 'VTK2OBJ -- written by Michael Morehead for WVU Center
for Neuroscience'
print 'Usage: python vtk2obj [director || file] '
diry = False
path = sys.argv[1]
if os.path.isdir(path):
batch(path)
else:
main(path)
Archive powered by MHonArc 2.6.18.