How to change the information of image after padding? Is it required?

I need to create a mesh from a closed surface. What I did is that to pad the image with tolerance level of 3 pixels padSize,

// pad the input intensity image
        PadFilterType::Pointer padFilter=PadFilterType::New();
        ImageType::SizeType lowerExtendRegion;
        lowerExtendRegion.Fill(padSize);    // pad from up-left side    lowerBound[0]: pad from left side, lowerbound[1]: pad from up
        ImageType::SizeType upperExtendRegion;
        upperExtendRegion.Fill(padSize);      // pad from the bottom side, upperBound[0]: pad from right side, lowerbound[1]: pad from bottom
        padFilter->SetConstant(0.0);   // fill with zero values, default=0

The information of image before padding is size: [166, 347, 82] and start (region.GetIndex()) is [0, 0, 0]
. After padding the information changes to [172, 353, 88] and [-3, -3, -3] respectively.
My question is two-fold:

  1. Should I change the start to [0,0,0] for creating mesh and then applying deformable models? If yes, how to change the start information of volume?

  2. After performing the required algorithms on the padded image, how to return back the image to the original size and information before padding?

Thank you

  1. You should not need to modify the image to use it in further processing.
  2. Using RegionOfInterestImageFilter (with original region) seems like the easiest and most appropriate.
1 Like

Thank you very much sir, it worked