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
|
# Text field validations
|
||||||
@in triqEnabled=false
|
@in triqEnabled=false
|
||||||
@in SpectraEnabled=false
|
@in SpectraEnabled=false
|
||||||
|
@in MFilterEnabled=false
|
||||||
# Dialogs
|
# Dialogs
|
||||||
@in warning_msg=false
|
@in warning_msg=false
|
||||||
@in CompareDialog=false
|
@in CompareDialog=false
|
||||||
@ -97,11 +98,15 @@ include("./julia_imzML_visual.jl")
|
|||||||
@in btnOptical=false
|
@in btnOptical=false
|
||||||
@in btnOpticalT=false
|
@in btnOpticalT=false
|
||||||
@in opticalOverTriq=false
|
@in opticalOverTriq=false
|
||||||
|
@out imgRoute=""
|
||||||
|
|
||||||
# Messages to interface variables
|
# Messages to interface variables
|
||||||
@out msg=""
|
@out msg=""
|
||||||
@out msgimg=""
|
@out msgimg=""
|
||||||
@out msgtriq=""
|
@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
|
# Saves the route where imzML and mzML files are located
|
||||||
@out full_route=""
|
@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."
|
msg="File exists, Nmass=$(Nmass) Tol=$(Tol). Loading file will begin, please be patient."
|
||||||
try
|
try
|
||||||
spectra=LoadImzml(full_route)
|
spectra=LoadImzml(full_route)
|
||||||
msg="File loaded. Creating Spectra with the specific mass and tolerance, please be patient."
|
println(typeof(spectra))
|
||||||
try
|
msg="File loaded. Creating spectra with the specific mass and tolerance, please be patient."
|
||||||
slice=GetMzSliceJl(spectra,Nmass,Tol)
|
slice=GetMzSliceJl(spectra,Nmass,Tol)
|
||||||
catch e
|
println(typeof(slice))
|
||||||
println("the error is in the slice: $e")
|
|
||||||
end
|
|
||||||
fig=CairoMakie.Figure(size=(150, 250)) # Container
|
fig=CairoMakie.Figure(size=(150, 250)) # Container
|
||||||
# Append a query string to force the image to refresh
|
# Append a query string to force the image to refresh
|
||||||
timestamp=string(time_ns())
|
timestamp=string(time_ns())
|
||||||
@ -312,6 +315,10 @@ include("./julia_imzML_visual.jl")
|
|||||||
try
|
try
|
||||||
slice=GetMzSliceJl(spectra, Nmass, Tol)
|
slice=GetMzSliceJl(spectra, Nmass, Tol)
|
||||||
sliceTriq=TrIQ(slice, colorLevel, triqProb)
|
sliceTriq=TrIQ(slice, colorLevel, triqProb)
|
||||||
|
println(typeof(sliceTriq))
|
||||||
|
if MFilterEnabled # If the Median filter is ON
|
||||||
|
sliceTriq=medianFilterjl(sliceTriq)
|
||||||
|
end
|
||||||
valid_slice=true
|
valid_slice=true
|
||||||
catch e
|
catch e
|
||||||
msg="Warning: insufficient tolerance, inputs modified to allow the creation of an image regardless=$Tol: $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
|
end
|
||||||
else # If we don't use TrIQ
|
else # If we don't use TrIQ
|
||||||
image_path=joinpath("./public", "MSI_$(text_nmass).bmp")
|
image_path=joinpath("./public", "MSI_$(text_nmass).bmp")
|
||||||
##sliceQuant=IntQuant(slice)
|
|
||||||
try
|
try
|
||||||
sliceQuant=IntQuantCl(slice,Int(colorLevel-1))
|
sliceQuant=IntQuantCl(slice,Int(colorLevel-1))
|
||||||
|
println(typeof(sliceQuant))
|
||||||
|
if MFilterEnabled # If the Median filter is ON
|
||||||
|
sliceQuant=medianFilterjl(sliceQuant)
|
||||||
|
end
|
||||||
catch e
|
catch e
|
||||||
println("the error is in the non triq slice: $e")
|
println("The error is in the non triq slice: $e")
|
||||||
end
|
end
|
||||||
sliceQuant=reverse(sliceQuant, dims=2)
|
sliceQuant=reverse(sliceQuant, dims=2)
|
||||||
SaveBitmapCl(joinpath("public", "MSI_$(text_nmass).bmp"),sliceQuant,ViridisPalette)
|
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(current_msiComp, "MSI_" => "")
|
||||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
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
|
# Process the image in the function
|
||||||
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
||||||
btnOpticalDisable=false
|
btnOpticalDisable=false
|
||||||
else
|
else
|
||||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||||
plotdataImgComp=[traceImg]
|
plotdataImgComp=[traceImg]
|
||||||
msgimg=""
|
msgimgComp=""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -676,14 +686,14 @@ include("./julia_imzML_visual.jl")
|
|||||||
|
|
||||||
text_nmass=replace(current_msiComp, "MSI_" => "")
|
text_nmass=replace(current_msiComp, "MSI_" => "")
|
||||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
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
|
# Process the image in the function
|
||||||
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
plotdataImgComp, plotlayoutImgComp, _, _=loadImgPlot(imgIntComp)
|
||||||
btnOpticalDisable=false
|
btnOpticalDisable=false
|
||||||
else
|
else
|
||||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||||
plotdataImgComp=[traceImg]
|
plotdataImgComp=[traceImg]
|
||||||
msgimg=""
|
msgimgComp=""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -704,14 +714,14 @@ include("./julia_imzML_visual.jl")
|
|||||||
|
|
||||||
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
||||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
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
|
# Process the image in the function
|
||||||
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
||||||
btnOpticalDisable=false
|
btnOpticalDisable=false
|
||||||
else
|
else
|
||||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||||
plotdataImgTComp=[traceImg]
|
plotdataImgTComp=[traceImg]
|
||||||
msgtriq=""
|
msgtriqComp=""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -732,14 +742,14 @@ include("./julia_imzML_visual.jl")
|
|||||||
|
|
||||||
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
text_nmass=replace(current_triqComp, "TrIQ_" => "")
|
||||||
text_nmass=replace(text_nmass, ".bmp" => "")
|
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
|
# Process the image in the function
|
||||||
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
plotdataImgTComp, plotlayoutImgTComp, _, _=loadImgPlot(imgIntTComp)
|
||||||
btnOpticalDisable=false
|
btnOpticalDisable=false
|
||||||
else
|
else
|
||||||
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
traceImg=PlotlyBase.heatmap(x=[], y=[])
|
||||||
plotdataImgTComp=[traceImg]
|
plotdataImgTComp=[traceImg]
|
||||||
msgtriq=""
|
msgtriqComp=""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -339,7 +339,7 @@
|
|||||||
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarComp"></q-img>
|
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarComp"></q-img>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>{{msgimg}}</p>
|
<p>{{msgimgComp}}</p>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
||||||
<q-tab-panel name="tab1">
|
<q-tab-panel name="tab1">
|
||||||
@ -359,7 +359,7 @@
|
|||||||
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarTComp"></q-img>
|
<q-img id="colorbar" class="q-ma-none q-pa-none" :src="colorbarTComp"></q-img>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>{{msgtriq}}</p>
|
<p>{{msgtriqComp}}</p>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="tab2">
|
<q-tab-panel name="tab2">
|
||||||
<!-- Content for Tab 2 -->
|
<!-- 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)
|
return map((v, e) -> e == 0 ? "$(round(v, sigdigits=2))" : "$(round(v, sigdigits=2))x10" * Makie.UnicodeFun.to_superscript(e), formValues, exponents)
|
||||||
|
|
||||||
end
|
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