Identify and delete unwanted slices in CT scan automaticaly

Hello,
I have the following CT scan of a cylinder (link of the dropbox : Dropbox - CT_Part.tif - Simplify your life) and i need to remove the first part of the object thats is not a cylinder (slices like the png image bellow) . I can’t detect the beginning of the cylinder part manually and visually so I thought of doing it algorithmically since i need to do this process on more other CT data . I did some reading and i found this concept of template matching using template matching or multiple template matching plugins. So i want to do template matching on every slice of the image and compares it with a slice within a CT scan then delete the slices that look like that . I am having hard time scripting this task since I’m a beginner. Can you guys please help me with any ideas .

Thank you ,
Jerika

If you use Fiji you can use macro-recording with the multi-template matching plugins.
Or for python, check the jupyter notebooks tutorials in the GitHub repository.
There is quite some documentation available including youtube tutorials see
Multi-Template Matching for object-localisation in Fiji - Announcements - Image.sc Forum

Thank you for replying , I’ll check those resources .