MantisBT - ITK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0010398 | ITK | public | 2010-03-09 23:39 | 2010-10-25 16:17 | |
| Reporter | Rohit Saboo | ||||
| Assigned To | Gaetan Lehmann | ||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | assigned | Resolution | open | ||
| Platform | OS | OS Version | |||
| Product Version | ITK-3-16 | ||||
| Target Version | Fixed in Version | ||||
| Resolution Date | |||||
| Sprint | |||||
| Sprint Status | |||||
| Summary | 0010398: At least one of ErodeObjectMorphologyImageFilter and DilateObjectMorphologyImageFilter not behaving as expected | ||||
| Description | A closed image should contain the original image. However the result of applying DilateObjectMorphologyImageFilter followed by ErodeObjectMorphologyImageFilter results in an image which is shrunk compared to the original image. This error is not observed when one uses BinaryDilateImageFilter and BinaryErodeImageFilter I've uploaded a sample file and attached the code for a program that will read in an input file, perform the close, and save the result back. You can comment out and uncomment the appropriate lines to change the filter being used. You may call it with close_filter mandible.mha closed_mandible.mha 3 The error will be most clearly visible near axial slices 24 and 25 of the closed image. | ||||
| Steps To Reproduce | |||||
| Additional Information | #include <iostream> #include "itkImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkBinaryBallStructuringElement.h" #include "itkBinaryDilateImageFilter.h" #include "itkDilateObjectMorphologyImageFilter.h" #include "itkErodeObjectMorphologyImageFilter.h" #include "itkBinaryDilateImageFilter.h" #include "itkBinaryErodeImageFilter.h" using namespace std; int main(int argc, char* argv[]) { typedef unsigned short Pixel; typedef itk::Image<Pixel,3> ImageType; // Binary Morphology filters typedef itk::BinaryBallStructuringElement< Pixel, 3 > Kernel; typedef itk::DilateObjectMorphologyImageFilter<ImageType,ImageType,Kernel> Dilater; //typedef itk::BinaryDilateImageFilter<ImageType,ImageType,Kernel> Dilater; typedef itk::ErodeObjectMorphologyImageFilter<ImageType,ImageType,Kernel> Eroder; //typedef itk::BinaryErodeImageFilter<ImageType,ImageType,Kernel> Eroder; typedef itk::ImageFileReader<ImageType> Reader; typedef itk::ImageFileWriter<ImageType> Writer; if(argc != 4) { cerr << "Incorrect number of arguments" << endl << "Usage: close_filter <infile> <outfile> <radius (in voxels)>" << endl; return 1; } const char* infile = argv[1]; const char* outfile = argv[2]; const int radius = atoi(argv[3]); try { // Setup input cout << "Reading input file <" << infile << "> ... " << flush; Reader::Pointer reader = Reader::New(); reader->SetFileName(infile); reader->Update(); cout << "done" << endl; // Create the structuring element: cout << "Creating structuring element ... " << flush; Kernel ball; ball.SetRadius(radius); ball.CreateStructuringElement(); cout << "done" << endl; // Now do the close cout << "Dilating ... " << flush; Dilater::Pointer closeDilate = Dilater::New(); closeDilate->SetObjectValue(1); //closeDilate->SetForegroundValue(1); closeDilate->SetKernel(ball); closeDilate->SetInput(reader->GetOutput()); closeDilate->Update(); cout << "done" << endl; cout << "Eroding ... " << flush; Eroder::Pointer closeErode = Eroder::New(); closeErode->SetObjectValue(1); //closeErode->SetForegroundValue(1); closeErode->SetKernel(ball); closeErode->SetInput(closeDilate->GetOutput()); closeErode->Update(); cout << "done" << endl; // Now write the output cout << "Writing output file <" << outfile << "> ... " << flush; Writer::Pointer writer = Writer::New(); writer->SetFileName(outfile); writer->SetInput(closeErode->GetOutput()); writer->Update(); cout << "done" << endl; } catch (itk::ExceptionObject & exc) { // Show the error cerr << "Error processing image: " << exc.GetDescription () << endl; } return 0; } | ||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | https://public.kitware.com/Bug/file/2949/mandible.mha | ||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2010-03-09 23:39 | Rohit Saboo | New Issue | |||
| 2010-03-09 23:39 | Rohit Saboo | File Added: mandible.mha | |||
| 2010-10-25 16:17 | Gaetan Lehmann | Status | new => assigned | ||
| 2010-10-25 16:17 | Gaetan Lehmann | Assigned To | => Gaetan Lehmann | ||
| There are no notes attached to this issue. |