io.github.mianalysis.mia.module.images.transform.ReplaceImage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mia-modules Show documentation
Show all versions of mia-modules Show documentation
ModularImageAnalysis (MIA) is an ImageJ plugin which provides a modular framework for assembling image and object analysis workflows. Detected objects can be transformed, filtered, measured and related. Analysis workflows are batch-enabled by default, allowing easy processing of high-content datasets.
package io.github.mianalysis.mia.module.images.transform;
import ij.ImagePlus;
import io.github.mianalysis.mia.module.Module;
import io.github.mianalysis.mia.module.Modules;
import io.github.mianalysis.mia.module.Module;
import org.scijava.Priority;
import org.scijava.plugin.Plugin;
import io.github.mianalysis.mia.module.Category;
import io.github.mianalysis.mia.module.Categories;
import io.github.mianalysis.mia.object.Workspace;
import io.github.mianalysis.mia.object.image.Image;
import io.github.mianalysis.mia.object.image.ImageFactory;
import io.github.mianalysis.mia.object.parameters.InputImageP;
import io.github.mianalysis.mia.object.parameters.Parameters;
import io.github.mianalysis.mia.object.refs.collections.ImageMeasurementRefs;
import io.github.mianalysis.mia.object.refs.collections.MetadataRefs;
import io.github.mianalysis.mia.object.refs.collections.ObjMeasurementRefs;
import io.github.mianalysis.mia.object.refs.collections.ObjMetadataRefs;
import io.github.mianalysis.mia.object.refs.collections.ParentChildRefs;
import io.github.mianalysis.mia.object.refs.collections.PartnerRefs;
import io.github.mianalysis.mia.object.system.Status;
/**
* This module duplicates an image into another, existing, image.
This is useful when dealing with optional modules, where a specific input is required later on.
*/
@Plugin(type = Module.class, priority=Priority.LOW, visible=true)
public class ReplaceImage extends Module {
public static final String INPUT_IMAGE1 = "Input image 1 (to be replaced)";
/**
* The image to copy pixel intensities from
*/
public static final String INPUT_IMAGE2 = "Input image 2";
public ReplaceImage(Modules modules) {
super("Replace image",modules);
}
@Override
public Category getCategory() {
return Categories.IMAGES_TRANSFORM;
}
@Override
public String getVersionNumber() {
return "1.0.0";
}
@Override
public String getDescription() {
return "This module duplicates an image into another, existing, image. " +
"\nThis is useful when dealing with optional modules, where a specific input is required later on.";
}
@Override
public Status process(Workspace workspace) {
// Getting input images
String inputImageName1 = parameters.getValue(INPUT_IMAGE1,workspace);
Image inputImage1 = workspace.getImages().get(inputImageName1);
String inputImageName2 = parameters.getValue(INPUT_IMAGE2,workspace);
Image inputImage2 = workspace.getImages().get(inputImageName2);
ImagePlus inputImagePlus2 = inputImage2.getImagePlus();
inputImage1.setImagePlus(inputImagePlus2);
return Status.PASS;
}
@Override
protected void initialiseParameters() {
parameters.add(new InputImageP(INPUT_IMAGE1,this,"","Pixel intensities for this image will be replaced."));
parameters.add(new InputImageP(INPUT_IMAGE2,this,"","The image to copy pixel intensities from"));
}
@Override
public Parameters updateAndGetParameters() {
Workspace workspace = null;
return parameters;
}
@Override
public ImageMeasurementRefs updateAndGetImageMeasurementRefs() {
return null;
}
@Override
public ObjMeasurementRefs updateAndGetObjectMeasurementRefs() {
return null;
}
@Override
public ObjMetadataRefs updateAndGetObjectMetadataRefs() {
return null;
}
@Override
public MetadataRefs updateAndGetMetadataReferences() {
return null;
}
@Override
public ParentChildRefs updateAndGetParentChildRefs() {
return null;
}
@Override
public PartnerRefs updateAndGetPartnerRefs() {
return null;
}
@Override
public boolean verify() {
return true;
}
}