Skip to content

Commit

Permalink
Upload align.laz along with Drone Images (#343)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
smathermather and nrjadkry authored Nov 20, 2024
1 parent 1403824 commit 98e9332
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/backend/app/projects/image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -34,9 +38,18 @@ const UploadsBox = ({ label = 'Upload Raw Image' }: { label?: string }) => {
<span className="material-icons-outlined naxatw-text-red">
cloud_upload
</span>
<p className="naxatw-text-sm">
The supported file formats are .jpg, .jpeg, .png
</p>
<div className="naxatw-flex naxatw-flex-col naxatw-items-center naxatw-text-center">
<p className="naxatw-text-sm">
The supported file formats are .jpg, .jpeg, .png.
</p>
<p className="naxatw-text-sm">
The GCP file should be named gcp_list.txt
</p>
<p className="naxatw-text-sm">
The align file should be named align.laz
</p>
</div>

{files.length > 0 && (
<p className="naxatw-text-sm naxatw-text-green-700">
{files.length} items selected
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/constants/modalContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <ImageBoxPopOver />,
};

Expand Down

0 comments on commit 98e9332

Please sign in to comment.