Create 3D Volume from 2D DICOM Images

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Create 3D Volume from 2D DICOM Images

emreturkoz
I have a series of DICOM images, approximately 150, starting from I10 to around I1500 with 10 increments. I don't know whether the increment between the filenames are important but I write them also for any case.

I want to make the 3d model of the organ that these DICOM images represent for my research. I checked the example given by Mark here but I couldn't make it work.

I applied the two examples on vtk wiki page, but none of them gave me the 3D model from DICOM images. The examples I tried:
IO/ReadDICOM
IO/ReadDICOMSeries

I appreciate any help.

Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
I don't understand what you want to do. Unless you segment a volume form the CT images or have a set of contours defining the organ you can't create a 3D model of the organ.

Jothy

On Mon, Aug 1, 2011 at 9:09 PM, emreturkoz <[hidden email]> wrote:
I have a series of DICOM images, approximately 150, starting from I10 to
around I1500 with 10 increments. I don't know whether the increment between
the filenames are important but I write them also for any case.

I want to make the 3d model of the organ that these DICOM images represent
for my research. I checked the example given by Mark
http://devsample.org/index.php?option=com_content&task=view&id=18&Itemid=1
here  but I couldn't make it work.

I applied the two examples on vtk wiki page, but none of them gave me the 3D
model from DICOM images. The examples I tried:
IO/ReadDICOM
IO/ReadDICOMSeries

I appreciate any help.

Thank you very much.


--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4656536.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
Thank you Jothy for your answer.

I though the DICOM images and label descriptions are enough to create a 3D model. DICOM images are those of a brain coming out from a CTscan. They are stuffed into a folder with label describtion and sent to me to make a 3d model out of it.

What information do I need more exactly?

Thanks again,
Emre.
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
What do you mean by "label descriptions". In what format it is in?

Jothy

On Tue, Aug 2, 2011 at 9:50 AM, emreturkoz <[hidden email]> wrote:
Thank you Jothy for your answer.

I though the DICOM images and label descriptions are enough to create a 3D
model. DICOM images are those of a brain coming out from a CTscan. They are
stuffed into a folder with label describtion and sent to me to make a 3d
model out of it.

What information do I need more exactly?

Thanks again,
Emre.

--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658013.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
It has no format (seriously). But when I open it with text editor, I see this:

################################################
# ITK-SnAP Label Description File
# File format:
# IDX   -R-  -G-  -B-  -A--  VIS MSH  LABEL
# Fields:
#    IDX:   Zero-based index
#    -R-:   Red color component (0..255)
#    -G-:   Green color component (0..255)
#    -B-:   Blue color component (0..255)
#    -A-:   Label transparency (0.00 .. 1.00)
#    VIS:   Label visibility (0 or 1)
#    IDX:   Label mesh visibility (0 or 1)
#  LABEL:   Label description
################################################
    0     0    0    0        0  0  0    "Clear Label"
    1   255    0    0        1  1  1    "Label 1"
    2     0  255    0        1  1  1    "Label 2"
    3     0    0  255        1  1  1    "Label 3"
    4   255  255    0        1  1  1    "Label 4"
    5     0  255  255        1  1  1    "Label 5"
    6   255    0  255        1  1  1    "Label 6"



And there is also a *.wrl file (VRML file) included in which the coordinates are written.
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
Then try vtkVRMLImporter.

Have a look at this post

http://vtk.1045678.n5.nabble.com/Help-on-reading-VRML-file-td1247802.html

 and

http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/VRML

Jothy

On Tue, Aug 2, 2011 at 10:15 AM, emreturkoz <[hidden email]> wrote:
It has no format (seriously). But when I open it with text editor, I see
this:

################################################
# ITK-SnAP Label Description File
# File format:
# IDX   -R-  -G-  -B-  -A--  VIS MSH  LABEL
# Fields:
#    IDX:   Zero-based index
#    -R-:   Red color component (0..255)
#    -G-:   Green color component (0..255)
#    -B-:   Blue color component (0..255)
#    -A-:   Label transparency (0.00 .. 1.00)
#    VIS:   Label visibility (0 or 1)
#    IDX:   Label mesh visibility (0 or 1)
#  LABEL:   Label description
################################################
   0     0    0    0        0  0  0    "Clear Label"
   1   255    0    0        1  1  1    "Label 1"
   2     0  255    0        1  1  1    "Label 2"
   3     0    0  255        1  1  1    "Label 3"
   4   255  255    0        1  1  1    "Label 4"
   5     0  255  255        1  1  1    "Label 5"
   6   255    0  255        1  1  1    "Label 6"



And there is also a *.wrl file (VRML file) included in which the coordinates
are written.

--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658067.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
This post was updated on .
Thank you. I tried that but another problem came out.

I could visualize the bridge in the example with the sample code given, but I couldn't manage to visualize my own *.wrl file. But through paraView I'm also able to visualize my scan.

Scan

But the code that can generate the bridge, can't visualize that one. Do I have to add anything to the code given? I need to be able to visualize this outside of the paraView.

edit: By saying "can't" visualize, I mean a window pops-up with coordinate axes on it but the structure can't be seen.
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
Can you post your code and the actual error/problem you get when executing that.

Jothy

On Tue, Aug 2, 2011 at 11:32 AM, emreturkoz <[hidden email]> wrote:
Thank you. I tried that but another problem came out.

I could visualize the bridge in the example with the sample code given, but
I couldn't manage to visualize my own *.wrl file. But through paraView I'm
also able to visualize my scan.

http://vtk.1045678.n5.nabble.com/file/n4658253/scan.png

But the code that can generate the
http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/VRML bridge , can't visualize
that one. Do I have to add anything to the code given? I need to be able to
visualize this outside of the paraView.

--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658253.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
Jothy thank you very much for your help. You made me a great progress.

I also noticed something. With the code I give below, I can visualize samples (like fish.wrl), which can be seen so to say in "mesh form". There was an example on this link called red_chair, where a chair to be seen completely. The code below also failed to visualize this example.

I get no errors. I only get a blank window as if no actor is loaded. But paraView doesn't fail on these samples.

Thank you for your help.

int VRMLReader(){

  std::string filename = "fish.wrl";
  std::cout << "Reading " << filename << std::endl;
// VRML Import
vtkVRMLImporter *importer=vtkVRMLImporter::New();
importer->SetFileName(filename.c_str());
importer->Read();
importer->Update();
 
//Convert to vtkDataSet
vtkDataSet *pDataset;
vtkActorCollection *actors = importer->GetRenderer()->GetActors();
actors->InitTraversal();
pDataset = actors->GetNextActor()->GetMapper()->GetInput(); //Problem happened here
 
//Convert to vtkPolyData
vtkPolyData *polyData = vtkPolyData::SafeDownCast(pDataset);
polyData->Update();
 

// Create Normal Vectors to enhance smoothness & illumination
vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
normals->SetInput(polyData);
normals->SetFeatureAngle(60.0);
 
// Mapper
vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New();
SolidMapper->SetInput(normals->GetOutput());
SolidMapper->ScalarVisibilityOff();
 
// Actor
vtkActor *SolidActor = vtkActor::New();
SolidActor->SetMapper(SolidMapper);
//SolidActor->GetProperty()->SetOpacity(1);
 
// Render
vtkRenderer *ren = vtkRenderer::New();
ren->AddActor(SolidActor);
ren->SetBackground(0.1,0.3,0.1);
 
// RenderWindow
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);
 
// RenderWindowInteractor
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
 
renWin->Start();
renWin->SetSize(800-5,600-5);
// interact with data
iren->Initialize();
iren->Start();
 
// delete
 
actors->Delete();
normals->Delete();
SolidMapper->Delete();
SolidActor->Delete();
ren->Delete();
renWin->Delete();
iren->Delete();
 
return 0;
       
}
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
vtkVRMLImporter seems to import only VRML 2.0 files. Check your VRML version.

Jothy

On Tue, Aug 2, 2011 at 1:01 PM, emreturkoz <[hidden email]> wrote:
Jothy thank you very much for your help. You made me a great progress.

I also noticed something. With the code I give below, I can visualize
samples (like fish.wrl), which can be seen so to say in "mesh form". There
was an example on this
http://people.sc.fsu.edu/~jburkardt/data/wrl_2/wrl_2.html link  called
red_chair, where a chair to be seen completely. The code below also failed
to visualize this example.

I get no errors. I only get a blank window as if no actor is loaded. But
paraView doesn't fail on these samples.

Thank you for your help.

int VRMLReader(){

 std::string filename = "fish.wrl";
 std::cout << "Reading " << filename << std::endl;
// VRML Import
vtkVRMLImporter *importer=vtkVRMLImporter::New();
importer->SetFileName(filename.c_str());
importer->Read();
importer->Update();

//Convert to vtkDataSet
vtkDataSet *pDataset;
vtkActorCollection *actors = importer->GetRenderer()->GetActors();
actors->InitTraversal();
pDataset = actors->GetNextActor()->GetMapper()->GetInput(); //Problem
happened here

//Convert to vtkPolyData
vtkPolyData *polyData = vtkPolyData::SafeDownCast(pDataset);
polyData->Update();


// Create Normal Vectors to enhance smoothness & illumination
vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
normals->SetInput(polyData);
normals->SetFeatureAngle(60.0);

// Mapper
vtkPolyDataMapper *SolidMapper = vtkPolyDataMapper::New();
SolidMapper->SetInput(normals->GetOutput());
SolidMapper->ScalarVisibilityOff();

// Actor
vtkActor *SolidActor = vtkActor::New();
SolidActor->SetMapper(SolidMapper);
//SolidActor->GetProperty()->SetOpacity(1);

// Render
vtkRenderer *ren = vtkRenderer::New();
ren->AddActor(SolidActor);
ren->SetBackground(0.1,0.3,0.1);

// RenderWindow
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);

// RenderWindowInteractor
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

renWin->Start();
renWin->SetSize(800-5,600-5);
// interact with data
iren->Initialize();
iren->Start();

// delete

actors->Delete();
normals->Delete();
SolidMapper->Delete();
SolidActor->Delete();
ren->Delete();
renWin->Delete();
iren->Delete();

return 0;

}

--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658425.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
Yeah, but my file is also has the version  "#VRML V2.0 utf8". So the problem must be sth else..
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

Jothy
You are not calling
renderWindow->Render();

in your code

Jothy


On Tue, Aug 2, 2011 at 1:15 PM, emreturkoz <[hidden email]> wrote:
Yeah, but my file is also has the version  "#VRML V2.0 utf8". So the problem
must be sth else..

--
View this message in context: http://vtk.1045678.n5.nabble.com/Create-3D-Volume-from-2D-DICOM-Images-tp4656536p4658469.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
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


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Create 3D Volume from 2D DICOM Images

emreturkoz
i actually do:
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

so when I sat iren->Start it does the job. But I tried what you say anyway, and it unfortunately didn't work out.

it's like paraview is much more advanced and has some abilities that we don't have here to visualize VRML files..