use of net.imagej.options.OptionsMisc in project imagej-plugins-commands by imagej.
the class ReciprocalDataValues method run.
// -- public interface --
@Override
public void run() {
Dataset dataset = imgDispService.getActiveDataset(display);
Overlay overlay = overlayService.getActiveOverlay(display);
DatasetView view = imgDispService.getActiveDatasetView(display);
final OptionsMisc optionsMisc = optionsService.getOptions(OptionsMisc.class);
final String dbzString = optionsMisc.getDivByZeroVal();
double dbzVal;
try {
dbzVal = Double.parseDouble(dbzString);
} catch (final NumberFormatException e) {
dbzVal = Double.POSITIVE_INFINITY;
}
final RealReciprocal<DoubleType, DoubleType> op = new RealReciprocal<DoubleType, DoubleType>(dbzVal);
final InplaceUnaryTransform<T, DoubleType> transform;
if (allPlanes)
transform = new InplaceUnaryTransform<T, DoubleType>(op, new DoubleType(), dataset, overlay);
else
transform = new InplaceUnaryTransform<T, DoubleType>(op, new DoubleType(), dataset, overlay, view.getPlanePosition());
transform.run();
}
use of net.imagej.options.OptionsMisc in project imagej-plugins-commands by imagej.
the class DivideDataValuesBy method getOperation.
@Override
public RealDivideConstant<DoubleType, DoubleType> getOperation() {
final OptionsMisc optionsMisc = optionsService.getOptions(OptionsMisc.class);
final String dbzString = optionsMisc.getDivByZeroVal();
double dbzVal;
try {
dbzVal = Double.parseDouble(dbzString);
} catch (final NumberFormatException e) {
dbzVal = Double.POSITIVE_INFINITY;
}
return new RealDivideConstant<DoubleType, DoubleType>(value, dbzVal);
}
Aggregations