ITK ERROR: MattesMutualInformationImageToImageMetricv4(000001F33CCCA180): VirtualSampledPointSet must have 1 or more points.

I want to complete a mask registration and add a mask to the dicom sequence to speed up the registration. I added a mask, but an error occurred in the title. I have checked my mask. There is data both internally and externally. How can I solve this problem

help me

I have no problem using 2d test, but these problems occur once I switch to 3d. Doesn’t itk support 3d mask?

when create the mask is consinderate the image spacing?

Hello @ma1282029525,

Not sure if this is the case, but the combination of small_mask + large_image + random_sampling can lead to this situation, see this long discussion and possible work-arounds. It is not about 2D vs. 3D, simply in 3D the chances of this happening are higher.

1 Like

I did use the strategy as you said, my purpose is actually to generate the mask exactly the same as the original image, but I did not find the sample code, so this problem occurs, could you please remind me how to generate the mask of the same size as the original image, and how the mask is aligned with the original image, by real physical coordinates, Or is it aligned by image coordinates?

Hello @ma1282029525,

The mask only needs to be aligned with the original image in physical space. The sampled points are checked for being inside the physical mask, see code here and here.

I got it,thanks very help me a lot.