ImageMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".

I am a newbie with IM so, thank you for your patience.
I spend 2 days to understand the principle reading doc and trying but this is hard and I struggle to reach my target.
Version: ImageMagick 6.9.3-0 Q16 x86_64 2017-03-11
I need to clean B&W scan (music sheet), I mean remove (change to white) all black shapes too big.
I want to remove (change to white) all shapes with size equal or smaller than 5x5. That means all shapes bigger than 5 pix in 1 dimension should be kept as it is.
Good if the size (5x5) is a parameter that I can change.

So far I did the following, not the easy way but it works for some shapes. It treats so far only to 3x3 black shape. However I don't know how to remove 3x3 square shapes and some other.