I have the below code:
vtkSmartPointer<vtkDICOMImageReader> readerA =vtkSmartPointer<vtkDICOMImageReader>::New();
readerA->SetDirectoryName("sr1");
readerA->Update();
vtkSmartPointer<vtkDICOMImageReader> readerB=vtkSmartPointer<vtkDICOMImageReader>::New();
readerB->SetDirectoryName("sr2");
readerB->Update();
vtkSmartPointer<vtkImageMathematics> math =vtkSmartPointer<vtkImageMathematics>::New();
math->SetOperationToSubtract();
math->SetInput1Data(readerA->GetOutput());
math->SetInput2Data(readerB->GetOutput());
math->Update();
I am reading two directories and subtracting the images.Now i need to write the subtracted images in series form in .dcm
format and store it in a folder. vtkDicomWriter
is not supported in vtk7.1. I am currently trying with vtkImageWriter
What should i do?.
EDIT:
I tried it with vtkimagewriter
but i cannot write those images in .dcm
format.
The shortest way to write .dcm file is to use this library: https://github.com/dgobbi/vtk-dicom, using vtkDICOMWriter. You can find a sample here: https://github.com/dgobbi/vtk-dicom/blob/master/Examples/TestDICOMWriter.cxx