kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #1030 from pierotofy/potfix
Add additional statistics on task items in dashboardpull/1037/head
commit
4daa261f7d
|
@ -40,6 +40,7 @@ class TaskSerializer(serializers.ModelSerializer):
|
|||
processing_node = serializers.PrimaryKeyRelatedField(queryset=ProcessingNode.objects.all())
|
||||
processing_node_name = serializers.SerializerMethodField()
|
||||
can_rerun_from = serializers.SerializerMethodField()
|
||||
statistics = serializers.SerializerMethodField()
|
||||
|
||||
def get_processing_node_name(self, obj):
|
||||
if obj.processing_node is not None:
|
||||
|
@ -47,6 +48,9 @@ class TaskSerializer(serializers.ModelSerializer):
|
|||
else:
|
||||
return None
|
||||
|
||||
def get_statistics(self, obj):
|
||||
return obj.get_statistics()
|
||||
|
||||
def get_can_rerun_from(self, obj):
|
||||
"""
|
||||
When a task has been associated with a processing node
|
||||
|
|
|
@ -347,6 +347,35 @@ class Task(models.Model):
|
|||
|
||||
return False
|
||||
|
||||
def get_statistics(self):
|
||||
"""
|
||||
Parse ODM's stats.json if available
|
||||
"""
|
||||
stats_json = self.assets_path("odm_report", "stats.json")
|
||||
if os.path.exists(stats_json):
|
||||
try:
|
||||
with open(stats_json) as f:
|
||||
j = json.loads(f.read())
|
||||
except Exception as e:
|
||||
logger.warning("Malformed JSON {}: {}".format(stats_json, str(e)))
|
||||
return {}
|
||||
|
||||
points = None
|
||||
if j.get('point_cloud_statistics', {}).get('dense', False):
|
||||
points = j.get('point_cloud_statistics', {}).get('stats', {}).get('statistic', [{}])[0].get('count')
|
||||
else:
|
||||
points = j.get('reconstruction_statistics', {}).get('reconstructed_points_count')
|
||||
|
||||
return {
|
||||
'pointcloud':{
|
||||
'points': points,
|
||||
},
|
||||
'gsd': j.get('odm_processing_statistics', {}).get('average_gsd'),
|
||||
'area': j.get('processing_statistics', {}).get('area')
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
def get_asset_download_path(self, asset):
|
||||
"""
|
||||
Get the path to an asset download
|
||||
|
|
|
@ -484,6 +484,8 @@ class TaskListItem extends React.Component {
|
|||
</div>);
|
||||
})}
|
||||
</div>);
|
||||
|
||||
const stats = task.statistics;
|
||||
|
||||
expanded = (
|
||||
<div className="expanded-panel">
|
||||
|
@ -512,7 +514,19 @@ class TaskListItem extends React.Component {
|
|||
<strong>{_("Options:")} </strong> {this.optionsToList(task.options)}<br/>
|
||||
</div>
|
||||
: ""}
|
||||
{/* TODO: List of images? */}
|
||||
|
||||
{stats && stats.gsd ?
|
||||
<div className="labels">
|
||||
<strong>{_("Average GSD:")} </strong> {stats.gsd.toFixed(2)} cm<br/>
|
||||
</div> : ""}
|
||||
{stats && stats.area ?
|
||||
<div className="labels">
|
||||
<strong>{_("Area:")} </strong> {stats.area.toFixed(2)} m²<br/>
|
||||
</div> : ""}
|
||||
{stats && stats.pointcloud && stats.pointcloud.points ?
|
||||
<div className="labels">
|
||||
<strong>{_("Reconstructed Points:")} </strong> {stats.pointcloud.points.toLocaleString()}<br/>
|
||||
</div> : ""}
|
||||
</div>
|
||||
|
||||
{this.state.view === 'console' ?
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "WebODM",
|
||||
"version": "1.9.3",
|
||||
"version": "1.9.4",
|
||||
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Ładowanie…
Reference in New Issue