In the middle of the desert you can say anything you want
Main links
slicerrc.py is a thing! sample: 3D-Slicer-Scripts/.slicerrc.py at master · jzeyl/3D-Slicer-Scripts · GitHub
Slicer custom application deployment to many computers - Development - 3D Slicer Community
SlicerQReads.exe --python-code "folder='S:\SlicerQREADS\TestImages'; import os; slicer.util.loadVolume(folder + '/' + os.listdir(folder)[0], {'singleFile': False})"
Slicer.exe --python-script "/full/path/to/myscript.py" --no-splash --no-main-window
3Slicer can run in Docker4
Slicer can run in webbrowser5
Slicer can run in jupyter5, including partially (e.g. only a single view etc!)
Slicer --help
:
--testing Activate testing mode. It implies --disable-settings and --ignore-slicerrc. (default: false)
--disable-python Disable python support. This is equivalent to build the application with Slicer_USE_PYTHONQT=OFF.
--python-script Python script to execute after slicer loads.
--python-code Python code to execute after slicer loads.
-c Python code to execute after slicer loads. By default, no modules are loaded and Slicer exits afterward.
--ignore-slicerrc Do not load the Slicer resource file (~/.slicerrc.py).
--additional-module-path Additional module path to consider when searching for modules to load.
--additional-module-paths List of additional module path to consider when searching for modules to load.
Slicer modules — todo, CLI things with easy arguments
Slicer extensions/modules creation
Extension manager
CI/CD exists for extensions published officially
Misc:
Script repository — 3D Slicer documentation has this:
This code snippet can be useful for sharing code in development without requiring a restart of Slicer.
Fazit:
Other bits
Run Slicer in your web browser - as a Jupyter notebook or as a full application - Announcements - 3D Slicer Community ↩︎
GitHub - Slicer/SlicerDocker: Build, package, test, and run 3D Slicer and Slicer Extensions in Docker. ↩︎
Run Slicer in your web browser - as a Jupyter notebook or as a full application - Announcements - 3D Slicer Community ↩︎ ↩︎
inotifywait(1) - Linux man page
#!/bin/sh
while inotifywait --format '%:e %f' p.* *.bib; do
sleep 1 # files get moved often
echo "rsync!"
rsync -avzirh --progress p.* *.bib me@server.net:dir
done
boltctl monitor
shows changes as they happens — nice when something breaks. I used to do a lot of watch boltctl list
before in this exact scenario
(having a monitor
subcommand in your thing says a lot about stuff, actually, — the best interpretation is that it’s written with developers in mind)
Very proud of this idea, haha :)
For absolute positioned elements one needs to “guess” the correct sizes etc., may not be trivial. Using a pixel ruler won’t help because the .absolute coords don’t map to the screen ones.
Solution:
.grid {
// https://stackoverflow.com/questions/4191260/drawing-a-grid-using-css
background-image:
repeating-linear-gradient(lightblue 0 2px, transparent 2px 100%),
repeating-linear-gradient(90deg, lightblue 0 2px, transparent 2px 100%);
background-size: 50px 50px;
//border: 2px solid red;
}
.smallgrid {
background-image:
repeating-linear-gradient(#ccc 0 1px, transparent 1px 100%),
repeating-linear-gradient(90deg, #ccc 0 1px, transparent 1px 100%);
background-size: 10px 10px;
width: 100%;
height: 100%;
}
::::: {.absolute left=0 right=0 top=0 bottom=0 .grid}
::: {.smallgrid}
:::
:::::
It’s not exactly aligned but close enough to judge the widths and heights involved!
Rectangle in the pic is:
:::: {.redrect .absolute right=200 top=130 width=200 height=100}
::::
(And the small grid can be omitted if not needed by removing the div in the middle. )
For bonus points, can be saved as a file and included if needed:
{\{< include ../_shared/smallgrid.qmd >}\}
ALSO:
// show the border of the slide
.reveal .slides {
border: 1px dashed red;
}
DAMN.
:::: {layout="1,1,1],[1],[1,1,1" layout-valign="center"}
if it’s a layout I do get a valign thing. I just have to use layouts, not columns. Damn.
This doesn’t work on SVGs for me:
![](images/02/svgs/02_seqsiii.svg){.absolute top=0 left=0}
This does:
::: {.absolute top=0 left=0}
![](images/02/svgs/02_seqsiii.svg)
:::
SO.
One can literally generate a plot w/ graphviz, export as svg, open and edit in inkscape, save as optimized svg, paste into quarto, and manually add the correct class="fragment" data-fragment-index=4
bits to the relevant groups.
Insert with the usual {=html} thing.
Damn.
almost works with quarto, except that line.position needs to be called on slide change — ergo likely won’t work in pdf export mode.
maurosilber/pyfragments: Animated figures for Quarto installs as-is
IT WORKS FOR PDF MODE TOO! And uses fragments
# | fig-width: 15
# | fig-height: 10
# | output: asis
import matplotlib.pyplot as plt
from pyfragments import AnimatedFigure
with AnimatedFigure() as ani:
# Data for plotting
train_loss = [1.0, 0.6, 0.3, 0.2, 0.1]
val_loss = [1.2, 0.8, 0.5, 0.4, 0.6]
iterations = [1, 2, 3, 4, 5]
plt.xlim(0, 6)
plt.ylim(0, 1.5)
# Labels and legend
plt.xlabel('Trainingsiterationen', fontsize=14)
plt.ylabel('Loss', fontsize=14)
plt.legend(loc='upper right', fontsize=12)
# Plot
for x in range(len(train_loss)+1):
with ani.fragment():
plt.plot(iterations[:x], train_loss[:x], 'bo-', label='Training', linewidth=2)
plt.plot(iterations[:x], val_loss[:x], 'go-', label='Validation', linewidth=2)
# Add a dashed vertical line in the middle
mid_iteration = (iterations[0] + iterations[-1]) / 2
with ani.fragment():
plt.axvline(x=mid_iteration, color='r', linestyle='--', linewidth=1.5)
I couldn’t make a graph large enough to fill the screen, increasing fig-width didn’t help.
Solution: increase both fig-width and fig-height!
{dot}
//| fig-width: 12
//| fig-height: 9
digraph G {
rankdir=LR;
..
Execution Options – Quarto has figure options that lists the default sizes of figures based on output formats. Couldn’t find them because was looking in figures/graphviz etc. pages, not execution. …
For reveal slides, it’s 9 x 5.
Apparently it didn’t want to increase the 5 till I explicitly told it to, then width started increasing as well.
… are hard and you have to use a table.
digraph Neural_Network {
rankdir=LR;
ranksep=1.3;
node [shape=circle, style=filled, fontcolor=white, fontsize=25, fillcolor="blue", color="black"];
subgraph cluster_0 {
node [fillcolor="#2c3e50", style="filled"];
x1 [label=<
<TABLE border="0" cellborder="0" cellspacing="0">
<TR><TD rowspan="2" style="...">X</TD><TD style="...">1</TD></TR>
<TR> <TD style="...">1</TD></TR>
</TABLE>>];
x2 [label=<
<TABLE border="0" cellborder="0" cellspacing="0">
<TR><TD rowspan="2" style="...">X</TD><TD style="...">1</TD></TR>
<TR> <TD style="...">2</TD></TR>
</TABLE>>];
}
sum [label=<∑<FONT color="yellow" point-size="10">(⎰)</FONT>>, fillcolor="#27ae60", width=0.8, height=0.8, fixedsize=true];
y [label=<y<sup>1</sup>>];
edge [style=solid, color="#2c3e50"];
x2 -> sum;
x1 -> sum;
edge [style=solid, color="#27ae60"];
sum -> y;
{rank=same; x1; x2;}
}