[vtkusers] save weighted sum image in .vtk format

shirani kannangara mangalika673 at gmail.com
Wed Jun 26 03:26:06 EDT 2013


Hi vtk users

I want to add two mesh models(eg. skin and liver).I have followed following
steps.

1. Generated mesh models of liver and skin by segmenting VHP (visible human
project) abdomen data set.

2 Then they were triangulated.(from paraview)

3  Then triangulated meshes were converted to binary  using
 itk::TriangleMeshToBinaryImageFilter. Then it was written to another file
 as .vtk format using   itk::ImageFileWriter<ImageType > WriterType;
codes are as follows.My program was properly built and could be able to
open the image(livertriangulated1.vtk").tThe same is done to the skin and
visualized well.
  imageWriter->SetInput(imageFilter->GetOutput() );
  imageWriter->SetFileName("D:\\binary1\\livertriangulated1.vtk");
  imageWriter->UseCompressionOn();
  imageWriter->Update();


4 Now What I want to add these two images, as my ultimate gall is to check
a point is inside/outside either organ models. I used  vtkImageWeightedSum
filter as follows to add the two images.

vtkSmartPointer<vtkImageWeightedSum> sumFilter =
    vtkSmartPointer<vtkImageWeightedSum>::New();
  sumFilter->SetWeight(0,.8);
  sumFilter->SetWeight(1,.2);
  sumFilter->AddInputConnection(reader1->GetOutputPort());
  sumFilter->AddInputConnection(reader2->GetOutputPort());

The sum was written to a separate file .vtk format as follows.

vtkSmartPointer<vtkImageWriter> writer =
      vtkSmartPointer<vtkImageWriter>::New();

 writer->SetInputConnection(summedCastFilter->GetOutputPort());
 writer->SetFileName("D:\\weightedsum1\\livskin.vtk");
 writer->Write();
 //writer->Update();
Program was built successfully and could be able to open the .exe file.It
shows several images of skin .But can't open the output image (
 liveskin.vtk).When I tried with ITK snap to open, it displayed  can't
recignize .I can't understand what I have missed.I am highly appreciated if
you could looking to this and make me correct.

Thanks in advance

regards
Shirani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130626/feb5b3da/attachment.htm>


More information about the vtkusers mailing list