<div dir="ltr"><div>Hi all,</div><div><br></div>I want to extract patches around points using CropImageFilter. To do this, I need to calculate the correct bounds.<div>The point itself is an itk::Point object, and then I calculate the lower_crop and upper_crop. It can be possible these are negative in some components, which is checked later on and compensated with ConstantPadImageFilter.</div><div><br></div><div>So I need to switch between a Size and Point, which apparently cannot be implicitly casted. </div><div>I am using a for loop to do this, but this is probably not the right way to do it. So what is the proper way to do this in ITK?</div><div>I understand this question is probably very elementary, but your help would be greatly appreciated.</div><div><br></div><div>  itk::Size<3> image_size = image->GetBufferedRegion().GetSize();<br></div><div><div><div>  std::cout << "Input size: " << image_size << std::endl;</div><div><br></div><div><b>  itk::Vector<double, 3> image_size2;</b></div><div><b>  for(int i=0; i<3; ++i)</b></div><div><b>    {</b></div><div><b>      image_size2[i] = image_size[i];</b></div><div><b>    }</b></div><div><br></div><div><br></div><div>  itk::Vector<double, 3> lower_crop = point - crop_size;</div><div>  itk::Vector<double, 3> upper_crop = image_size2 - (point + crop_size) - 1;</div></div><div><br></div></div><div><br></div><div>Best,</div><div>Jonas Teuwen</div></div>