[Insight-users] iterator gives different values in 32 and 64 bit linux ?

Bill Lorensen bill.lorensen at gmail.com
Mon Jul 6 07:26:33 EDT 2009


nvoxels should be initialized to 0.

On Mon, Jul 6, 2009 at 6:41 AM, gregthom<gregthom99 at yahoo.com> wrote:
>
> Greetings
>
> I am using this code to determine the number of voxels that lie withing a
> binary mask image
>
>  //create meshtoimage filter
>  BinaryImageType::ValueType  m_MaskValue =
> itk::NumericTraits<BinaryImageType::ValueType>::One;
>  typedef  itk::ImageRegionConstIteratorWithIndex<BinaryImageType>
> MaskIteratorType;
>  MaskIteratorType mit( triangleMeshToImage->GetOutput(),
> triangleMeshToImage->GetOutput()->GetBufferedRegion() );
>
>  //typedef itk::PointSet< double, 3 > PointSetType;
>  BinaryImageType::PointType InputPointType;
>
>  // lets get number of voxels
>  mexPrintf(">> first pass to get # voxels \n");
>  unsigned int nvoxels;
>  for (mit.GoToBegin(); !mit.IsAtEnd(); ++mit)
>  {
>
>     BinaryImageType::PointType iPoint;
>     triangleMeshToImage->GetOutput()->TransformIndexToPhysicalPoint(
> mit.GetIndex(), iPoint );
>
>     if (m_MaskValue == mit.Get())
>     {
>         nvoxels++;
>     }
>     else
>     {
>
>     }
>  }//
>  mexPrintf(">> number of voxels in mask :: %d \n",nvoxels);
>
>
>
> When run in 32 bits linux environment everything runs fine but on 64 bits
> environment, there number of voxels is not correct. Anybody know what is
> going on ?
>
>
> thank you
>
> G
> --
> View this message in context: http://www.nabble.com/iterator-gives-different-values-in-32-and-64-bit-linux---tp24353264p24353264.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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-users
>


More information about the Insight-users mailing list