public class TmXmlReader extends Object
Modifier and Type | Field and Description |
---|---|
protected ConcurrentHashMap<Integer,Spot> |
cache
A map of all spots loaded.
|
protected static boolean |
DEBUG |
protected org.jdom2.Document |
document |
protected File |
file |
protected Logger.StringBuilderLogger |
logger |
protected boolean |
ok
If
false , an error occurred during reading. |
protected org.jdom2.Element |
root |
Constructor and Description |
---|
TmXmlReader(File file)
Initialize this reader to read the file given in argument.
|
Modifier and Type | Method and Description |
---|---|
protected Model |
createModel()
Hook for subclassers:
Creates the instance of Model that will be built upon loading
with this reader. |
protected void |
getDetectorSettings(org.jdom2.Element settingsElement,
Settings settings,
DetectorProvider provider)
Update the given
Settings object with the
SpotDetectorFactory and settings map fields named
Settings.detectorFactory and Settings.detectorSettings
read within the XML file this reader is initialized with. |
DisplaySettings |
getDisplaySettings() |
String |
getErrorMessage()
Returns an explanatory message about the last unsuccessful read attempt.
|
String |
getGUIState()
Returns the GUI state saved in the file.
|
protected FeatureFilter |
getInitialFilter(org.jdom2.Element settingsElement)
Return the initial filter value on quality stored in this file.
|
String |
getLog()
Returns the log text saved in the file, or
null if log text
was not saved. |
Model |
getModel()
Returns the model saved in the file, or
null if a saved
model cannot be found in the xml file. |
protected List<FeatureFilter> |
getSpotFeatureFilters(org.jdom2.Element settingsElement)
Return the list of
FeatureFilter for spots stored in this file. |
protected void |
getTrackerSettings(org.jdom2.Element settingsElement,
Settings settings,
TrackerProvider provider)
Update the given
Settings object with SpotTracker
proper settings map fields named Settings.trackerSettings and
Settings.trackerFactory read within the XML file this reader is
initialized with. |
protected List<FeatureFilter> |
getTrackFeatureFilters(org.jdom2.Element settingsElement)
Returns the list of
FeatureFilter for tracks stored in this file. |
String |
getVersion()
Returns the version string stored in the file.
|
Collection<TrackMateModelView> |
getViews(ViewProvider provider,
Model model,
Settings settings,
SelectionModel selectionModel,
DisplaySettings displaySettings)
Returns the collection of views that were saved in this file.
|
boolean |
isReadingOk()
Returns
true if the last reading method call happened
without any warning or error, false otherwise. |
ij.ImagePlus |
readImage() |
Settings |
readSettings(ij.ImagePlus imp) |
Settings |
readSettings(ij.ImagePlus imp,
DetectorProvider detectorProvider,
TrackerProvider trackerProvider,
SpotAnalyzerProvider spotAnalyzerProvider,
EdgeAnalyzerProvider edgeAnalyzerProvider,
TrackAnalyzerProvider trackAnalyzerProvider,
SpotMorphologyAnalyzerProvider spotMorphologyAnalyzerProvider)
Reads the settings element of the file, and sets the fields of the
specified
Settings object according to the xml file content. |
protected boolean |
readTracks(org.jdom2.Element modelElement,
Model model)
Load the tracks, the track features and the ID of the filtered tracks
into the model specified.
|
protected static void |
removeAttributeFromName(List<org.jdom2.Attribute> attributes,
String attributeNameToRemove) |
protected static final boolean DEBUG
protected org.jdom2.Document document
protected final File file
protected ConcurrentHashMap<Integer,Spot> cache
Spot.ID()
, and parsing them all to retrieve
the one with the right ID is a drag. We made this cache a
ConcurrentHashMap
because we hope to load large data in a
multi-threaded way.protected Logger.StringBuilderLogger logger
protected final org.jdom2.Element root
protected boolean ok
false
, an error occurred during reading.getErrorMessage()
public TmXmlReader(File file)
public String getLog()
null
if log text
was not saved.public String getGUIState()
public DisplaySettings getDisplaySettings()
public Collection<TrackMateModelView> getViews(ViewProvider provider, Model model, Settings settings, SelectionModel selectionModel, DisplaySettings displaySettings)
provider
- the ViewProvider
to instantiate the view. Each saved
view must be known by the specified provider.model
- the model to display in the views.settings
- the settings to build the views.selectionModel
- the SelectionModel
model that will be shared with the
new views.displaySettings
- the display settings to pass to the view.TrackMateModelView.render()
public Model getModel()
null
if a saved
model cannot be found in the xml file.Model
.protected Model createModel()
Model
that will be built upon loading
with this reader.Model
instance.public ij.ImagePlus readImage()
public Settings readSettings(ij.ImagePlus imp)
public Settings readSettings(ij.ImagePlus imp, DetectorProvider detectorProvider, TrackerProvider trackerProvider, SpotAnalyzerProvider spotAnalyzerProvider, EdgeAnalyzerProvider edgeAnalyzerProvider, TrackAnalyzerProvider trackAnalyzerProvider, SpotMorphologyAnalyzerProvider spotMorphologyAnalyzerProvider)
Settings
object according to the xml file content.imp
- detectorProvider
- the detector provider, required to configure the settings with
a correct SpotDetectorFactory
. If
null
, will skip reading detector parameters.trackerProvider
- the tracker provider, required to configure the settings with
a correct SpotTracker. If null
, will skip reading
tracker parameters.spotAnalyzerProvider
- the spot analyzer provider, required to instantiates the saved
SpotAnalyzerFactory
s. If null
, will
skip reading spot analyzers.edgeAnalyzerProvider
- the edge analyzer provider, required to instantiates the saved
EdgeAnalyzer
s. If null
, will skip reading
edge analyzers.trackAnalyzerProvider
- the track analyzer provider, required to instantiates the
saved TrackAnalyzer
s. If null
, will skip
reading track analyzers.public String getVersion()
public String getErrorMessage()
isReadingOk()
public boolean isReadingOk()
true
if the last reading method call happened
without any warning or error, false
otherwise.true
if reading was ok.getErrorMessage()
protected FeatureFilter getInitialFilter(org.jdom2.Element settingsElement)
null
if the initial threshold data cannot be found in the
file.settingsElement
- the settings Element
to read from.FeatureFilter
.protected List<FeatureFilter> getSpotFeatureFilters(org.jdom2.Element settingsElement)
FeatureFilter
for spots stored in this file.settingsElement
- the settings Element
to read from.FeatureFilter
s.protected List<FeatureFilter> getTrackFeatureFilters(org.jdom2.Element settingsElement)
FeatureFilter
for tracks stored in this file.settingsElement
- the settings Element
to read from.FeatureFilter
s.protected void getDetectorSettings(org.jdom2.Element settingsElement, Settings settings, DetectorProvider provider)
Settings
object with the
SpotDetectorFactory
and settings map fields named
Settings.detectorFactory
and Settings.detectorSettings
read within the XML file this reader is initialized with.settingsElement
- the Element in which the Settings
parameters are
stored.settings
- the base Settings
object to update.provider
- a DetectorProvider
, required to read detector
parameters.protected void getTrackerSettings(org.jdom2.Element settingsElement, Settings settings, TrackerProvider provider)
Settings
object with SpotTracker
proper settings map fields named Settings.trackerSettings
and
Settings.trackerFactory
read within the XML file this reader is
initialized with.
If the tracker settings or the tracker info can be read, but cannot be understood (most likely because the class the XML refers to is unknown) then a default object is substituted.
settingsElement
- the Element
in which the tracker parameters are
stored.settings
- the base Settings
object to update.provider
- the TrackerProvider
, required to read the tracker
parameters.protected boolean readTracks(org.jdom2.Element modelElement, Model model)
Copyright © 2015–2021 Fiji. All rights reserved.