Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flat label list tab #194

Merged
merged 121 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
bc09ec8
Import annotationsTab.vue
lehecht Oct 18, 2024
028e453
Add image annotation controller method
lehecht Oct 29, 2024
4a61ad7
Add largo annotationsTab component
lehecht Oct 29, 2024
2f61053
Return shapes to view
lehecht Oct 29, 2024
ea27e63
WIP: Add annotation tab functions
lehecht Oct 29, 2024
6790d4c
Make annotation selectable
lehecht Oct 30, 2024
3cc64b8
Display selected image annotation
lehecht Oct 30, 2024
030064f
Add get method in videoAnnotation controller
lehecht Oct 30, 2024
0cee1a2
Display video and image annotations
lehecht Oct 30, 2024
7dadcf1
Revert "Return shapes to view"
lehecht Oct 30, 2024
f60bd5a
Fix flat label view
lehecht Oct 30, 2024
3d7d7c3
Enable label (de)selection
lehecht Nov 4, 2024
0ec4881
Apply smaller changes
lehecht Nov 4, 2024
727062f
Remove comments and unsued parameter
lehecht Nov 4, 2024
4a616f5
Stream volume's annotation label data
lehecht Nov 11, 2024
b86e455
Change controller names
lehecht Nov 11, 2024
858a050
WIP: Process annotation stream
lehecht Nov 11, 2024
1405f82
Rename annotationLabel to label
lehecht Nov 12, 2024
633cc99
Rename api methods
lehecht Nov 12, 2024
ecde488
Process annotation labels to reuse them later
lehecht Nov 12, 2024
397b671
Update object key
lehecht Nov 12, 2024
250011a
Change comments
lehecht Nov 12, 2024
6d8ab24
Simplify code
lehecht Nov 12, 2024
0f3d8c0
Fix lint error
lehecht Nov 12, 2024
4e5aa86
Move controller classes
lehecht Nov 13, 2024
0332b2f
Check selection status by using method
lehecht Nov 13, 2024
b6c91ab
Split methods
lehecht Nov 15, 2024
261f210
Add flat label tab for whole project
lehecht Nov 15, 2024
fe92f69
Add controller methods to get all labels used in project
lehecht Nov 15, 2024
39571eb
Improve memory usage in controller methods
lehecht Nov 20, 2024
0643194
Update response parsing
lehecht Nov 20, 2024
83579a1
Fix missing merge of image and video labels
lehecht Nov 20, 2024
b53e9bd
Remove log
lehecht Nov 20, 2024
3002ba7
Add tests for project's annotation labels
lehecht Nov 21, 2024
5ab8c18
Add tests for volume's annotation labels
lehecht Nov 21, 2024
b1b2538
Add php doc
lehecht Nov 21, 2024
fd52b3a
Simplify counting annotations
lehecht Nov 21, 2024
31acc63
WIP: Fix label count after relabeling
lehecht Nov 22, 2024
dbda54c
WIP: Fix label count after deleting annotations
lehecht Nov 25, 2024
d11d1a7
Disable flat label tab when relabeling
lehecht Nov 25, 2024
e215645
Fix label count after relabeling or deletion
lehecht Nov 25, 2024
3b85ba5
Revert unnecessary changes
lehecht Nov 27, 2024
2f3fce5
Revert changes
lehecht Nov 28, 2024
56c138a
Improve code consistency
lehecht Nov 28, 2024
65e5998
Fix not updating badge count
lehecht Nov 28, 2024
acc4443
Rename variables for better understanding
lehecht Nov 28, 2024
6196f05
Hide label selection message when loading
lehecht Nov 28, 2024
b39ac4e
Change comment
lehecht Nov 28, 2024
3bd68b1
Process annotation label only once
lehecht Nov 29, 2024
1631acd
Synchronize label selection in tabs
lehecht Dec 2, 2024
10957d4
Add label_tree_id to response
lehecht Dec 2, 2024
3ffa2f4
Update tests
lehecht Dec 2, 2024
5a3f2df
Add comments
lehecht Dec 2, 2024
1673447
Return only ids but not whole labels
lehecht Dec 3, 2024
2d6ef8f
Use labels from labeltrees
lehecht Dec 3, 2024
0f1c5b0
Rename methods
lehecht Dec 3, 2024
e5310a5
Save image and video annotations in projectLargoContainer
lehecht Dec 3, 2024
a8c1d79
Update tests
lehecht Dec 3, 2024
7218317
Commit npm run prod
lehecht Dec 3, 2024
0b97310
Fix wrong annotation badge count
lehecht Dec 3, 2024
5ee59c1
Remove label if no annotation exists in annotation tab
lehecht Dec 3, 2024
fb190a8
Add new label during relabeing
lehecht Dec 4, 2024
4d359aa
Fix lint error
lehecht Dec 4, 2024
98c171b
Remove unused import
lehecht Dec 4, 2024
3d24254
Smaller changes
lehecht Dec 4, 2024
093aafd
Update api doc
lehecht Dec 4, 2024
d2b0aac
Commit npm run prod
lehecht Dec 4, 2024
151c41d
Move tab to second position
lehecht Dec 12, 2024
3fceac3
Rename tab
lehecht Dec 12, 2024
61f8e4a
Prevent padding removal after label selection
lehecht Dec 12, 2024
2e3008e
Process labels only
lehecht Jan 10, 2025
e84a67d
Return volume annotation labels only
lehecht Jan 10, 2025
0056495
Return projects annotation labels only
lehecht Jan 10, 2025
f465190
Remove unused imports
lehecht Jan 10, 2025
b3833a8
Update api doc
lehecht Jan 13, 2025
864d90f
Fix missing highlighting for selected label
lehecht Jan 15, 2025
24a4821
Fix bug with labelItems reactivity
lehecht Jan 15, 2025
ae0c01b
Update api docs
lehecht Jan 15, 2025
6e187fa
Update tests
lehecht Jan 16, 2025
8ab6028
Minor changes
lehecht Jan 16, 2025
a18b5e0
Edit api docs
lehecht Jan 16, 2025
ddab9d8
Remove new line
lehecht Jan 16, 2025
0c72a2a
Update assets
lehecht Jan 16, 2025
a55cacc
Use volume's single api point to return label counts
lehecht Jan 22, 2025
04e4527
Use volume's single api point to request label counts
lehecht Jan 22, 2025
4ed458c
Use project's single api point to return label counts
lehecht Jan 23, 2025
f1d4d00
Use project's single api point to request label counts
lehecht Jan 23, 2025
3a8d915
Edit url
lehecht Jan 23, 2025
06f0fe0
Fetch label count after changing annotation labels
lehecht Jan 23, 2025
968069d
Rename methods
lehecht Jan 23, 2025
6ee66a8
Move web api
lehecht Jan 23, 2025
701cd6d
Move volume related code to volume largoContainer
lehecht Jan 23, 2025
e788428
Rename method
lehecht Jan 23, 2025
e0eec15
Restrict selection query
lehecht Jan 24, 2025
3776d35
Add comment
lehecht Jan 24, 2025
a13f0af
Fix error for labels without label tree
lehecht Jan 24, 2025
3b67fb5
Add and use own scss classes
lehecht Jan 24, 2025
42ae0f8
Update tests
lehecht Jan 27, 2025
dbe6da7
Revert unnecessary changes
lehecht Jan 27, 2025
edda49c
Update php doc
lehecht Jan 27, 2025
ad7eac6
Add new line at end of file
lehecht Jan 27, 2025
4346902
Change api method name
lehecht Jan 27, 2025
e62d8e3
Rename variable
lehecht Jan 27, 2025
6b43df9
Edit comment
lehecht Jan 27, 2025
db4486f
Change tab name
lehecht Jan 27, 2025
a70b18b
Remove unused computed property
lehecht Jan 27, 2025
0934bcb
Add comment
lehecht Jan 27, 2025
3c34a71
Remove unused variable
lehecht Jan 27, 2025
5ee4e59
Update assets
lehecht Jan 27, 2025
91b0883
Add sorting for project labels
lehecht Jan 30, 2025
313c9a8
Fix missing label sorting by using array
lehecht Jan 30, 2025
cc998d5
Update php doc
lehecht Jan 30, 2025
0398b6c
Filter labels if annotation session is active
lehecht Jan 30, 2025
918cec2
Add tests
lehecht Jan 30, 2025
8458b1e
Remove unused argument
lehecht Jan 30, 2025
56c6bab
Add missing query for videos
lehecht Jan 30, 2025
7651829
Add missing tests for videos
lehecht Jan 30, 2025
4c78a8b
Add missing id access
lehecht Jan 30, 2025
9c3f186
Compile assets
mzur Jan 30, 2025
47795de
Update manual article for label list tab
mzur Jan 30, 2025
84f2fe7
Merge branch 'master' into flat-label-list-tab
mzur Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Biigle\Modules\Largo\Http\Controllers\Api\Projects;

use Biigle\Project;
use Biigle\Http\Controllers\Api\Controller;
use Biigle\ImageAnnotation;
use Biigle\Project;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Biigle\Http\Controllers\Api\Controller;

class FilterImageAnnotationsByLabelController extends Controller
{
Expand Down Expand Up @@ -50,44 +49,4 @@ public function index(Request $request, $pid, $lid)
->orderBy('image_annotations.id', 'desc')
->pluck('images.uuid', 'image_annotations.id');
}

/**
* Get all image labels and annotation count for a given project
*
* @api {get}
* @apiGroup Projects
* @apiName test
* @apiParam {Number} id The Project ID
* @apiPermission user
* @apiDescription Returns a collection of project image labels and annotation label counts
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "parent_id":null,
* "label_tree_id":1,
* "source_id":null,
* "label_source_id":null,
* "uuid":"6d2e6061-9ed1-41df-92f0-4862d0d4b12e",
* "count":10}]
*
* @param int $id Project ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getProjectsAnnotationLabels($id)
{
$project = Project::findOrFail($id);
$this->authorize('access', $project);

return DB::table('labels')
->join('image_annotation_labels', 'labels.id', '=', 'image_annotation_labels.label_id')
->join('image_annotations', 'image_annotation_labels.annotation_id', '=', 'image_annotations.id')
->join('images', 'image_annotations.image_id', '=', 'images.id')
->join('project_volume', 'images.volume_id', '=', 'project_volume.volume_id')
->where('project_volume.project_id','=',$id)
->select('labels.*', DB::raw('COUNT(labels.id) as count'))
->groupBy('labels.id')
->get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Biigle\Modules\Largo\Http\Controllers\Api\Projects;

use Biigle\Http\Controllers\Api\Controller;
use Biigle\Project;
use Biigle\VideoAnnotation;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Biigle\Http\Controllers\Api\Controller;

class FilterVideoAnnotationsByLabelController extends Controller
{
Expand Down Expand Up @@ -50,44 +49,4 @@ public function index(Request $request, $pid, $lid)
->orderBy('video_annotations.id', 'desc')
->pluck('videos.uuid', 'video_annotations.id');
}

/**
* Get all video labels and annotation count for a given project
*
* @api {get}
* @apiGroup Projects
* @apiName test
* @apiParam {Number} id The Project ID
* @apiPermission user
* @apiDescription Returns a collection of project video labels and annotation label counts
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "parent_id":null,
* "label_tree_id":1,
* "source_id":null,
* "label_source_id":null,
* "uuid":"6d2e6061-9ed1-41df-92f0-4862d0d4b12e",
* "count":10}]
*
* @param int $id Project ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getProjectsAnnotationLabels($id)
{
$project = Project::findOrFail($id);
$this->authorize('access', $project);

return DB::table('labels')
->join('video_annotation_labels', 'labels.id', '=', 'video_annotation_labels.label_id')
->join('video_annotations', 'video_annotation_labels.annotation_id', '=', 'video_annotations.id')
->join('videos', 'video_annotations.video_id', '=', 'videos.id')
->join('project_volume', 'videos.volume_id', '=', 'project_volume.volume_id')
->where('project_volume.project_id','=',$id)
->select('labels.*', DB::raw('COUNT(labels.id) as count'))
->groupBy('labels.id')
->get();
}
}
60 changes: 60 additions & 0 deletions src/Http/Controllers/Api/Projects/ProjectAnnotationLabels.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Biigle\Modules\Largo\Http\Controllers\Api\Projects;

use Biigle\Label;
use Biigle\Project;
use Illuminate\Support\Facades\DB;
use Biigle\Http\Controllers\Api\Controller;

class ProjectAnnotationLabels extends Controller
{
/**
* Get all image labels and annotation count for a given project
*
* @api {get} projects/:pid/label-count Get annotation labels with a annotation count
* @apiGroup Projects
* @apiName test
* @apiParam {Number} id The Project ID
* @apiPermission projectMember
* @apiDescription Returns a collection of project image labels and annotation label counts
mzur marked this conversation as resolved.
Show resolved Hide resolved
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "label_tree_id":1,
* "count":10}]
*
* @param int $id Project ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getProjectAnnotationLabelCounts($id)
{
$project = Project::findOrFail($id);
$this->authorize('access', $project);

$imageLabelQuery = Label::query()
->join('image_annotation_labels', 'labels.id', '=', 'image_annotation_labels.label_id')
->join('image_annotations', 'image_annotation_labels.annotation_id', '=', 'image_annotations.id')
->join('images', 'image_annotations.image_id', '=', 'images.id')
->join('project_volume', 'images.volume_id', '=', 'project_volume.volume_id')
->where('project_volume.project_id', '=', $id)
->select('labels.*');

$videoLabelQuery = Label::query()
->join('video_annotation_labels', 'labels.id', '=', 'video_annotation_labels.label_id')
->join('video_annotations', 'video_annotation_labels.annotation_id', '=', 'video_annotations.id')
->join('videos', 'video_annotations.video_id', '=', 'videos.id')
->join('project_volume', 'videos.volume_id', '=', 'project_volume.volume_id')
->where('project_volume.project_id', '=', $id)
->select('labels.*');

$union = $videoLabelQuery->unionAll($imageLabelQuery);

return DB::query()->fromSub($union, 'labels')
->selectRaw('labels.id, labels.name, labels.color, labels.label_tree_id, count(labels.id) as count')
->groupBy(['labels.id', 'labels.name', 'labels.color', 'labels.label_tree_id'])
->get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Biigle\Modules\Largo\Http\Controllers\Api\Volumes;

use Biigle\Volume;
use Biigle\Http\Controllers\Api\Controller;
use Biigle\ImageAnnotation;
use Biigle\Volume;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Biigle\Http\Controllers\Api\Controller;

class FilterImageAnnotationsByLabelController extends Controller
{
Expand Down Expand Up @@ -59,43 +58,4 @@ public function index(Request $request, $vid, $lid)
->orderBy('image_annotations.id', 'desc')
->pluck('images.uuid', 'image_annotations.id');
}

/**
* Get all image labels and annotation count for a given volume
*
* @api {get}
* @apiGroup Volumes
* @apiName test
* @apiParam {Number} id The Volume ID
* @apiPermission user
* @apiDescription Returns a collection of project image labels, and annotation label counts
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "parent_id":null,
* "label_tree_id":1,
* "source_id":null,
* "label_source_id":null,
* "uuid":"6d2e6061-9ed1-41df-92f0-4862d0d4b12e",
* "count":10}]
*
* @param int $id Volume ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getVolumeAnnotationLabels($id)
{
$volume = Volume::findOrFail($id);
$this->authorize('access', $volume);

return DB::table('labels')
->join('image_annotation_labels', 'labels.id', '=', 'image_annotation_labels.label_id')
->join('image_annotations', 'image_annotation_labels.annotation_id', '=', 'image_annotations.id')
->join('images', 'image_annotations.image_id', '=', 'images.id')
->where('images.volume_id','=',$id)
->select('labels.*', DB::raw('COUNT(labels.id) as count'))
->groupBy('labels.id')
->get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Biigle\Modules\Largo\Http\Controllers\Api\Volumes;

use Biigle\Volume;
use Biigle\Http\Controllers\Api\Controller;
use Biigle\VideoAnnotation;
use Biigle\Volume;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Biigle\Http\Controllers\Api\Controller;

class FilterVideoAnnotationsByLabelController extends Controller
{
Expand Down Expand Up @@ -59,43 +58,4 @@ public function index(Request $request, $vid, $lid)
->orderBy('video_annotations.id', 'desc')
->pluck('videos.uuid', 'video_annotations.id');
}

/**
* Get all video annotations and annotation count for a given volume
*
* @api {get}
* @apiGroup Volumes
* @apiName test
* @apiParam {Number} id The Volume ID
* @apiPermission user
* @apiDescription Returns a collection of project video labels and annotation label counts
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "parent_id":null,
* "label_tree_id":1,
* "source_id":null,
* "label_source_id":null,
* "uuid":"6d2e6061-9ed1-41df-92f0-4862d0d4b12e",
* "count":10}]
*
* @param int $id Volume ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getVolumeAnnotationLabels($id)
{
$volume = Volume::findOrFail($id);
$this->authorize('access', $volume);

return DB::table('labels')
->join('video_annotation_labels', 'labels.id', '=', 'video_annotation_labels.label_id')
->join('video_annotations', 'video_annotation_labels.annotation_id', '=', 'video_annotations.id')
->join('videos', 'video_annotations.video_id', '=', 'videos.id')
->where('videos.volume_id','=',$id)
->select('labels.*', DB::raw('COUNT(labels.id) as count'))
->groupBy('labels.id')
->get();
}
}
56 changes: 56 additions & 0 deletions src/Http/Controllers/Api/Volumes/VolumeAnnotationLabels.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Biigle\Modules\Largo\Http\Controllers\Api\Volumes;

use Biigle\Label;
use Biigle\Volume;
use Biigle\Http\Controllers\Api\Controller;

class VolumeAnnotationLabels extends Controller
{
/**
* Get all annotation labels and annotation count for a given volume
*
* @api {get} volumes/:vid/label-count Get annotation labels with a annotation count
* @apiGroup Volumes
* @apiName test
* @apiParam {Number} id The Volume ID
* @apiPermission projectMember
* @apiDescription Returns a collection of project image labels and annotation label counts
mzur marked this conversation as resolved.
Show resolved Hide resolved
*
* @apiSuccessExample {json} Success response:
* [{"id":1,
* "name":"a",
* "color":"f2617c",
* "label_tree_id":1,
* "count":10}]
*
* @param int $id Volume ID
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getVolumeAnnotationLabels($id)
{
$volume = Volume::findOrFail($id);
$this->authorize('access', $volume);

if ($volume->isImageVolume()) {
$labelQuery = Label::query()
->join('image_annotation_labels', 'labels.id', '=', 'image_annotation_labels.label_id')
->join('image_annotations', 'image_annotation_labels.annotation_id', '=', 'image_annotations.id')
->join('images', 'image_annotations.image_id', '=', 'images.id')
->where('images.volume_id', '=', $id);
} else {
$labelQuery = Label::query()
->join('video_annotation_labels', 'labels.id', '=', 'video_annotation_labels.label_id')
->join('video_annotations', 'video_annotation_labels.annotation_id', '=', 'video_annotations.id')
->join('videos', 'video_annotations.video_id', '=', 'videos.id')
->where('videos.volume_id', '=', $id);
}

return $labelQuery
->selectRaw('labels.id, labels.name, labels.color, labels.label_tree_id, count(labels.id) as count')
->groupBy(['labels.id', 'labels.name', 'labels.color', 'labels.label_tree_id'])
->orderBy('labels.name')
->get();
}
}
16 changes: 4 additions & 12 deletions src/Http/routes.php
mzur marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
'uses' => 'Projects\FilterVideoAnnotationsByLabelController@index',
]);

$router->get('projects/{id}/image-annotations', [
'uses' => 'Projects\FilterImageAnnotationsByLabelController@getProjectsAnnotationLabels',
]);

$router->get('projects/{id}/video-annotations', [
'uses' => 'Projects\FilterVideoAnnotationsByLabelController@getProjectsAnnotationLabels',
$router->get('projects/{id}/label-count', [
'uses' => 'Projects\ProjectAnnotationLabels@getProjectAnnotationLabelCounts',
]);

$router->get('volumes/{id}/annotations/sort/outliers/{id2}', [
Expand All @@ -85,11 +81,7 @@
'uses' => 'Volumes\FilterVideoAnnotationsByLabelController@index',
]);

$router->get('volume/{id}/image-annotations', [
'uses' => 'Volumes\FilterImageAnnotationsByLabelController@getVolumeAnnotationLabels'
]);

$router->get('volume/{id}/video-annotations', [
'uses' => 'Volumes\FilterVideoAnnotationsByLabelController@getVolumeAnnotationLabels'
$router->get('volume/{id}/label-count', [
'uses' => 'Volumes\VolumeAnnotationLabels@getVolumeAnnotationLabels'
]);
});
2 changes: 1 addition & 1 deletion src/public/assets/scripts/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/public/assets/styles/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/assets/scripts/main.js": "/assets/scripts/main.js?id=54cd6e3415a851a07e5ca29273b2a5f9",
"/assets/styles/main.css": "/assets/styles/main.css?id=68a88f330c08af97df1d47c207ea8ccb"
"/assets/scripts/main.js": "/assets/scripts/main.js?id=621b7f4dea48e1a93d3d04910a9a8da7",
"/assets/styles/main.css": "/assets/styles/main.css?id=0ef4b3ef391cbeaff5022f2ba61a6b05"
}
Loading