Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dicom to stl Conversion #issue #3

Closed
Sachingit1389 opened this issue Apr 23, 2018 · 7 comments
Closed

Dicom to stl Conversion #issue #3

Sachingit1389 opened this issue Apr 23, 2018 · 7 comments

Comments

@Sachingit1389
Copy link

Thank you so much for making dicom2stl.py
but i got some issues guys please help me solve this error
How to solve this error ? Not getting whats going wrong?Why this AttributeError is coming?

C:\Users\Admin\Desktop\sachin>python C:\Users\Admin\Desktop\sachin\dicom2stl.py dicom.zip
Temp dir: C:\Users\Admin\AppData\Local\Temp\tmpknar9hfu
Isovalue = 0
File names: ['dicom.zip']

Reading Dicom zip file: dicom.zip
1.76.380.18.10.5944.11594.2.1 C:\Users\Admin\AppData\Local\Temp\tmpknar9hfu\Dicomm 483

Loading series 1.76.380.18.10.5944.11594.2.1 in directory C:\Users\Admin\AppData\Local\Temp\tmpknar9hfu\Dicomm
Shrink factors: [2, 2, 2]
(498, 484, 483) -> (249, 242, 241)
0.093 seconds
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\sachin\dicom2stl.py", line 398, in
import sitk2vtk
File "C:\Users\Admin\Desktop\sachin\sitk2vtk.py", line 22, in
pixelmap = { sitk.sitkUInt8: vtk.VTK_UNSIGNED_CHAR, sitk.sitkInt8: vtk.VTK_CHAR,
AttributeError: 'module' object has no attribute 'VTK_UNSIGNED_CHAR'

Why this AttributeError is coming?

@dave3d
Copy link
Owner

dave3d commented Apr 23, 2018

It doesn't look like it's finding the type vtk.VTK_UNSIGNED_CHAR from the vtk package. What version of vtkpython are you using?

@Sachingit1389
Copy link
Author

Have solved the problem. Actually i was not able to get proper vtk . Then i installed anaconda python . and used pip install vtk as it has its own vtk.

@Sachingit1389
Copy link
Author

But now i have issue with the bone ,tissues , etc. extraction
Not able to use: vtkpython dicom2stl.py -t bone -o bone.stl dicom.zip
in place of vtkpython i am using vtk.
But again and again : 'vtk' is not recognized as an internal or external command,
operable program or batch file. i have also set the vtk in environmental variables.

To extract the bone from a zip of dicom images:

vtkpython dicom2stl.py -t bone -o bone.stl dicom.zip

To extract the skin from a NRRD volume:

vtkpython dicom2stl.py -t skin -o skin.stl volume.nrrd

To extract a specific iso-value from a VTK volume:

vtkpython dicom2stl.py -t 128 -o iso.stl volume.vtk

To extract soft tissue from a dicom series in directory and
apply a 180 degree Y axis rotation:

vtkpython dicom2stl.py --enable rotation -t soft_tissue -o soft.stl dicom_dir

and is bone.stl , skin.stl, iso.stl, soft.stl gone be created in the file?

and how to solve this :'vtk' is not recognized as an internal or external command,
operable program or batch file. i have also set the vtk in environmental variables.

@Sachingit1389
Copy link
Author

I am using vtk 8.1 which is available through anaconda3

@Sachingit1389
Copy link
Author

Sir thank you so much for such a brilliant file. Solved the problem related to vtkpython by installing through conda install -c anaconda vtk then doing pip install vtk.
But sir how can we change the smoothness through command line?

@Sachingit1389
Copy link
Author

Now i am able to get bone, skin, iso, softtsissues. But sir how can we change the smoothness through command line?

@dave3d
Copy link
Owner

dave3d commented Apr 24, 2018

I can add a smoothness parameter to the command line.

Update: I've added a '--smooth' command line options to allow you to set the number of iterations of the Laplacian smoothing filter applied to the extracted mesh.

@dave3d dave3d closed this as completed Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants