Class MarksWithEnergyBreakdown
Object
org.anchoranalysis.mpp.feature.energy.marks.MarksWithEnergyBreakdown
- All Implemented Interfaces:
Serializable
public class MarksWithEnergyBreakdown extends Object implements Serializable
Marks with both the total energy and a breakdown by clique.
This class provides functionality to manage and calculate energies for a collection of marks, including individual, pair, and all-mark energies.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description MarksWithEnergyBreakdown(MarksWithTotalEnergy marks)Creates a new instance with the given marks and total energy.MarksWithEnergyBreakdown(MarksWithTotalEnergy marks, EnergySavedIndividual individual, EnergySavedPairs pair, EnergySavedAll all) -
Method Summary
Modifier and Type Method Description voidadd(EnergyMemoList wrapperInd, VoxelizedMarkMemo newPxlMarkMemo, EnergyStackWithoutParameters stack)Adds a new mark to the collection and updates energies.voidassertValid()Asserts that the energy calculations are valid.MarksWithEnergyBreakdowndeepCopy()Creates a deep copy of this instance.voidexchange(int index, VoxelizedMarkMemo newMark)Exchanges a mark at a specific index with a new mark.voidexchange(EnergyMemoList wrapperInd, int index, VoxelizedMarkMemo newMark, EnergyStack energyStack)Exchanges a mark at a specific index with a new mark and updates energies.EnergySavedAllgetAll()Certain features are stored for every object, so that we can reference them in our calculations for the 'all' component.EnergySchemeWithSharedFeaturesgetEnergyScheme()Gets the energy scheme with shared features.doublegetEnergyTotal()Gets the total energy of all marks.EnergySavedIndividualgetIndividual()Energy saved for individual marks.MarkCollectiongetMarks()Gets the collection of marks.MarksWithTotalEnergygetMarksWithTotalEnergy()Gets the marks with their total energy.EnergySavedPairsgetPair()Every combination of interactions between marks and the associated energy.voidinitialize()Initializes the energy calculations.voidremove(int index)Removes a mark at a specific index from the collection.voidremove(EnergyMemoList wrapperInd, int index, VoxelizedMarkMemo markToRemove, EnergyStackWithoutParameters stack)Removes a mark at a specific index from the collection and updates energies.voidremove(EnergyMemoList wrapperInd, VoxelizedMarkMemo markToRemove, EnergyStackWithoutParameters stack)Removes a specific mark from the collection and updates energies.voidremoveTwo(EnergyMemoList wrapperInd, int index1, int index2, EnergyStackWithoutParameters energyStack)Removes two marks at specific indices from the collection and updates energies.voidsetAll(EnergySavedAll all)Certain features are stored for every object, so that we can reference them in our calculations for the 'all' component.MarksWithEnergyBreakdownshallowCopy()Creates a shallow copy of this instance.intsize()Gets the number of marks in the collection.StringtoString()Returns a string representation of the object.voidupdateTotal(EnergyMemoList pxlMarkMemoList, EnergyStackWithoutParameters stack)Updates the total energy based on the current state.
-
Constructor Details
-
MarksWithEnergyBreakdown
Creates a new instance with the given marks and total energy.- Parameters:
marks- theMarksWithTotalEnergycontaining marks with their total energy
-
MarksWithEnergyBreakdown
public MarksWithEnergyBreakdown(MarksWithTotalEnergy marks, EnergySavedIndividual individual, EnergySavedPairs pair, EnergySavedAll all)
-
-
Method Details
-
initialize
Initializes the energy calculations.- Throws:
NamedFeatureCalculateException- if there's an error during initialization
-
assertValid
public void assertValid()Asserts that the energy calculations are valid. -
getMarksWithTotalEnergy
Gets the marks with their total energy.- Returns:
- the
MarksWithTotalEnergycontaining marks with total energy
-
updateTotal
public void updateTotal(EnergyMemoList pxlMarkMemoList, EnergyStackWithoutParameters stack) throws NamedFeatureCalculateExceptionUpdates the total energy based on the current state.- Parameters:
pxlMarkMemoList- theEnergyMemoListcontaining energy memosstack- theEnergyStackWithoutParametersfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
shallowCopy
Creates a shallow copy of this instance.- Returns:
- a new
MarksWithEnergyBreakdowninstance with shallow copies of the internal state
-
deepCopy
Creates a deep copy of this instance.- Returns:
- a new
MarksWithEnergyBreakdowninstance with deep copies of the internal state
-
getEnergyTotal
public double getEnergyTotal()Gets the total energy of all marks.- Returns:
- the total energy as a double
-
getMarks
Gets the collection of marks.- Returns:
- the
MarkCollectioncontaining all marks
-
getEnergyScheme
Gets the energy scheme with shared features.- Returns:
- the
EnergySchemeWithSharedFeaturesused for energy calculations
-
add
public void add(EnergyMemoList wrapperInd, VoxelizedMarkMemo newPxlMarkMemo, EnergyStackWithoutParameters stack) throws NamedFeatureCalculateExceptionAdds a new mark to the collection and updates energies.- Parameters:
wrapperInd- theEnergyMemoListcontaining energy memosnewPxlMarkMemo- the newVoxelizedMarkMemoto addstack- theEnergyStackWithoutParametersfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
remove
public void remove(EnergyMemoList wrapperInd, VoxelizedMarkMemo markToRemove, EnergyStackWithoutParameters stack) throws NamedFeatureCalculateExceptionRemoves a specific mark from the collection and updates energies.- Parameters:
wrapperInd- theEnergyMemoListcontaining energy memosmarkToRemove- theVoxelizedMarkMemoto removestack- theEnergyStackWithoutParametersfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
remove
public void remove(EnergyMemoList wrapperInd, int index, VoxelizedMarkMemo markToRemove, EnergyStackWithoutParameters stack) throws NamedFeatureCalculateExceptionRemoves a mark at a specific index from the collection and updates energies.- Parameters:
wrapperInd- theEnergyMemoListcontaining energy memosindex- the index of the mark to removemarkToRemove- theVoxelizedMarkMemoto removestack- theEnergyStackWithoutParametersfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
removeTwo
public void removeTwo(EnergyMemoList wrapperInd, int index1, int index2, EnergyStackWithoutParameters energyStack) throws NamedFeatureCalculateExceptionRemoves two marks at specific indices from the collection and updates energies.- Parameters:
wrapperInd- theEnergyMemoListcontaining energy memosindex1- the index of the first mark to removeindex2- the index of the second mark to removeenergyStack- theEnergyStackWithoutParametersfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
exchange
public void exchange(EnergyMemoList wrapperInd, int index, VoxelizedMarkMemo newMark, EnergyStack energyStack) throws NamedFeatureCalculateExceptionExchanges a mark at a specific index with a new mark and updates energies.- Parameters:
wrapperInd- theEnergyMemoListcontaining energy memosindex- the index of the mark to exchangenewMark- the newVoxelizedMarkMemoto replace the existing markenergyStack- theEnergyStackfor energy calculations- Throws:
NamedFeatureCalculateException- if there's an error during calculation
-
remove
public void remove(int index)Removes a mark at a specific index from the collection.- Parameters:
index- the index of the mark to remove
-
exchange
Exchanges a mark at a specific index with a new mark.- Parameters:
index- the index of the mark to exchangenewMark- the newVoxelizedMarkMemoto replace the existing mark
-
toString
Returns a string representation of the object. -
size
public final int size()Gets the number of marks in the collection.- Returns:
- the number of marks as an int
-
getIndividual
Energy saved for individual marks. -
getPair
Every combination of interactions between marks and the associated energy. -
getAll
Certain features are stored for every object, so that we can reference them in our calculations for the 'all' component. -
setAll
Certain features are stored for every object, so that we can reference them in our calculations for the 'all' component.
-