From 36505723374cc23a5117a982d6dba960930871f6 Mon Sep 17 00:00:00 2001
From: Pixelguy14 <160289138+Pixelguy14@users.noreply.github.com>
Date: Wed, 31 Jul 2024 19:34:54 -0600
Subject: [PATCH] Add files via upload
---
JuliaIMZML_GUI/Manifest.toml | 2 +-
JuliaIMZML_GUI/Project.toml | 1 +
JuliaIMZML_GUI/app.jl | 50 ++++++++++++++++-----------
JuliaIMZML_GUI/app.jl.html | 65 +++++++++++++++++++-----------------
4 files changed, 67 insertions(+), 51 deletions(-)
diff --git a/JuliaIMZML_GUI/Manifest.toml b/JuliaIMZML_GUI/Manifest.toml
index bf19f3f..b2bfb11 100644
--- a/JuliaIMZML_GUI/Manifest.toml
+++ b/JuliaIMZML_GUI/Manifest.toml
@@ -2,7 +2,7 @@
julia_version = "1.10.4"
manifest_format = "2.0"
-project_hash = "2289dc4b622847faad50ee48ccc2bada375b46bf"
+project_hash = "49392750aeb43599cd2d6b9c2e6f6cbff6f08de0"
[[deps.ArgParse]]
deps = ["Logging", "TextWrap"]
diff --git a/JuliaIMZML_GUI/Project.toml b/JuliaIMZML_GUI/Project.toml
index 0622fbb..9568e97 100644
--- a/JuliaIMZML_GUI/Project.toml
+++ b/JuliaIMZML_GUI/Project.toml
@@ -1,4 +1,5 @@
[deps]
+Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
GenieFramework = "a59fdf5c-6bf0-4f5d-949c-a137c9e2f353"
[Genie]
diff --git a/JuliaIMZML_GUI/app.jl b/JuliaIMZML_GUI/app.jl
index 5d66e0a..5f7dad3 100644
--- a/JuliaIMZML_GUI/app.jl
+++ b/JuliaIMZML_GUI/app.jl
@@ -21,7 +21,7 @@ function mean_value(x)
sum(x) / length(x)
end
-function contains_word(x, word)
+function contains_word(x, word) #ease to read
occursin(word, x)
end
@@ -33,8 +33,7 @@ end
# @out variables can only be modified by the backend
# @in variables can be modified by both the backend and the browser
# variables must be initialized with constant values, or variables defined outside of the @app block
- #@out test = "/wp.jpeg"#slash means it's getting the info from 'public' folder
- #@out test = "/95.bmp"
+ #@out test = "/test.bmp"#slash means it's getting the info from 'public' folder
#mkdir("new_folder")
@in file_route = ""
@in file_name = ""
@@ -42,7 +41,9 @@ end
@in Nmass = 0.0
@in Tol = 0.0
@in triqEnabled = false
+ @out Disab_btn = false
@in triqProb = 0.0
+ @in triqColor = 0
@in Main_Process = false
@out indeximg = 0
@out indeximgTriq = 0
@@ -65,6 +66,7 @@ end
@onchange triqEnabled begin
if !triqEnabled
triqProb = 0.0
+ triqColor = 0
end
end
@onchange file_name begin
@@ -85,34 +87,42 @@ end
# the onbutton handler will set the variable to false after the block is executed
#/home/julian/Documentos/Cinvestav_2024/Web/Archivos IMZML/royaimg.imzML
@onbutton Main_Process begin
+ GC.gc() # Trigger garbage collection
+ Disab_btn = true #We disable the button to avoid multiple requests
indeximg = Nmass
- full_route = joinpath( file_route, file_name )
+ full_route = joinpath(file_route, file_name)
if isfile(full_route)
- msg="File exists, Nmass=$(Nmass) Tol=$(Tol). Please do not press the start button until confirmation"
+ msg = "File exists, Nmass=$(Nmass) Tol=$(Tol). Please do not press the start button until confirmation"
spectra = LoadImzml(full_route)
msg = "File loaded. Please do not press the start button until confirmation"
slice = GetSlice(spectra, Nmass, Tol)
- if triqProb != 0 #if we have TrIQ
- SaveBitmap( joinpath( "public", "TrIQ_$(Int(Nmass)).bmp" ),
- TrIQ( slice, Int(Nmass), triqProb ),
- ViridisPalette )
- testT = "/TrIQ_$(Int(Nmass)).bmp"#we define the starting value of the images
+ if triqProb != 0 # if we have TrIQ
+ if triqColor < 1 || triqColor > 256
+ triqColor = 1
+ end
+ if triqProb < 0 || triqProb > 1
+ triqProb = 0.1
+ end
+ SaveBitmap(joinpath("public", "TrIQ_$(Int(Nmass)).bmp"),
+ TrIQ(slice, Int(triqColor), triqProb),
+ ViridisPalette)
+ testT = "/TrIQ_$(Int(Nmass)).bmp" # we define the starting value of the images
msgtriq = "TrIQ image with the Nmass of $(Int(Nmass))"
- else
- SaveBitmap( joinpath( "public", "$(Int(Nmass)).bmp" ),
- IntQuant( slice ),
- ViridisPalette )
- test = "/$(Int(Nmass)).bmp"#we define the starting value of the images
+ else # if we don't
+ SaveBitmap(joinpath("public", "$(Int(Nmass)).bmp"),
+ IntQuant(slice),
+ ViridisPalette)
+ test = "/$(Int(Nmass)).bmp" # we define the starting value of the images
msgimg = "image with the Nmass of $(Int(Nmass))"
end
- msg="The file has been created inside the 'public' folder of the app"
+ msg = "The file has been created inside the 'public' folder of the app"
else
- msg="File does not exist"
+ msg = "File does not exist"
end
- spectra = nothing #Important for memory cleaning
+ spectra = nothing # Important for memory cleaning
slice = nothing
- #Important for memory cleaning
- GC.gc()
+ GC.gc() # Trigger garbage collection
+ Disab_btn = false
end
@onbutton ImgMinus begin
indeximg-=1
diff --git a/JuliaIMZML_GUI/app.jl.html b/JuliaIMZML_GUI/app.jl.html
index 006be20..43c55f5 100644
--- a/JuliaIMZML_GUI/app.jl.html
+++ b/JuliaIMZML_GUI/app.jl.html
@@ -1,51 +1,57 @@
Julia mzML imzML GUI
full route: {{full_route}} {{warning_fr}}
-{{msg}}
{{msg}}
-{{msgtriq}}
-