here's a bit of example code you can use.<br>It opens dicom images and saves it to metaImage.<br><br>greets, Michael<br><br><br><h3 align="left">
<span dir="ltr">OpenDicomSaveMetaImage</span>
</h3>
Open dicom images and convert to metaImage: a filetype that is supported by both ITK and VTK<br><br>
usage: ./DICOMSeries /path/to/your/dicomimages outputFileName.hdr<br><br><b><font size="3"><span style="color: rgb(159, 197, 232);">DICOMSeries.cxx</span></font></b><br><br>#include <vtkCellArray.h><br>#include <vtkCellData.h><br>
#include <vtkPolyData.h><br>#include <vtkImageData.h><br>#include <vtkSmartPointer.h><br>#include <vtkDICOMImageReader.h><br>#include <vtkXMLImageDataWriter.h><br>#include <vtkMetaImageWriter.h><br>
<br>int main(int argc, char *argv[])<br>{<br> if(argc != 3)<br> {<br> vtkstd::cout << "Required arguments: Folder containing .dcm files and also name of OutputFile" << vtkstd::endl;<br> }<br>
vtkstd::string folder = argv[1];<br> vtkstd::string outputFile = argv[2];<br> <br> // Read all the DICOM files in the specified directory.<br> vtkSmartPointer<<div id=":111" class="ii gt">vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New();<br>
reader->SetDirectoryName(folder.c_str());<br> reader->Update();<br> <br> vtkImageData* imagedata = reader->GetOutput();<br> vtkSmartPointer<vtkMetaImageWriter> metaImageWriter = vtkSmartPointer<vtkMetaImageWriter>::New();<br>
metaImageWriter->SetInput(imagedata);<br> metaImageWriter->SetFileName(outputFile.c_str());<br> metaImageWriter->Update();<br> <br> return 0;<br>}<h2 style="color: rgb(159, 197, 232);"><a name="12631c4f5c8abe4b_TOC-CMakeLists.txt"></a> <span>CMakeLists.txt</span></h2>
<pre>cmake_minimum_required(VERSION 2.6)<br> PROJECT(DICOMSeries)<br> FIND_PACKAGE(VTK REQUIRED)<br>INCLUDE(${VTK_USE_FILE})<br> ADD_EXECUTABLE(DICOMSeries DICOMSeries.cxx)<br>TARGET_LINK_LIBRARIES(DICOMSeries vtkHybrid)<br>
<br><br><font size="5"><b><font style="color: rgb(159, 197, 232);">sources:</font></b></font><br><a href="http://www.cmake.org/Wiki/Convert_a_series_of_DICOM_files_into_a_VTI_File" target="_blank">http://www.cmake.org/Wiki/Convert_a_series_of_DICOM_files_into_a_VTI_File</a><br>
<br><span><span><cite><a href="http://www.incdmf.ro/editura/documente/art332.pdf" target="_blank">www.incdmf.ro/editura/documente/art332.pdf</a></cite></span></span><br><a href="http://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html</a></pre>
<div><div><span id="q_12631d758e4fb3cf_1" class="h4">- Show quoted text -</span></div></div></div><br><br><div class="gmail_quote">On Thu, Jan 14, 2010 at 7:16 PM, Reno Genest <span dir="ltr"><<a href="mailto:rgenest@uwaterloo.ca">rgenest@uwaterloo.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
I am new to VTK and I would like to know if the VTK software is good to import photographs representing slices of an eye and construct a 3D model. We froze an eye with CO2 and sliced it using a microtome and took pictures at regular intervals using a standard digital camera. Can we import images, trace the contour of the eye in each image (slice), tell the software the distance or thickness between each slice and construct a 3D model? I will need to align the slices because the digital camera moved a little. As far as input/output files goes, we should be okay with .jpg and .obj and .stl. How much programming is involved? Can I do most of this work using paraview?<br>
<br>
Thank you.<br>
<br>
Reno.<br>
<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>