[ITK-users] error in executing filter

neela avcneela at gmail.com
Sat May 10 07:28:29 EDT 2014


hi

i tried weightedvotingimagefilter in release mode. the system crashes. i got 
the correct output only once but for the same set of input, now the system 
crashes.  I think i am having problem in the following patch


  // Compute the offset table for the target image
size_t nPatch, nSearch;
  int *offPatchTarget;
  ComputeOffsetTable(target, m_PatchRadius, &offPatchTarget, nPatch);


The function definition is 
template<class TInputImage, class TOutputImage>
void
WeightedVotingLabelFusionImageFilter<TInputImage, TOutputImage>
::ComputeOffsetTable(
  const InputImageType *image, 
  const SizeType &radius, 
  int **offset, 
  size_t &nPatch,
  int **manhattan)
{
  // Use iterators to construct offset tables
  RegionType r = image->GetBufferedRegion();
  NIter itTempPatch(radius, image, r);

  // Position the iterator in the middle to avoid problems with boundary 
conditions
  IndexType iCenter;
  for(size_t i = 0; i < InputImageDimension; i++)
    iCenter[i] = r.GetIndex(i) + r.GetSize(i)/2;
  itTempPatch.SetLocation(iCenter);

  // Compute the offsets 
  nPatch = itTempPatch.Size();
  (*offset) = new int[nPatch];
  if(manhattan)
    (*manhattan) = new int[nPatch];
  for(size_t i = 0; i < nPatch; i++)
  {
    (*offset)[i] = itTempPatch[i] - itTempPatch.GetCenterPointer();
    if(manhattan)
      {
      typename NIter::OffsetType off = itTempPatch.GetOffset(i);
      (*manhattan)[i] = 0;
      for(int d = 0; d < InputImageDimension; d++)
        (*manhattan)[i] += abs(off[d]);
      }
  }
}

But always (*offset)[i] stores negative value (it starts from -131585)

My os is windows xp(32bit)

please help me
- neela




More information about the Insight-users mailing list