[vtkusers] 2D photographs to 3D model.

michiel mentink michael.mentink at st-hughs.ox.ac.uk
Fri Jan 15 06:36:46 EST 2010


here's a bit of example code you can use.
It opens dicom images and saves it to metaImage.

greets, Michael


OpenDicomSaveMetaImage Open dicom images and convert to metaImage: a
filetype that is supported by both ITK and VTK

usage:  ./DICOMSeries /path/to/your/dicomimages outputFileName.hdr

*DICOMSeries.cxx*

#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkPolyData.h>
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
#include <vtkDICOMImageReader.h>
#include <vtkXMLImageDataWriter.h>
#include <vtkMetaImageWriter.h>

int main(int argc, char *argv[])
{
  if(argc != 3)
    {
    vtkstd::cout << "Required arguments: Folder containing .dcm files and
also name of OutputFile" << vtkstd::endl;
    }
  vtkstd::string folder = argv[1];
  vtkstd::string outputFile = argv[2];

  // Read all the DICOM files in the specified directory.
  vtkSmartPointer<
vtkDICOMImageReader> reader = vtkSmartPointer<vtkDICOMImageReader>::New();
  reader->SetDirectoryName(folder.c_str());
  reader->Update();

  vtkImageData* imagedata = reader->GetOutput();
  vtkSmartPointer<vtkMetaImageWriter> metaImageWriter =
vtkSmartPointer<vtkMetaImageWriter>::New();
  metaImageWriter->SetInput(imagedata);
  metaImageWriter->SetFileName(outputFile.c_str());
  metaImageWriter->Update();

  return 0;
} CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 PROJECT(DICOMSeries)
 FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 ADD_EXECUTABLE(DICOMSeries DICOMSeries.cxx)
TARGET_LINK_LIBRARIES(DICOMSeries vtkHybrid)


*sources:*
http://www.cmake.org/Wiki/Convert_a_series_of_DICOM_files_into_a_VTI_File

www.incdmf.ro/editura/documente/art332.pdf
http://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html

- Show quoted text -


On Thu, Jan 14, 2010 at 7:16 PM, Reno Genest <rgenest at uwaterloo.ca> wrote:

> Hello,
>
> 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?
>
> Thank you.
>
> Reno.
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100115/56c6965e/attachment.htm>


More information about the vtkusers mailing list