MantisBT - ITK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0008681 | ITK | public | 2009-03-06 09:41 | 2009-11-12 10:45 | |
| Reporter | Bradley Lowekamp | ||||
| Assigned To | Bradley Lowekamp | ||||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ITK-3-14 | |||
| Resolution Date | |||||
| Sprint | |||||
| Sprint Status | |||||
| Summary | 0008681: ImageSource lacks type safety for multiple outputs of different types | ||||
| Description | I was looking at ImageSource and noticed some problems when the filters have different outputs. As this lack of type safety can cause segfaults and pointers to the wrong type I think they are bugs. The problem is with the following two methods: typename ImageSource<TOutputImage>::OutputImageType * ImageSource<TOutputImage> ::GetOutput(unsigned int idx) { return static_cast<TOutputImage*> (this->ProcessObject::GetOutput(idx)); } ImageSource<TOutputImage> ::AllocateOutputs() { OutputImagePointer outputPtr; // Allocate the output memory for (unsigned int i=0; i < this->GetNumberOfOutputs(); i++) { outputPtr = this->GetOutput(i); outputPtr->SetBufferedRegion(outputPtr->GetRequestedRegion()); outputPtr->Allocate(); } } GraphNthOutput has a minor issue too. I see a real problem with this implementation of AllocateOutputs. In that outputPtr may not be of the type we have a pointer to. In the case of BayesianClassifierImageFilter using this parent method causes a segfault. I see two solutions two this based on what is done in ImageSource and ImageToImageFilter. Perform a dynamic_cast and do nothing if the cast fails. Or we could case to ImageBase, but that is currently problematic since Allocate, is not a virtual method in ImageBase. In GetOutput, a dynamic_cast could be used as well. I ran a couple of experimentals on choptank.nlm yesterday with and with out a dynamic_cast there: http://www.cdash.org/CDash/buildSummary.php?buildid=282934 [^] http://www.cdash.org/CDash/buildSummary.php?buildid=282954 [^] From the dash board there appears no significant performance difference. But there are 4 new tests that are failing. I only looked at itkContourDirectedMeanDistanceImageFilterTest, and there is clearly a problem in it's Allocate method. I would think that there are bugs in the other classes as well. | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2009-03-06 09:41 | Bradley Lowekamp | New Issue | |||
| 2009-03-06 09:44 | Bradley Lowekamp | Note Added: 0015590 | |||
| 2009-03-06 15:20 | Bradley Lowekamp | Status | new => assigned | ||
| 2009-03-06 15:20 | Bradley Lowekamp | Assigned To | => Bradley Lowekamp | ||
| 2009-03-06 15:22 | Bradley Lowekamp | Note Added: 0015593 | |||
| 2009-03-06 15:22 | Bradley Lowekamp | Status | assigned => confirmed | ||
| 2009-03-13 10:34 | Bradley Lowekamp | Note Added: 0015680 | |||
| 2009-03-17 10:04 | Bradley Lowekamp | Note Added: 0015712 | |||
| 2009-03-17 10:04 | Bradley Lowekamp | Status | confirmed => resolved | ||
| 2009-03-17 10:04 | Bradley Lowekamp | Resolution | open => fixed | ||
| 2009-11-12 10:45 | Bradley Lowekamp | Status | resolved => closed | ||
| 2009-11-12 10:45 | Bradley Lowekamp | Fixed in Version | => ITK-3-14 | ||