[Insight-developers] Segmentation fault with Review/Statistics
Luis Ibanez
luis.ibanez at kitware.com
Fri Dec 11 17:52:56 EST 2009
Hi Greg,
Thanks for pointing this out.
There is however something strange about your finding.
0) What version of ITK are you using ?
1) The code in
Insight/Code/Review/Statistics/
itkScalarImageToHistogramGenerator.txx
is actually:
template < class TImage >
void
ScalarImageToHistogramGenerator< TImage >
::SetHistogramMin( RealPixelType minimumValue )
{
typedef typename GeneratorType::HistogramMeasurementVectorType
MeasurementVectorType;
MeasurementVectorType minVector;
minVector.SetLength(1);
minVector[0] = minimumValue;
m_HistogramGenerator->SetHistogramBinMinimum( minVector );
}
As you can see the Vector is resized in
minVector.SetLength(1);
2) What is the type that you are
using as MeasurementVectorType ?
3) Could you post a minimal code
example of how you triggered this
segmentation fault ?
Thanks
Luis
-----------------------------------------
On Thu, Dec 10, 2009 at 3:20 PM, Greg Harris <Gregory-Harris at uiowa.edu> wrote:
> http://public.kitware.com/Bug/view.php?id=10025
>
>
>
> Review/Statistics/itkScalarImageToHistogramGenerator.txx contains methods
> for SetHistogramMin and SetHistogramMax that allocate minVector and
> maxVector with size defaulted to zero instead of like this:
>
> MeasurementVectorType minVector(1);
>
> The result of executing it this way:
>
> MeasurementVectorType minVector;
>
> is a memory fault crash.
>
>
>
> cvs diff itkScalarImageToHistogramGenerator.txx
> Index: itkScalarImageToHistogramGenerator.txx
> ===================================================================
> RCS file:
> /cvsroot/Insight/Insight/Code/Review/Statistics/itkScalarImageToHistogramGen
> erator.txx,v
> retrieving revision 1.4
> diff -r1.4 itkScalarImageToHistogramGenerator.txx
> 79c79
> < MeasurementVectorType minVector;
> ---
>> MeasurementVectorType minVector(1);
> 91c91
> < MeasurementVectorType maxVector;
> ---
>> MeasurementVectorType maxVector(1);
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
More information about the Insight-developers
mailing list