Implemented an experimental executable for all systems, fixed a few errors, implemented first try for a median filter for the slices in Julia
This commit is contained in:
parent
59630bdd95
commit
63c7428214
40
app.jl
40
app.jl
@ -36,6 +36,7 @@ include("./julia_imzML_visual.jl")
|
||||
# Text field validations
|
||||
@in triqEnabled=false
|
||||
@in SpectraEnabled=false
|
||||
@in MFilterEnabled=false
|
||||
# Dialogs
|
||||
@in warning_msg=false
|
||||
@in CompareDialog=false
|
||||
@ -97,11 +98,15 @@ include("./julia_imzML_visual.jl")
|
||||
@in btnOptical=false
|
||||
@in btnOpticalT=false
|
||||
@in opticalOverTriq=false
|
||||
@out imgRoute=""
|
||||
|
||||
# Messages to interface variables
|
||||
@out msg=""
|
||||
@out msgimg=""
|
||||
@out msgtriq=""
|
||||
# Reiteration of the messages under the image to know which spectra is being visualized
|
||||
@out msgimgComp=""
|
||||
@out msgtriqComp=""
|
||||
|
||||
# Saves the route where imzML and mzML files are located
|
||||
@out full_route=""
|
||||
@ -292,12 +297,10 @@ include("./julia_imzML_visual.jl")
|
||||
msg="File exists, Nmass=$(Nmass) Tol=$(Tol). Loading file will begin, please be patient."
|
||||
try
|
||||
spectra=LoadImzml(full_route)
|
||||
msg="File loaded. Creating Spectra with the specific mass and tolerance, please be patient."
|
||||
try
|
||||
println(typeof(spectra))
|
||||
msg="File loaded. Creating spectra with the specific mass and tolerance, please be patient."
|
||||
slice=GetMzSliceJl(spectra,Nmass,Tol)
|
||||
catch e
|
||||
println("the error is in the slice: $e")
|
||||
end
|
||||
println(typeof(slice))
|
||||
fig=CairoMakie.Figure(size=(150, 250)) # Container
|
||||
# Append a query string to force the image to refresh
|
||||
timestamp=string(time_ns())
|
||||
@ -312,6 +315,10 @@ include("./julia_imzML_visual.jl")
|
||||
try
|
||||
slice=GetMzSliceJl(spectra, Nmass, Tol)
|
||||
sliceTriq=TrIQ(slice, colorLevel, triqProb)
|
||||
println(typeof(sliceTriq))
|
||||
if MFilterEnabled # If the Median filter is ON
|
||||
sliceTriq=medianFilterjl(sliceTriq)
|
||||
end
|
||||
valid_slice=true
|
||||
catch e
|
||||
msg="Warning: insufficient tolerance, inputs modified to allow the creation of an image regardless=$Tol: $e"
|
||||
@ -345,11 +352,14 @@ include("./julia_imzML_visual.jl")
|
||||
end
|
||||
else # If we don't use TrIQ
|
||||
image_path=joinpath("./public", "MSI_$(text_nmass).bmp")
|
||||
##sliceQuant=IntQuant(slice)
|
||||
try
|
||||
sliceQuant=IntQuantCl(slice,Int(colorLevel-1))
|
||||
println(typeof(sliceQuant))
|
||||
if MFilterEnabled # If the Median filter is ON
|
||||
sliceQuant=medianFilterjl(sliceQuant)
|
||||
end
|
||||
catch e
|
||||
println("the error is in the non triq slice: $e")
|
||||
println("The error is in the non triq slice: $e")
|
||||
end
|
||||
sliceQuant=reverse(sliceQuant, dims=2)
|
||||
SaveBitmapCl(joinpath("public", "MSI_$(text_nmass).bmp"),sliceQuant,ViridisPalette)
|
||||
@ -648,14 +658,14 @@ include("./julia_imzML_visual.jl")
|
||||
|
||||
text_nmass=replace(current_msiComp, "MSI_" => "")
|
||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
||||
msgimg="Image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
msgimgComp="Image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
# Process the image in the function
|
||||
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
||||
btnOpticalDisable=false
|
||||
else
|
||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||
plotdataImgComp=[traceImg]
|
||||
msgimg=""
|
||||
msgimgComp=""
|
||||
end
|
||||
end
|
||||
|
||||
@ -676,14 +686,14 @@ include("./julia_imzML_visual.jl")
|
||||
|
||||
text_nmass=replace(current_msiComp, "MSI_" => "")
|
||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
||||
msgimg="Image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
msgimgComp="Image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
# Process the image in the function
|
||||
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
||||
btnOpticalDisable=false
|
||||
else
|
||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||
plotdataImgComp=[traceImg]
|
||||
msgimg=""
|
||||
msgimgComp=""
|
||||
end
|
||||
end
|
||||
|
||||
@ -704,14 +714,14 @@ include("./julia_imzML_visual.jl")
|
||||
|
||||
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
||||
msgtriq="TrIQ image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
msgtriqComp="TrIQ image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
# Process the image in the function
|
||||
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
||||
btnOpticalDisable=false
|
||||
else
|
||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||
plotdataImgTComp=[traceImg]
|
||||
msgtriq=""
|
||||
msgtriqComp=""
|
||||
end
|
||||
end
|
||||
|
||||
@ -732,14 +742,14 @@ include("./julia_imzML_visual.jl")
|
||||
|
||||
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
||||
msgtriq="TrIQ image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
msgtriqComp="TrIQ image with the Nmass of $(replace(text_nmass, "_" => "."))"
|
||||
# Process the image in the function
|
||||
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
||||
btnOpticalDisable=false
|
||||
else
|
||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||
plotdataImgTComp=[traceImg]
|
||||
msgtriq=""
|
||||
msgtriqComp=""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -339,7 +339,7 @@
|
||||
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarComp"></q-img>
|
||||
</div>
|
||||
</div>
|
||||
<p>{{msgimg}}</p>
|
||||
<p>{{msgimgComp}}</p>
|
||||
</q-tab-panel>
|
||||
|
||||
<q-tab-panel name="tab1">
|
||||
@ -359,7 +359,7 @@
|
||||
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarTComp"></q-img>
|
||||
</div>
|
||||
</div>
|
||||
<p>{{msgtriq}}</p>
|
||||
<p>{{msgtriqComp}}</p>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="tab2">
|
||||
<!-- Content for Tab 2 -->
|
||||
|
||||
18
executable.sh
Executable file
18
executable.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
command="julia --project=. start_MSI_GUI.jl"
|
||||
|
||||
case "$OSTYPE" in
|
||||
linux*)
|
||||
$command
|
||||
;;
|
||||
darwin*)
|
||||
$command
|
||||
;;
|
||||
cygwin*|msys*|win32)
|
||||
julia --project=. start_MSI_GUI.jl
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported OS"
|
||||
;;
|
||||
esac
|
||||
@ -384,3 +384,28 @@ function log_tick_formatter(values::Vector{Float64})
|
||||
return map((v, e) -> e == 0 ? "$(round(v, sigdigits=2))" : "$(round(v, sigdigits=2))x10" * Makie.UnicodeFun.to_superscript(e), formValues, exponents)
|
||||
|
||||
end
|
||||
|
||||
# Median filter: an adaptation of the R medianfilter, which averages the matrix
|
||||
# with the close pixels just from the sides to reduce noise.
|
||||
# This one in particular is a midpoint fiter from a 3x3 neighbour area
|
||||
function medianFilterjl(pixMap)
|
||||
width, height = size(pixMap)
|
||||
target = zeros(eltype(pixMap), height, width)
|
||||
println("Matrix Dimensions: ", size(pixMap))
|
||||
|
||||
for j in 2:(width-1)
|
||||
for i in 2:(height-1)
|
||||
println("Current Indices: i = $i, j = $j")
|
||||
neighbors = []
|
||||
for dj in max(1, j-1):min(width, j+1)
|
||||
for di in max(1, i-1):min(height, i+1)
|
||||
push!(neighbors, pixMap[di, dj])
|
||||
end
|
||||
end
|
||||
target[i, j] = median(neighbors)
|
||||
end
|
||||
end
|
||||
|
||||
return target
|
||||
|
||||
end
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 285 KiB |
Loading…
x
Reference in New Issue
Block a user