Crop Custom Shape in ImageJ or equivalent (TIFF video file)

Amateur Math Guy picture Amateur Math Guy · Apr 2, 2015 · Viewed 8.1k times · Source

I have a .tiff video file with growing fibers that look like the image below

enter image description here

Now imagine that this fiber will constantly grow and shrink in a straight line. Now I'd like to somehow crop out the region of the video that contains just the fiber with, for example, a black background image.

enter image description here

Now when I play the video I'd like to just see the growing fiber region of the video with the black background everywhere else.

Question: Is there a way to preform a "custom" crop of irregular shaped objects in ImageJ?

If you don't know if ImageJ can do this sort of image processing any other software options are welcome.

Thanks for any help

Answer

TSwayne picture TSwayne · Apr 7, 2015

Yes, you can do this in ImageJ. If you can find a threshold method that captures your fiber, you can turn that into a selection (ROI), and then Clear Outside to turn everything else black:

  1. Image > Adjust > Threshold and choose the threshold, or use one of the automatic methods. But don't apply the threshold!
  2. Edit > Selection > Create Selection (turns the thresholded area into an ROI)
  3. Edit > Clear Outside (makes the background black -- assuming you have set your background color to black)

If you want to make the window smaller, you can do Image > Crop with the selection active. This will crop the image to the rectangular bounding box of the ROI. But this size will vary according to the size of the fiber. So you might want to do this when the fiber is at its largest.