Commit 85635c59 authored by Jean-Yves TINEVEZ's avatar Jean-Yves TINEVEZ
Browse files

Fix javadoc errors.

parent b0005ce0
......@@ -52,7 +52,7 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
}
@SuppressWarnings("unchecked")
protected ActiveContour(Var<Double> sampling, SlidingWindow convergenceWindow)
protected ActiveContour(Var<Double> sampling, final SlidingWindow convergenceWindow)
{
super(0, 0, 0, 0);
......@@ -77,7 +77,7 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
return name;
}
public void setName(String name)
public void setName(final String name)
{
this.name = name;
}
......@@ -91,7 +91,6 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
*
* @param p
* the point to add
* @return the index indicating where the point has been inserted in the internal list
*/
protected abstract void addPoint(Point3d p);
......@@ -183,8 +182,6 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
*
* @param imageData
* the data on which the average intensity should be computed
* @param channel
* the channel on which the average intensity should be computed
* @param mask
* the boolean mask where all contours (including the current one) have already been
* rasterised
......@@ -193,51 +190,52 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
public abstract double computeBackgroundIntensity(Sequence imageData, BooleanMask3D mask);
/**
* Tests whether the given point is inside the contour, and if so returns the penetration depth
* of this point. <br>
*
* @param p
* a point to test
* @return
* <ul>
* <li/>if <code>p</code> is outside: <code>0</code>
* <li/>if <code>p</code> is inside: the distance from <code>p</code> to the contour
* edge
* </ul>
*/
* Tests whether the given point is inside the contour, and if so returns
* the penetration depth of this point. <br>
*
* @param p
* a point to test
* @return
* <ul>
* <li>if <code>p</code> is outside: <code>0</code>
* <li>if <code>p</code> is inside: the distance from <code>p</code>
* to the contour edge
* </ul>
*/
public abstract double getDistanceToEdge(Point3d p);
/**
* @param order
* the dimension (a.k.a. norm) to compute:<br/>
* <ul>
* <li>0: number of points,</li>
* <li>1: perimeter (2D) or surface area (3D),</li>
* <li>2: surface (2D) or volume (3D)</li>
* </ul>
* @return the dimension for the specified order
*/
* @param order
* the dimension (a.k.a. norm) to compute:
* <ul>
* <li>0: number of points,</li>
* <li>1: perimeter (2D) or surface area (3D),</li>
* <li>2: surface (2D) or volume (3D)</li>
* </ul>
* @return the dimension for the specified order
*/
public abstract double getDimension(int order);
abstract void move(ROI boundField, double timeStep);
/**
* Re-samples the Contour according to an 'average distance between points' criterion. This
* method ensures that the distance between two consecutive points is strictly comprised between
* a minimum value and a maximum value. In order to avoid oscillatory behavior, 'max' and 'min'
* should verify the following relations: min < 1, max > 1, 2*min <= max.
*
* @param minFactor
* the minimum distance between two points.
* @param maxFactor
* the maximum distance between two points.
*/
* Re-samples the Contour according to an 'average distance between points'
* criterion. This method ensures that the distance between two consecutive
* points is strictly comprised between a minimum value and a maximum value.
* In order to avoid oscillatory behavior, 'max' and 'min' should verify the
* following relations: min &lt; 1, max &gt; 1, 2*min &lt;= max.
*
* @param minFactor
* the minimum distance between two points.
* @param maxFactor
* the maximum distance between two points.
*/
public abstract void reSample(double minFactor, double maxFactor) throws TopologyException;
/**
* @return a ROI representing the contour
* @deprecated use {@link #toROI(ROIType)} instead
*/
* @return a ROI representing the contour
* @deprecated use {@link #toROI(ROIType, Sequence)} instead
*/
@Deprecated
public abstract ROI toROI();
......@@ -262,19 +260,20 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
public abstract void toSequence(Sequence output, double value);
/**
* Updates the contour's meta-data (i.e. data that can be computed directly from the actual
* contour data, but stored locally for fast repetitive access). This includes:<br/>
* <ul>
* <li>bounding box</li>
* <li>bounding sphere</li>
* <li>contour normals</li>
* <li>center of mass</li>
* </ul>
*/
* Updates the contour's meta-data (i.e. data that can be computed directly
* from the actual contour data, but stored locally for fast repetitive
* access). This includes:
* <ul>
* <li>bounding box</li>
* <li>bounding sphere</li>
* <li>contour normals</li>
* <li>center of mass</li>
* </ul>
*/
protected void updateMetaData()
{
// center of mass
Point3d center = new Point3d();
final Point3d center = new Point3d();
// bounding sphere
double radius = 0;
......@@ -289,7 +288,7 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
// center calculation
double nbPts = 0;
for (Point3d p : this)
for (final Point3d p : this)
{
nbPts++;
......@@ -322,9 +321,9 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
boundingSphere.setCenter(center);
// radius calculation
for (Point3d p : this)
for (final Point3d p : this)
{
double d = p.distanceSquared(center);
final double d = p.distanceSquared(center);
if (d > radius)
radius = d;
......@@ -358,12 +357,12 @@ public abstract class ActiveContour extends Detection implements Iterable<Point3
return lastConvergedFrame;
}
public void setLastConvergedFrame(int frame)
public void setLastConvergedFrame(final int frame)
{
lastConvergedFrame = frame;
}
public void setDivisionSensitivity(Var<Double> divisionSensitivity)
public void setDivisionSensitivity(final Var<Double> divisionSensitivity)
{
this.divisionSensitivity = divisionSensitivity;
}
......
......@@ -90,7 +90,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
final ActiveContour contour;
final boolean maskBased;
public LocalRegionStatisticsComputer(ActiveContour contour, boolean maskBased)
public LocalRegionStatisticsComputer(final ActiveContour contour, final boolean maskBased)
{
this.contour = contour;
this.maskBased = maskBased;
......@@ -101,11 +101,11 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
{
try
{
double cin = contour.computeAverageIntensity(contour instanceof Mesh3D ? regionData : regionDataSummed,
final double cin = contour.computeAverageIntensity(contour instanceof Mesh3D ? regionData : regionDataSummed,
maskBased ? contourMask_buffer : null);
region_cin.put(trackGroup.getValue().getTrackSegmentWithDetection(contour), cin);
}
catch (TopologyException topo)
catch (final TopologyException topo)
{
System.err.println("Removing a contour. Reason: " + topo.getMessage());
allContoursAtTimeT.remove(contour);
......@@ -119,7 +119,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
{
final ActiveContour contour;
public LocalBackgroundStatisticsComputer(ActiveContour contour)
public LocalBackgroundStatisticsComputer(final ActiveContour contour)
{
this.contour = contour;
}
......@@ -127,9 +127,9 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
@Override
public Object call()
{
TrackSegment segment = trackGroup.getValue().getTrackSegmentWithDetection(contour);
final TrackSegment segment = trackGroup.getValue().getTrackSegmentWithDetection(contour);
double cout = contour.computeBackgroundIntensity(regionData, contourMask_buffer);
final double cout = contour.computeBackgroundIntensity(regionData, contourMask_buffer);
region_cout.put(segment, cout);
......@@ -147,8 +147,8 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
final List<TrackSegment> activeTracks;
final List<TrackSegment> endedTracks;
public ContourInitializer(ROI roi, int z, int t, Tuple3d pixelSize, int convWinSize,
List<TrackSegment> activeTracks, List<TrackSegment> justEndedTracks)
public ContourInitializer(final ROI roi, final int z, final int t, final Tuple3d pixelSize, final int convWinSize,
final List<TrackSegment> activeTracks, final List<TrackSegment> justEndedTracks)
{
super();
......@@ -174,7 +174,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
// imageBounds.height -= 2;
// test if object is intersecting with current active contours
for (TrackSegment segment : activeTracks)
for (final TrackSegment segment : activeTracks)
{
// get contour for this active track
final ActiveContour contour = (ActiveContour) segment.getLastDetection();
......@@ -203,7 +203,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return null;
// does it overlap with a track that terminates in the previous frame?
for (TrackSegment track : endedTracks)
for (final TrackSegment track : endedTracks)
{
final ActiveContour previousContour = (ActiveContour) track.getLastDetection();
// get ROI from contour
......@@ -237,7 +237,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
final int t;
final int convWinSize;
public ContourDuplicator(TrackSegment segment, int t, int convWinSize)
public ContourDuplicator(final TrackSegment segment, final int t, final int convWinSize)
{
super();
......@@ -320,7 +320,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
final Class<? extends ROI> clazz;
private ROIType(Class<? extends ROI> clazz)
private ROIType(final Class<? extends ROI> clazz)
{
this.clazz = clazz;
}
......@@ -330,7 +330,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
ExportROI.NO);
public final EzVarEnum<ROIType> output_roiType = new EzVarEnum<ROIType>("Type of ROI", ROIType.values(),
ROIType.AREA);
private VarSequence output_labels = new VarSequence("Labels", null);
private final VarSequence output_labels = new VarSequence("Labels", null);
public final EzVarBoolean tracking = new EzVarBoolean("Track objects over time", false);
......@@ -372,7 +372,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
private ActiveContoursOverlay overlay;
private Processor multiThreadService = new Processor(SystemUtil.getNumberOfCPUs());
private final Processor multiThreadService = new Processor(SystemUtil.getNumberOfCPUs());
private long lastVtkGCTime = 0L;
......@@ -385,7 +385,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
showTrackManager = new EzButton("Send to track manager", new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
public void actionPerformed(final ActionEvent e)
{
ThreadUtil.invokeLater(new Runnable()
{
......@@ -398,7 +398,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return;
Icy.getMainInterface().getSwimmingPool().add(new SwimmingObject(trackGroup.getValue()));
TrackManager tm = new TrackManager();
final TrackManager tm = new TrackManager();
tm.reOrganize();
tm.setDisplaySequence(inputData);
}
......@@ -512,7 +512,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
}
@Override
public void loadParameters(File file)
public void loadParameters(final File file)
{
super.loadParameters(file);
......@@ -531,8 +531,8 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
globalStop = false;
int startT = (viewer == null) ? 0 : viewer.getPositionT();
int endT = tracking.getValue().booleanValue() ? inputData.getSizeT() - 1 : startT;
final int startT = (viewer == null) ? 0 : viewer.getPositionT();
final int endT = tracking.getValue().booleanValue() ? inputData.getSizeT() - 1 : startT;
// Need to do it before clearing track group to remove old painters (Stephane)
if (overlay != null)
......@@ -560,7 +560,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
if (!Icy.getMainInterface().isHeadLess())
{
// replace any ActiveContours Painter object on the sequence by ours
for (Overlay existingOverlay : inputData.getOverlays())
for (final Overlay existingOverlay : inputData.getOverlays())
{
if (existingOverlay instanceof ActiveContoursOverlay)
existingOverlay.remove();
......@@ -589,7 +589,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
{
field = ROIUtil.merge(rois, BooleanOperator.OR);
}
catch (UnsupportedOperationException e)
catch (final UnsupportedOperationException e)
{
throw new VarException(evolution_bounds.getVariable(), "Cannot compute the evolution bounds: "
+ e.getMessage()
......@@ -696,7 +696,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
int maxId = 0;
// get maximum id
for (ROI roi : roiOutput.getValue())
for (final ROI roi : roiOutput.getValue())
{
try
{
......@@ -705,7 +705,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
if (contourId > maxId)
maxId = contourId;
}
catch (Exception e)
catch (final Exception e)
{
// ignore
}
......@@ -713,7 +713,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
// then fix ROI names
final int nbPaddingDigits = (int) Math.floor(Math.log10(maxId));
for (ROI roi : roiOutput.getValue())
for (final ROI roi : roiOutput.getValue())
{
try
{
......@@ -727,7 +727,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
roi.setName(
CONTOUR_BASE_NAME + StringUtil.toString(contourId, nbPaddingDigits) + " (" + roiName + ")");
}
catch (Exception e)
catch (final Exception e)
{
// ignore
}
......@@ -744,7 +744,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
out.setName(inputData.getName() + " + Active contours");
//$FALL-THROUGH$
case ON_INPUT:
for (ROI roi : roiOutput.getValue())
for (final ROI roi : roiOutput.getValue())
out.addROI(roi, false);
if (out != inputData)
addSequence(out);
......@@ -763,10 +763,10 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
multiThreadService.waitAll();
// cleanup (TrackSegment use static references for Id, need to remove them !!)
for (TrackSegment ts : region_cin.keySet())
for (final TrackSegment ts : region_cin.keySet())
if (ts != null)
ts.removeId();
for (TrackSegment ts : region_cout.keySet())
for (final TrackSegment ts : region_cout.keySet())
if (ts != null)
ts.removeId();
......@@ -780,22 +780,22 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
regionDataSummed = null;
}
boolean executeMultiThread(Collection<Callable<Object>> tasks, String messageOnError) throws Exception
boolean executeMultiThread(final Collection<Callable<Object>> tasks, final String messageOnError) throws Exception
{
try
{
// force wait completion for all tasks
for (Future<Object> res : multiThreadService.invokeAll(tasks))
for (final Future<Object> res : multiThreadService.invokeAll(tasks))
res.get();
return true;
}
catch (InterruptedException e)
catch (final InterruptedException e)
{
// restore the interrupted flag
Thread.currentThread().interrupt();
}
catch (Exception e)
catch (final Exception e)
{
if (StringUtil.isEmpty(messageOnError))
throw e;
......@@ -807,7 +807,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return false;
}
private void initData(int t)
private void initData(final int t)
{
final int edgeChannel = edge_c.getValue().intValue();
final int regionChannel = region_c.getValue().intValue();
......@@ -817,13 +817,13 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
if (regionChannel >= inputData.getSizeC())
throw new IcyHandledException("The selected region channel is invalid.");
Rectangle3D.Integer bounds = new Rectangle3D.Integer();
final Rectangle3D.Integer bounds = new Rectangle3D.Integer();
bounds.sizeX = inputData.getSizeX();
bounds.sizeY = inputData.getSizeY();
bounds.sizeZ = inputData.getSizeZ();
// get the current frame (in its original data type)
Sequence currentFrame = SequenceUtil.extractFrame(inputData, t);
final Sequence currentFrame = SequenceUtil.extractFrame(inputData, t);
// get edge channel bounds (need to load all data first)
currentFrame.loadAllData();
......@@ -855,11 +855,11 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
try
{
// smooth the signal
Sequence gaussian = Kernels1D.CUSTOM_GAUSSIAN.createGaussianKernel1D(1).toSequence();
final Sequence gaussian = Kernels1D.CUSTOM_GAUSSIAN.createGaussianKernel1D(1).toSequence();
Convolution1D.convolve(edgeData, gaussian, gaussian, null);
Convolution1D.convolve(regionData, gaussian, gaussian, null);
}
catch (Exception e)
catch (final Exception e)
{
System.err.println("Warning: error while smoothing the signal: " + e.getMessage());
}
......@@ -896,13 +896,13 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
try
{
// duplicate contours from the previous frame
for (TrackSegment segment : trackGroup.getValue().getTrackSegmentList())
for (final TrackSegment segment : trackGroup.getValue().getTrackSegmentList())
tasks.add(new ContourDuplicator(segment, t, convWinSize));
// execute tasks
executeMultiThread(tasks, "couldn't duplicate a contour");
}
catch (Exception e)
catch (final Exception e)
{
e.printStackTrace();
System.err.println("Warning: (reason: " + e.getMessage() + "). Moving on...");
......@@ -934,12 +934,12 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
try
{
// initialize new contours
for (ROI roi : objects)
for (final ROI roi : objects)
tasks.add(new ContourInitializer(roi, currentZ, t, pixelSize, convWinSize, activeTracks,
justEndedTracks));
// force wait completion for all tasks
for (Future<Object> res : multiThreadService.invokeAll(tasks))
for (final Future<Object> res : multiThreadService.invokeAll(tasks))
{
final TrackSegment track = (TrackSegment) res.get();
......@@ -948,12 +948,12 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
newTracks.add(track);
}
}
catch (InterruptedException e)
catch (final InterruptedException e)
{
// restore the interrupted flag
Thread.currentThread().interrupt();
}
catch (Exception e)
catch (final Exception e)
{
e.printStackTrace();
System.err.println("Warning: couldn't initialize a contour (reason: " + e.getMessage() + ").");
......@@ -962,17 +962,17 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
// add new created tracks
synchronized (tg)
{
for (TrackSegment track : newTracks)
for (final TrackSegment track : newTracks)
tg.addTrackSegment(track);
}
synchronized (region_cin)
{
for (TrackSegment track : newTracks)
for (final TrackSegment track : newTracks)
region_cin.put(track, Double.valueOf(0d));
}
synchronized (region_cout)
{
for (TrackSegment track : newTracks)
for (final TrackSegment track : newTracks)
region_cout.put(track, Double.valueOf(0d));
}
}
......@@ -980,13 +980,13 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
/**
* Returns all {@link TrackSegment} ending at the specified time point
*/
private List<TrackSegment> getTracksEndingAt(List<TrackSegment> tracks, int t)
private List<TrackSegment> getTracksEndingAt(final List<TrackSegment> tracks, final int t)
{
final List<TrackSegment> result = new ArrayList<TrackSegment>();
if (t >= 0)
{
for (TrackSegment track : tracks)
for (final TrackSegment track : tracks)
{
// get last detection for this track
final Detection detection = track.getLastDetection();
......@@ -1000,7 +1000,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return result;
}
private boolean hasFutureRois(int t)
private boolean hasFutureRois(final int t)
{
List<ROI> rois = CollectionUtil.asArrayList(roiInput.getValue());
......@@ -1019,7 +1019,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return false;
// only pick ROI for current frame
for (ROI roi : rois)
for (final ROI roi : rois)
{
if (roi instanceof ROI2D)
{
......@@ -1037,7 +1037,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return false;
}
private List<ROI> getRoisOf(int t)
private List<ROI> getRoisOf(final int t)
{
List<ROI> result = CollectionUtil.asArrayList(roiInput.getValue());
......@@ -1098,7 +1098,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
/**
* Create a copy of input ROI and split multiples components ROI if needed
*/
private List<ROI> getWorkRois(ROI roi)
private List<ROI> getWorkRois(final ROI roi)
{
// get minimum allowed size
final int minPoints = (int) (contour_resolution.getValue().doubleValue() * 3);
......@@ -1117,7 +1117,7 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
if (components.length > 1)
{
// split multi components ROI
for (BooleanMask2D comp : components)
for (final BooleanMask2D comp : components)
{
// don't bother initializing contours that are too small (w.r.t. the required
// sampling)
......@@ -1149,12 +1149,12 @@ public class ActiveContours extends EzPlug implements EzStoppable, Block
return result;
}
private List<ROI> getNewObjectsFor(int t)
private List<ROI> getNewObjectsFor(final int t)
{
final List<ROI> result = new ArrayList<ROI>();
// get ROI located at the given time point
for (ROI roi : getRoisOf(t))