FIJI plugin: assigning Frangi Vesselness result to variable

I’ve written a number of ImageJ macros and scripts, but now I need a performance boost in my workflows, so I’ve begun to explore writing plugins in Java. I’m proficient in Python and know some basic Java syntax so it shouldn’t take too long to get to grips with writing plugins (I hope). Since starting, I’ve come across a couple of issues but I haven’t found answers in the forum or elsewhere online.

  1. I’ve followed the instructions to work on plugins from the YouTube video on the FIJI channel (https://www.youtube.com/watch?v=YIWpoBnnLio), but an error pops up when I try to call import ij.IJ;, saying “import ij cannot be resolved”. Would it be easier to rely on ImgLib2 rather on IJ, or is there a simple fix?

  2. I’m working on a template plugin and I want to apply the Frangi Vesselness filter to an image, but my code throws an error when I try to instantiate the result variable. I’m not sure what’s going on with the <T> and <U> tags. I know result is a 32-bit floating point image but I don’t know how to store it in a variable. What do these tags do?

public class FrangiTubeMeasure<T extends RealType<T>> implements Command {
    //
    // Feel free to add more parameters here...
    //

    @Parameter
    private Dataset currentData;

    @Parameter
    private UIService uiService;

    @Parameter
    private OpService opService;

    @Override
    public void run() {
        final Img<T> image = (Img<T>)currentData.getImgPlus();

        final RandomAccessibleInterval<U> result = new RandomAccessibleInterval<U>();
        opService.filter().frangiVesselness(result, image);
        uiService.show(result);
    }

Any and all help is massively appreciated =)