Search in sources :

Example 6 with FluorophoreSequenceModel

use of uk.ac.sussex.gdsc.smlm.model.FluorophoreSequenceModel in project GDSC-SMLM by aherbert.

the class CreateData method removeFilteredFluorophores.

/**
 * Remove all fluorophores which were not drawn.
 *
 * @param fluorophores the fluorophores
 * @param localisations the localisations
 * @return the filtered list
 */
private List<? extends FluorophoreSequenceModel> removeFilteredFluorophores(List<? extends FluorophoreSequenceModel> fluorophores, List<LocalisationModel> localisations) {
    if (fluorophores == null) {
        return null;
    }
    // movingMolecules will be created with an initial capacity to hold all the unique IDs
    final TIntHashSet idSet = new TIntHashSet((movingMolecules != null) ? movingMolecules.capacity() : 0);
    for (final LocalisationModel l : localisations) {
        idSet.add(l.getId());
    }
    final List<FluorophoreSequenceModel> newFluorophores = new ArrayList<>(idSet.size());
    for (final FluorophoreSequenceModel f : fluorophores) {
        if (idSet.contains(f.getId())) {
            newFluorophores.add(f);
        }
    }
    return newFluorophores;
}
Also used : LocalisationModel(uk.ac.sussex.gdsc.smlm.model.LocalisationModel) FluorophoreSequenceModel(uk.ac.sussex.gdsc.smlm.model.FluorophoreSequenceModel) ArrayList(java.util.ArrayList) TIntArrayList(gnu.trove.list.array.TIntArrayList) TFloatArrayList(gnu.trove.list.array.TFloatArrayList) TIntHashSet(gnu.trove.set.hash.TIntHashSet)

Aggregations

FluorophoreSequenceModel (uk.ac.sussex.gdsc.smlm.model.FluorophoreSequenceModel)6 LocalisationModel (uk.ac.sussex.gdsc.smlm.model.LocalisationModel)4 ReadHint (uk.ac.sussex.gdsc.smlm.results.ImageSource.ReadHint)4 TIntHashSet (gnu.trove.set.hash.TIntHashSet)3 GenericDialog (ij.gui.GenericDialog)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 NullArgumentException (org.apache.commons.math3.exception.NullArgumentException)3 DataException (uk.ac.sussex.gdsc.core.data.DataException)3 ConversionException (uk.ac.sussex.gdsc.core.data.utils.ConversionException)3 ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)3 StoredDataStatistics (uk.ac.sussex.gdsc.core.utils.StoredDataStatistics)3 ConfigurationException (uk.ac.sussex.gdsc.smlm.data.config.ConfigurationException)3 ActivationEnergyImageModel (uk.ac.sussex.gdsc.smlm.model.ActivationEnergyImageModel)3 CompoundMoleculeModel (uk.ac.sussex.gdsc.smlm.model.CompoundMoleculeModel)3 ImageModel (uk.ac.sussex.gdsc.smlm.model.ImageModel)3 SpatialDistribution (uk.ac.sussex.gdsc.smlm.model.SpatialDistribution)3 SpatialIllumination (uk.ac.sussex.gdsc.smlm.model.SpatialIllumination)3 TFloatArrayList (gnu.trove.list.array.TFloatArrayList)2 TIntArrayList (gnu.trove.list.array.TIntArrayList)2