eidelen / DicomToMesh

A command line tool to transform a DICOM volume into a 3d surface mesh (obj, stl or ply). Several mesh processing routines can be enabled, such as mesh reduction, smoothing or cleaning. Works on Linux, OSX and Windows.
MIT License
451 stars 93 forks source link

vtkMarchingCubes: Cannot contour data of dimension != 3 #13

Closed b5686109 closed 5 years ago

b5686109 commented 6 years ago

I'm trying to process tomography of some guy's leg into editable stl model. Here's what I got:

$ dicom2mesh -i ~/DICOM/ST00001/SE00001 -o leg.stl

Dicom2Mesh Settings
-------------------
Input directory: /home/username/DICOM/ST00001/SE00001
Output file path: leg.stl
Surface segmentation: 400
Mesh reduction: disabled
Mesh polygon limitation: disabled
Mesh smoothing: disabled
Mesh centering: disabled
Mesh filtering: disabled
Volume cropping: disabled

Read DICOM images located under /home/username/DICOM/ST00001/SE00001
Progress: done

Create surface mesh with iso value = 400
Progress: 0.0%ERROR: In /tmp/portage/sci-libs/vtk-8.1.0-r2/work/VTK-8.1.0/Filters/Core/vtkMarchingCubes.cxx, line 417
vtkMarchingCubes (0x55793316cdc0): Cannot contour data of dimension != 3

Progress: done

No mesh could be created. Wrong DICOM or wrong iso value
  1. I'm pretty sure that my DICOM file is not THAT wrong because dcm2pnm from DCMTK managed to extract layered images of leg from that DICOM file I've got. They look neat btw.
  2. I'm not familiar with those DICOM or VTK things at all, so all I could do is just insert debug output for imageData->GetDataDimension() and it gave me 2.
  3. Unfortunately, that DICOM file is about 700MB so it may be not a good idea to attach it here, though I can come up with something if it's not an obvious single-line bug but rather something that requires research.
eidelen commented 6 years ago

It is well possible that the standard vtk DICOM reader is not able to handle your DICOM format. For example, multiple series DICOM work neither.
You have the possibility to build Dicom2Mesh with an extended DICOM format support. In the cmake, enable the flag USE_VTK_DICOM. The corresponding library can be cloned from https://github.com/dgobbi/vtk-dicom. This is mentioned in the readme file too. Please let me know if that works. If it is fine for the leg owner, I can also look into the data :) Could you place them somewhere for downloading?

eidelen commented 5 years ago

Hi, If it is still of interest to you, it might be good to build vtk-dicom with using gdcm. It is described here.