/*-
* #%L
* Fiji distribution of ImageJ for the life sciences.
* %%
* Copyright (C) 2007 - 2017 Fiji developers.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
package spim.process.interestpointregistration.centerofmass;
import ij.gui.GenericDialog;
import java.util.List;
import mpicbg.spim.data.sequence.ViewId;
import spim.fiji.plugin.Interest_Point_Registration.RegistrationType;
import spim.fiji.plugin.interestpointregistration.InterestPointRegistration;
import spim.fiji.spimdata.SpimData2;
import spim.process.interestpointregistration.ChannelProcess;
import spim.process.interestpointregistration.PairwiseMatch;
import spim.process.interestpointregistration.TransformationModel;
/**
* Center of Mass (Avg/Median) implementation
*
* @author Stephan Preibisch (stephan.preibisch@gmx.de)
*
*/
public class CenterOfMass extends InterestPointRegistration
{
final static String[] centerChoice = new String[]{ "Average", "Median" };
public static int defaultCenterChoice = 0;
protected int centerType = 0;
public CenterOfMass(
final SpimData2 spimData,
final List< ViewId > viewIdsToProcess,
final List< ChannelProcess > channelsToProcess )
{
super( spimData, viewIdsToProcess, channelsToProcess );
}
@Override
protected CenterOfMassPairwise pairwiseMatchingInstance( final PairwiseMatch pair, final String description )
{
return new CenterOfMassPairwise( pair, centerType, description );
}
@Override
protected TransformationModel getTransformationModel() { return new TransformationModel( 0 ); }
@Override
public void addQuery( final GenericDialog gd, final RegistrationType registrationType )
{
gd.addChoice( "Type of Center Computation", centerChoice, centerChoice[ defaultCenterChoice ] );
}
@Override
public boolean parseDialog( final GenericDialog gd, final RegistrationType registrationType )
{
this.centerType = gd.getNextChoiceIndex();
return true;
}
@Override
public CenterOfMass newInstance(
final SpimData2 spimData,
final List< ViewId > viewIdsToProcess,
final List< ChannelProcess > channelsToProcess )
{
return new CenterOfMass( spimData, viewIdsToProcess, channelsToProcess );
}
@Override
public String getDescription() { return "Center of Mass (translation-invariant)"; }
}