3d plot fixes and UI corrections

This commit is contained in:
Pixelguy14 2025-01-15 15:45:03 -06:00
parent e3cd15157e
commit 13a5f7f222
4 changed files with 57 additions and 21 deletions

20
app.jl
View File

@ -58,17 +58,19 @@ end
@out btnStartDisable = true @out btnStartDisable = true
@out btnPlotDisable = true @out btnPlotDisable = true
@in warning_msg = false @in warning_msg = false
@in CompareDialog = false
# Interface Variables # Interface Variables
@in file_route = "" @in file_route = ""
@in file_name = "" @in file_name = ""
@in Nmass = 0.0 @in Nmass = 0.0
@in Tol = 0.0 @in Tol = 0.0
@in triqProb = 0.0 @in triqProb = 0.98
@in triqColor = 0 @in triqColor = 256
# Interface Buttons # Interface Buttons
@in mainProcess = false # To generate images @in mainProcess = false # To generate images
@in CompareBtn = false # to open dialog
@in createSumPlot = false # To generate sum spectrum plot @in createSumPlot = false # To generate sum spectrum plot
@in image3dPlot = false # To generate 3d plot based on current image @in image3dPlot = false # To generate 3d plot based on current image
@in triq3dPlot = false # To generate 3d plot based on current triq image @in triq3dPlot = false # To generate 3d plot based on current triq image
@ -438,7 +440,7 @@ end
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1 elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
#println("Elevation size:", size(elevation)) #println("Elevation size:", size(elevation))
# Smooth the image # Smooth the image
sigma = 1.0 sigma = 3.0
kernel = Kernel.gaussian(sigma) kernel = Kernel.gaussian(sigma)
#println(size(kernel)) #println(size(kernel))
elevation_smoothed = imfilter(elevation, kernel) elevation_smoothed = imfilter(elevation, kernel)
@ -455,7 +457,7 @@ end
x_nticks = min(20, length(x)) x_nticks = min(20, length(x))
y_nticks = min(20, length(y)) y_nticks = min(20, length(y))
z_nticks = 5 z_nticks = 5
aspect_ratio = attr(x = 1, y = length(y) / length(x), z = 1) aspect_ratio = attr(x = 1, y = length(y) / length(x), z = 0.5)
# Define the layout for the 3D plot # Define the layout for the 3D plot
layout3D = PlotlyBase.Layout( layout3D = PlotlyBase.Layout(
@ -513,7 +515,7 @@ end
img_array = Array(img_gray) img_array = Array(img_gray)
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1 elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image # Smooth the image
sigma = 4.0 sigma = 3.0
kernel = Kernel.gaussian(sigma) kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel) elevation_smoothed = imfilter(elevation, kernel)
@ -588,7 +590,7 @@ end
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1 elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image # Smooth the image
sigma = 4.0 sigma = 3.0
kernel = Kernel.gaussian(sigma) kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel) elevation_smoothed = imfilter(elevation, kernel)
@ -646,7 +648,7 @@ end
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1 elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image # Smooth the image
sigma = 4.0 sigma = 3.0
kernel = Kernel.gaussian(sigma) kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel) elevation_smoothed = imfilter(elevation, kernel)
@ -689,6 +691,10 @@ end
end end
end end
@onbutton CompareBtn begin
CompareDialog = true
end
GC.gc() # Trigger garbage collection GC.gc() # Trigger garbage collection
if Sys.islinux() if Sys.islinux()
ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS ccall(:malloc_trim, Int32, (Int32,), 0) # Ensure julia returns the freed memory to OS

View File

@ -70,7 +70,7 @@
<q-input standout="custom-standout" id="textNmass" step="0.01" v-model="Nmass" label="Mass-to-charge ratio of interest" type="number" :rules="[ val => !!val || '* Required', val => val >= 0.0 &amp;&amp; val <= 2000.0 || 'Need positive mass values',]"></q-input> <q-input standout="custom-standout" id="textNmass" step="0.01" v-model="Nmass" label="Mass-to-charge ratio of interest" type="number" :rules="[ val => !!val || '* Required', val => val >= 0.0 &amp;&amp; val <= 2000.0 || 'Need positive mass values',]"></q-input>
</div> </div>
<div class="st-col col-12 col-sm"> <div class="st-col col-12 col-sm">
<q-input standout="custom-standout" id="textTol" step="0.01" v-model="Tol" label="Mass-to-charge ratio Tolerance" type="number" :rules="[val => !!val || '* Required', val => val >= 0.0 &amp;&amp; val <= 1.0 || 'Needs to be in range between 0 and 1',]"></q-input> <q-input standout="custom-standout" id="textTol" step="0.01" v-model="Tol" label="Mass-to-charge ratio tolerance" type="number" :rules="[val => !!val || '* Required', val => val >= 0.0 &amp;&amp; val <= 1.0 || 'Needs to be in range between 0 and 1',]"></q-input>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -81,23 +81,28 @@
<!-- Triq Variable Manipulation --> <!-- Triq Variable Manipulation -->
<div class="row"> <div class="row">
<div class="st-col col-12 col-sm-8"> <div class="st-col col-12 col-sm-8">
<q-input standout="custom-standout" id="textTriqProb" step="0.01" v-model="triqProb" label="TrIQ Probability" type="number" :rules="[ <q-input standout="custom-standout" id="textTriqProb" step="0.01" v-model="triqProb" label="TrIQ probability" type="number" :rules="[
val => triqEnabled ? ( '* Required', val >= 0 &amp;&amp; val <= 1 || 'Needs to be in range between 0 and 1') : true val => triqEnabled ? ( '* Required', val >= 0 &amp;&amp; val <= 1 || 'Needs to be in range between 0 and 1') : true
]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input> ]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input>
</div> </div>
<div class="st-col col-12 col-sm-4"> <div class="st-col col-12 col-sm-4">
<q-input standout="custom-standout" id="textTriqColor" step="1" v-model="triqColor" label="TrIQ Color Levels" type="number" :rules="[ <q-input standout="custom-standout" id="textTriqColor" step="1" v-model="triqColor" label="TrIQ color levels" type="number" :rules="[
val => triqEnabled ? ( '* Required', val >= 0 &amp;&amp; val <= 256 || 'Needs to be in range between 1 and 256') : true val => triqEnabled ? ( '* Required', val >= 0 &amp;&amp; val <= 256 || 'Needs to be in range between 1 and 256') : true
]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input> ]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input>
</div> </div>
</div> </div>
<q-btn id="btnStyle" :loading="progress" :disabled="btnStartDisable" icon="play_arrow" v-on:click="mainProcess = true" padding="lg"> <div class = "row">
Start Process <q-btn id="btnStyle" :loading="progress" :disabled="btnStartDisable" icon="play_arrow" v-on:click="mainProcess = true" padding="lg">
<template v-slot:loading> Start Process
<q-spinner-hourglass class="on-left" /> <template v-slot:loading>
Loading... <q-spinner-hourglass class="on-left" />
</template> Loading...
</q-btn> </template>
</q-btn>
<q-btn id="btnStyle" icon="zoom_out_map" v-on:click="CompareBtn = true" padding="sm" class="on-right">
Compare
</q-btn>
</div>
<p>{{msg}}</p> <p>{{msg}}</p>
</div> </div>
</div> </div>
@ -161,7 +166,30 @@
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn flat label="OK" style="color:#009f90" v-close-popup /> <q-btn flat label="Ok" style="color:#009f90" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
<q-dialog v-model="CompareDialog" full-width>
<q-card>
<q-card-section>
<div class="text-h6">Compare two diferent images or plots in a larger screen</div>
</q-card-section>
<q-card-section class="q-pt-none col-12">
<div class="row">
<div class="col-6">
{{msg}}
</div>
<div class="col-6">
{{msg}}
</div>
</div>
</q-card-section>
<q-card-actions align="right">
<q-btn flat label="Done" style="color:#009f90" v-close-popup />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>

View File

@ -1,5 +1,4 @@
PENDING PENDING
Rmsi & julia coherence with image creation and colorbar Rmsi & julia coherence with image creation and colorbar
avoid image enlargement -> CURRENT WIP avoid image enlargement -> CURRENT WIP
image flip upside down image flip upside down
@ -10,6 +9,11 @@ PENDING
Possibility to add multiple imzML to process at once ? Possibility to add multiple imzML to process at once ?
Pixel selection marks Pixel selection marks
Rotate vertical images
Easier input for files
TrIQ default values
Comparative for two values
DONE DONE
Quicker start for julia GUI Quicker start for julia GUI
Better UI Better UI

View File

@ -6,8 +6,6 @@ Pkg.gc()
Pkg.add("Libz") ; Pkg.add("PlotlyBase") ; Pkg.add("CairoMakie") ; Pkg.add("Colors") ; Pkg.add("Statistics") ; Pkg.add("NaturalSort") ; Pkg.add("GenieFramework") ;Pkg.add("Genie") Pkg.add("Libz") ; Pkg.add("PlotlyBase") ; Pkg.add("CairoMakie") ; Pkg.add("Colors") ; Pkg.add("Statistics") ; Pkg.add("NaturalSort") ; Pkg.add("GenieFramework") ;Pkg.add("Genie")
Pkg.add(url="https://github.com/CINVESTAV-LABI/julia_mzML_imzML") # With this we ensure it uses the latest library iteration Pkg.add(url="https://github.com/CINVESTAV-LABI/julia_mzML_imzML") # With this we ensure it uses the latest library iteration
Pkg.add("Images") ; Pkg.add("LinearAlgebra") Pkg.add("Images") ; Pkg.add("LinearAlgebra")
Pkg.instantiate()
Pkg.update()
using Genie using Genie