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 btnPlotDisable = true
@in warning_msg = false
@in CompareDialog = false
# Interface Variables
@in file_route = ""
@in file_name = ""
@in Nmass = 0.0
@in Tol = 0.0
@in triqProb = 0.0
@in triqColor = 0
@in triqProb = 0.98
@in triqColor = 256
# Interface Buttons
@in mainProcess = false # To generate images
@in CompareBtn = false # to open dialog
@in createSumPlot = false # To generate sum spectrum plot
@in image3dPlot = false # To generate 3d plot based on current 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
#println("Elevation size:", size(elevation))
# Smooth the image
sigma = 1.0
sigma = 3.0
kernel = Kernel.gaussian(sigma)
#println(size(kernel))
elevation_smoothed = imfilter(elevation, kernel)
@ -455,7 +457,7 @@ end
x_nticks = min(20, length(x))
y_nticks = min(20, length(y))
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
layout3D = PlotlyBase.Layout(
@ -513,7 +515,7 @@ end
img_array = Array(img_gray)
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image
sigma = 4.0
sigma = 3.0
kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel)
@ -588,7 +590,7 @@ end
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image
sigma = 4.0
sigma = 3.0
kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel)
@ -646,7 +648,7 @@ end
elevation = Float32.(Array(img_gray)) ./ 255.0 # Normalize between 0 and 1
# Smooth the image
sigma = 4.0
sigma = 3.0
kernel = Kernel.gaussian(sigma)
elevation_smoothed = imfilter(elevation, kernel)
@ -689,6 +691,10 @@ end
end
end
@onbutton CompareBtn begin
CompareDialog = true
end
GC.gc() # Trigger garbage collection
if Sys.islinux()
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>
</div>
<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 class="row">
@ -81,23 +81,28 @@
<!-- Triq Variable Manipulation -->
<div class="row">
<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
]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input>
</div>
<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
]" :readonly="!triqEnabled" :disable="!triqEnabled"></q-input>
</div>
</div>
<q-btn id="btnStyle" :loading="progress" :disabled="btnStartDisable" icon="play_arrow" v-on:click="mainProcess = true" padding="lg">
Start Process
<template v-slot:loading>
<q-spinner-hourglass class="on-left" />
Loading...
</template>
</q-btn>
<div class = "row">
<q-btn id="btnStyle" :loading="progress" :disabled="btnStartDisable" icon="play_arrow" v-on:click="mainProcess = true" padding="lg">
Start Process
<template v-slot:loading>
<q-spinner-hourglass class="on-left" />
Loading...
</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>
</div>
</div>
@ -161,7 +166,30 @@
</q-card-section>
<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>
</q-dialog>

View File

@ -1,5 +1,4 @@
PENDING
Rmsi & julia coherence with image creation and colorbar
avoid image enlargement -> CURRENT WIP
image flip upside down
@ -10,6 +9,11 @@ PENDING
Possibility to add multiple imzML to process at once ?
Pixel selection marks
Rotate vertical images
Easier input for files
TrIQ default values
Comparative for two values
DONE
Quicker start for julia GUI
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(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.instantiate()
Pkg.update()
using Genie