From 98e93328a980a17ba3ab7bee5a74339f119442c9 Mon Sep 17 00:00:00 2001 From: Stephen Mather <1174901+smathermather@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:46:53 -0500 Subject: [PATCH] Upload align.laz along with Drone Images (#343) * Upload GCP along with Drone Images * Add align.laz to available uploads * Add descriptions for align * add align.laz modal --------- Co-authored-by: Niraj Adhikari --- src/backend/app/projects/image_processing.py | 12 +++++++++-- .../DescriptionSection/UploadsBox/index.tsx | 21 +++++++++++++++---- src/frontend/src/constants/modalContents.tsx | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/backend/app/projects/image_processing.py b/src/backend/app/projects/image_processing.py index f9b6020d..ae74ced9 100644 --- a/src/backend/app/projects/image_processing.py +++ b/src/backend/app/projects/image_processing.py @@ -49,7 +49,9 @@ def options_list_to_dict(self, options=[]): return opts def download_object(self, bucket_name: str, obj, images_folder: str): - if obj.object_name.endswith((".jpg", ".jpeg", ".JPG", ".png", ".PNG")): + if obj.object_name.endswith( + (".jpg", ".jpeg", ".JPG", ".png", ".PNG", ".txt", ".laz") + ): # Images and GCP File local_path = Path(images_folder) / Path(obj.object_name).name local_path.parent.mkdir(parents=True, exist_ok=True) get_file_from_bucket(bucket_name, obj.object_name, local_path) @@ -86,7 +88,13 @@ def list_images(self, directory): path = Path(directory) for file in path.rglob("*"): - if file.suffix.lower() in {".jpg", ".jpeg", ".png"}: + if file.suffix.lower() in { + ".jpg", + ".jpeg", + ".png", + ".txt", + ".laz", + }: # Images, GCP File, and align.laz images.append(str(file)) return images diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx index c88c0ae0..c7f91783 100644 --- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx +++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx @@ -6,7 +6,11 @@ import { toggleModal } from '@Store/actions/common'; import { setFiles } from '@Store/actions/droneOperatorTask'; import { useTypedDispatch, useTypedSelector } from '@Store/hooks'; -const UploadsBox = ({ label = 'Upload Raw Image' }: { label?: string }) => { +const UploadsBox = ({ + label = 'Upload Images, GCP, and align.laz', +}: { + label?: string; +}) => { const dispatch = useTypedDispatch(); const files = useTypedSelector(state => state.droneOperatorTask.files); const handleFileChange = (event: any) => { @@ -34,9 +38,18 @@ const UploadsBox = ({ label = 'Upload Raw Image' }: { label?: string }) => { cloud_upload -

- The supported file formats are .jpg, .jpeg, .png -

+
+

+ The supported file formats are .jpg, .jpeg, .png. +

+

+ The GCP file should be named gcp_list.txt +

+

+ The align file should be named align.laz +

+
+ {files.length > 0 && (

{files.length} items selected diff --git a/src/frontend/src/constants/modalContents.tsx b/src/frontend/src/constants/modalContents.tsx index 0ffc584c..f31689ed 100644 --- a/src/frontend/src/constants/modalContents.tsx +++ b/src/frontend/src/constants/modalContents.tsx @@ -36,7 +36,7 @@ export function getModalContent(content: ModalContentsType): ModalReturnType { case 'raw-image-preview': return { className: '!naxatw-w-[95vw] md:!naxatw-w-[60vw]', - title: 'Upload Raw Image', + title: 'Upload Images, GCP, and align.laz', content: , };