Dear all,
I want to do 3d segmentation of an especific vessel but i am having a lot of problems with memory with the 3d filters as this vessels has no contrast at all and i do not have any prior info only intensities and I have decided to do it in 2d. I read a series of dicoms and I am trying to collapse the x dimension because it is the view where i can see much better the vessel. I check the dimensions and they are correct [numberslice,589,180] and i copy the result in a 2d dicom and I see that the result doesn´t show what it is expect. It is as if the image was twisted when it reads the series and then when i read the matrix (volume) through x, the results does not have anything to do with the view i want to see.
Any help?. Thanks
// Find input image size
InputImageType::RegionType inputRegion =
reader->GetOutput()->GetLargestPossibleRegion();
InputImageType::SizeType size = inputRegion.GetSize();
const unsigned int collapseDim = 0;
InputImageType::SizeType::SizeValueType numSlices = size[collapseDim];
size[collapseDim] = 0; // collapse dimension ( 3D->2D )
// Set region for 2D extraction
InputImageType::IndexType start = inputRegion.GetIndex();
InputImageType::RegionType desiredRegion;
desiredRegion.SetSize(size);
// Extract 2D slices, perform processing
for (unsigned int sliceNumber = 0; sliceNumber<numSlices; sliceNumber++)
{
start[collapseDim] = sliceNumber;
desiredRegion.SetIndex(start);
extractFilter->SetExtractionRegion(desiredRegion);
using PixelType = short;
constexpr unsigned int Dimension = 2;
using ImageType = itk::Image< PixelType, Dimension >;
using WriterType = itk::ImageFileWriter< ImageType >;
WriterType::Pointer writer = WriterType::New();
std::string index = std::to_string(sliceNumber);
std::string fileoutput = "results" + index + ".dcm";
writer->SetFileName(fileoutput);
writer->SetInput(extractFilter->GetOutput());
try
{
writer->Update();
}
catch (itk::ExceptionObject & err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return EXIT_FAILURE;
}
}