<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Johannes W. Dietrich on Medium]]></title>
        <description><![CDATA[Stories by Johannes W. Dietrich on Medium]]></description>
        <link>https://medium.com/@jwdietrich?source=rss-107fdb07ecb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JRdeNyEMnpyk4gcTtcZNqw.png</url>
            <title>Stories by Johannes W. Dietrich on Medium</title>
            <link>https://medium.com/@jwdietrich?source=rss-107fdb07ecb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:44:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jwdietrich/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Analysing neuroscience imaging results with Object Pascal]]></title>
            <link>https://medium.com/scientific-pascal/analysing-neuroscience-imaging-results-with-object-pascal-749fffbeaeab?source=rss-107fdb07ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/749fffbeaeab</guid>
            <category><![CDATA[object-pascal]]></category>
            <category><![CDATA[pascal-programming]]></category>
            <category><![CDATA[neuroimaging]]></category>
            <category><![CDATA[visualisation]]></category>
            <category><![CDATA[scientific-pascal]]></category>
            <dc:creator><![CDATA[Johannes W. Dietrich]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 00:49:45 GMT</pubDate>
            <atom:updated>2025-01-26T00:49:45.806Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Neuroimaging delivers large datasets with a complex structure. The software used for analysis is a critical component in every research project. MRIcron, the most accepted tool for this purpose, is based on rather unconventional decisions made at the beginning of its development. They are the foundation of its success.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmXOMEvaJrvcha5Osbw4vA.png" /></figure><p><strong>MRIcron</strong> is a powerful visualisation tool for neuroimaging research. This software enables researchers to review raw or processed imaging datasets for artefacts, recognise anomalies, verify the accuracy of automated processing, and identify the location of statistical results within the complex structure of the human or mammalian brain. The cross-platform system runs natively on Windows, macOS, and Linux, as well as various hardware architectures such as x86, PowerPC, and ARM (including Apple Silicon).</p><figure><img alt="Screenshot of the MRIcron user interface on macOS. The main menu provides access to core functions. Users can change the crosshair position by clicking on the image or setting the coordinates in the top toolbar, allowing users to specify the crosshair coordinates (with X, Y, Z referring to the column, row and slice of the image)." src="https://cdn-images-1.medium.com/max/1006/1*AxeSzDdi8fDvoymYpT0AgQ.png" /></figure><p>MRIcron has been intentionally written in Object Pascal with the Lazarus IDE to support platform-sensitive development (using the write-once, compile and run-anywhere philosophy of Free Pascal and Lazarus) and to provide a processor-native high-performance software system. Therefore, the same functionality is available, regardless of whether the user prefers macOS, Linux or Windows. However, unlike in solutions written in Java or with Matlab or R, the software takes full advantage of the graphical user interface standards of the respective platform. Additionally, since Pascal is a compiled language, the software runs at the full machine speed of the processor. And, since MRIcron is native software, no additional packages or licenses, like S-Plus, R or Matlab, are required.</p><figure><img alt="Demo image. MRIcron introduced improved drawing tools to map lesions on individual participants (inset on right, sub-09) and create lesion incidence maps. The multicolored incidence map overlay shows the fractional incidence (thresholded for blue at 1% and red at 10%) for 1449 individuals. Both images from the Stroke Outcome Optimization Project (SOOP)" src="https://cdn-images-1.medium.com/max/711/1*W6v54ZtIQ_FGcU94TiQSuQ.png" /></figure><p>According to the CrossRef database, the original paper describing MRIcro, an early version of MRIcron, has been cited more than 2000 times.</p><p>Today, MRIcron is an exceptionally popular tool. It is listed as the top download on the NeuroImaging Tools &amp; Resources Collaboratory (NITRC) website.</p><p><strong>External links</strong></p><ul><li><a href="https://www.nitrc.org/projects/mricron/">MRIcron at NITRC</a></li><li><a href="https://github.com/neurolabusc/MRIcron/releases">MRIcron at GitHub</a></li></ul><p><strong>References</strong></p><ol><li>Rorden C, Brett M. Stereotaxic display of brain lesions. Behav Neurol. 2000;12(4):191–200. doi: 10.1155/2000/421719. PMID <a href="https://pubmed.ncbi.nlm.nih.gov/11568431/">11568431</a>.</li><li>Rorden C. From MRIcro to MRIcron: The evolution of neuroimaging visualization tools. Neuropsychologia. 2025 Jan 29;207:109067. doi: 10.1016/j.neuropsychologia.2025.109067. Epub 2025 Jan 4. PMID <a href="https://pubmed.ncbi.nlm.nih.gov/39761848/">39761848</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=749fffbeaeab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/scientific-pascal/analysing-neuroscience-imaging-results-with-object-pascal-749fffbeaeab">Analysing neuroscience imaging results with Object Pascal</a> was originally published in <a href="https://medium.com/scientific-pascal">Scientific Pascal</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assessing diagnostic tools in endocrinology with computer simulations]]></title>
            <link>https://medium.com/scientific-pascal/estimating-the-reliability-of-diagnostic-tools-in-endocrinology-with-computer-simulations-2efac70e3ca7?source=rss-107fdb07ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2efac70e3ca7</guid>
            <category><![CDATA[monte-carlo]]></category>
            <category><![CDATA[cybernetics]]></category>
            <category><![CDATA[object-pascal]]></category>
            <category><![CDATA[endocrinology]]></category>
            <category><![CDATA[simulation]]></category>
            <dc:creator><![CDATA[Johannes W. Dietrich]]></dc:creator>
            <pubDate>Sat, 27 Jul 2024 22:28:55 GMT</pubDate>
            <atom:updated>2024-07-28T11:50:26.412Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>The retest reliability, i.e. repeatability of results, is an important property and criterion for the quality of a diagnostic test. Poorly reproducible results are of limited utility.</p><p>This applies especially to endocrine systems. The concentration of important hormones is kept within narrow bounds by feedback control systems, following a central reference input (sometimes somewhat incorrectly referred to as “set point”). This physiological foundation results in low <a href="https://neverforget-1975.medium.com/understanding-ergodicity-db506dafc32c">ergodicity</a> of endocrine feedback loops.</p><p>The reference input may be genetically encoded, corresponding to an invariable set point. In this case, we describe the behaviour of the system as homeostatic (Fig. 1).</p><figure><img alt="A pure homeostatic system has a fixed set point and time-invariant parameters. Shown is a feedback loop with a constant reference input (set point)" src="https://cdn-images-1.medium.com/max/1024/1*3ZLM8W9l_UTVjCDYoogJRA.png" /><figcaption><strong><em>Fig. 1: </em></strong><em>A pure homeostatic system has a fixed set point and time-invariant parameters.</em></figcaption></figure><p>More common are allostatic modes of operation, where the reference input is variable (Fig. 2). In this case, the system can adapt to the changing requirements of an often unpredictable environment. Examples of this kind of influence include variations in the availability of nutrients, seasonal changes, illness and psychosocial stress.</p><figure><img alt="Allostatic systems can adapt, either via adjusting the responsivity of peripheral elements or via modified set points." src="https://cdn-images-1.medium.com/max/1024/1*-LcD31gzqZgmeVckiPivtA.png" /><figcaption><strong><em>Fig. 2: </em></strong><em>Allostatic systems can adapt, either via adjusting the responsivity of peripheral elements or via modified set points.</em></figcaption></figure><p>As a result of the described physiological foundations, the concentrations of most hormones have a lower variability if they have been obtained from repeated samples in one person compared to cross-sectional samples taken from different human beings (Fig. 3). In other words, the intraindividual variation of hormone concentrations is usually lower than their interindividual variation (Andersen et al. 2002, Larisch et al. 2015). Therefore, endocrine systems demonstrate a behaviour of low <a href="https://medium.com/datadriveninvestor/time-series-why-do-we-need-stationarity-and-ergodicity-f34d2a344458">ergodicity</a>.</p><figure><img alt="Intra- and interindividual distributions of TSH (left) and FT4 (right) concentrations" src="https://cdn-images-1.medium.com/max/645/1*jdb1ZK-78ilrU8KLRs7r7A.png" /><figcaption><strong>Fig. 3: </strong>Intra- and interindividual distributions of TSH (left) and FT4 (right) concentrations (Dietrich and Bazika-Gerasch 2022)</figcaption></figure><p>However, the clinical reality is more complex. Here, we deal with measurements of hormone concentrations. The exact concentrations are unknown. What we obtain and work with is the output of assay systems. Although modern assays have a high quality and deliver readouts close to the real concentrations, they also add some noise to the results.</p><p>The precision of an assay is measured with the coefficient of variation (CV), i.e. the ratio of the standard deviation (σ) and the mean (μ) of repeated measurements:</p><figure><img alt="CV = standard deviation / mean" src="https://cdn-images-1.medium.com/max/143/1*UZQINtaTDHg6Mblf7nRLZw.png" /></figure><p>It is known that the CV increases with decreasing concentration (Fig. 4). The concentration, where CV begins to exceed 20% is usually defined as the analytical (or functional) sensitivity of an assay. This is the minimum concentration that can be measured with sufficient accuracy.</p><figure><img alt="The analytical sensitivity of assays for thyrotropin and other metabolites improved over time with the progress in assay technology" src="https://cdn-images-1.medium.com/max/791/1*fB3SDoNn0ex2KjNC42WMFw.png" /><figcaption><strong>Fig. 4: </strong>The analytical sensitivity of assays for thyrotropin (TSH) and other metabolites improved over time with the progress in assay technology.</figcaption></figure><p>For thyroid-stimulating hormone (TSH) Clerico et al. describe the dependence of CV on concentration as</p><figure><img alt="CV = 11.653 * [TSH]^(-0.165)" src="https://cdn-images-1.medium.com/max/374/1*XA8GpLFNUXLwAyZFKjgxsg.png" /></figure><p>However, there is a more convincing way of formulating the relation between concentration and CV.</p><p>All variation results from noise. Basically, noise may be additive (i.e. a noise term is added to the true concentration) or multiplicative (i.e. the true concentration is multiplied with a factor in the vicinity of 1 that represents noise). Usually, multiplicative noise is of biological origin (e.g. due to variation in blood volume, production rates etc.), whereas additive noise is primarily caused by technical processes in the assay system.</p><p>Therefore, the readout of a hormone assay (the estimated concentration) may be modelled with compound noise, i.e. as the sum of additive noise and the product of the true concentration and multiplicative noise:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*fnYEEGG7_-j-7hDNHDQKRw.png" /></figure><p>We can simulate this behaviour with the following S script for R:</p><pre># Monte Carlo simulation of concentration-dependent CVs of thyroid hormone assays #<br># Version 2.1 (20160502)<br># Supplement to J. W. Dietrich et al. &quot;Calculated parameters of thyroid homeostasis: <br># Emerging tools for differential diagnosis and clinical research.&quot; Frontiers in Endocrinology<br><br># Total CVs according to published data:<br><br># TSH (Clerico et al. 2015:<br># 13.065% @ TSH = 0.5 mIU/l<br># 11.653% @ TSH = 1.0 mIU/l<br># 7.970% @ TSH = 10 mIU/l<br><br># FT4 (Beckman Coulter data sheet B01902B):<br># 9.2% @ FT4 = 4.6 ng/l (5.9 pmol/l)<br># 4.95% @ FT4 = 7.6 ng/l (9.8 pmol/l)<br># 4.32% @ FT4 = 20.4 ng/l (26.3 pmol/l)<br># 5.05% @ FT4 = 42.7 ng/l (55.0 pmol/l)<br><br># FT3 (Beckman Coulter data sheet A33734D):<br># 10.4% @ FT3 = 1.4 pg/ml (2.2 pmol/l)<br># 5.7% @ FT3 = 2,6 pg/ml (4.0 pmol/l)<br># 5.3% @ FT3 = 9.6 pg/ml (14.8 pmol/l)<br><br>SAMPLES &lt;- 50;<br><br>CV &lt;- function(x, ...)<br>{<br>  return(100 * sd(x, ...) / mean(x, ...));<br>}<br><br>TSH &lt;- seq(from = 0, to = 10, by = 0.1);<br>FT3 &lt;- seq(from = 2, to = 16, by = 0.14);<br>FT4 &lt;- seq(from = 5, to = 60, by = 0.55);<br>CV.TSH &lt;- seq(from = 0, to = 20, by = 0.2);<br>plot(TSH , CV.TSH, type=&quot;n&quot;,  ylim = c(5, 30), main = &quot;Compound noise explaining concentration-dependent CV&quot;, xlab = &quot;Real TSH&quot;, ylab = &quot;CV of measured TSH&quot;);<br>lines(TSH, 11.653 * TSH^-0.165, col = &quot;red&quot;);<br>lines(TSH, 100*(0.07 + 0.061/TSH ), col = &quot;blue&quot;);<br>legend(&quot;topright&quot;, legend = c(&quot;Clerico&#39;s equation&quot;, &quot;Compound equation&quot;), lwd = 1, col = c(&quot;red&quot;, &quot;blue&quot;));<br><br>measured.TSH.m &lt;- matrix(nrow = SAMPLES, ncol = length(TSH));<br>measured.TSH.a &lt;- matrix(nrow = SAMPLES, ncol = length(TSH));<br>measured.TSH.c &lt;- matrix(nrow = SAMPLES, ncol = length(TSH));<br>measured.FT3.m &lt;- matrix(nrow = SAMPLES, ncol = length(FT3));<br>measured.FT3.a &lt;- matrix(nrow = SAMPLES, ncol = length(FT3));<br>measured.FT3.c &lt;- matrix(nrow = SAMPLES, ncol = length(FT3));<br>measured.FT4.m &lt;- matrix(nrow = SAMPLES, ncol = length(FT4));<br>measured.FT4.a &lt;- matrix(nrow = SAMPLES, ncol = length(FT4));<br>measured.FT4.c &lt;- matrix(nrow = SAMPLES, ncol = length(FT4));<br><br>for (i in 1:length(TSH))<br>{<br>  multiplicative.noise &lt;- rnorm(n = SAMPLES , mean = 1, sd = 0.07);<br>  additive.noise &lt;- rnorm(n = SAMPLES , mean = 0, sd = 0.061);<br>  measured.TSH.m[,i] &lt;- TSH[i] * multiplicative.noise;<br>  measured.TSH.a[,i] &lt;- TSH[i] + additive.noise;<br>  measured.TSH.c[,i] &lt;- TSH[i] * multiplicative.noise + additive.noise;<br>}<br>for (i in 1:length(FT3))<br>{<br>  multiplicative.noise &lt;- rnorm(n = SAMPLES , mean = 1, sd = 0.05);<br>  additive.noise &lt;- rnorm(n = SAMPLES , mean = 0, sd = 0.20);<br>  measured.FT3.m[,i] &lt;- FT3[i] * multiplicative.noise;<br>  measured.FT3.a[,i] &lt;- FT3[i] + additive.noise;<br>  measured.FT3.c[,i] &lt;- FT3[i] * multiplicative.noise + additive.noise;<br>}<br>for (i in 1:length(FT4))<br>{<br>  multiplicative.noise &lt;- rnorm(n = SAMPLES , mean = 1, sd = 0.05);<br>  additive.noise &lt;- rnorm(n = SAMPLES , mean = 0, sd = 0.45);<br>  measured.FT4.m[,i] &lt;- FT4[i] * multiplicative.noise;<br>  measured.FT4.a[,i] &lt;- FT4[i] + additive.noise;<br>  measured.FT4.c[,i] &lt;- FT4[i] * multiplicative.noise + additive.noise;<br>}<br><br>mat &lt;- data.frame(id = 1:(SAMPLES * length(TSH)));<br>mat$TSH &lt;- rep(TSH, each = SAMPLES);<br>mat$measured.TSH.m &lt;- c(measured.TSH.m[,1:length(TSH)]);<br>mat$measured.TSH.a &lt;- c(measured.TSH.a[,1:length(TSH)]);<br>mat$measured.TSH.c &lt;- c(measured.TSH.c[,1:length(TSH)]);<br>mat$FT3 &lt;- rep(FT3, each = SAMPLES);<br>mat$measured.FT3.m &lt;- c(measured.FT3.m[,1:length(FT3)]);<br>mat$measured.FT3.a &lt;- c(measured.FT3.a[,1:length(FT3)]);<br>mat$measured.FT3.c &lt;- c(measured.FT3.c[,1:length(FT3)]);<br>mat$FT4 &lt;- rep(FT4, each = SAMPLES);<br>mat$measured.FT4.m &lt;- c(measured.FT4.m[,1:length(FT4)]);<br>mat$measured.FT4.a &lt;- c(measured.FT4.a[,1:length(FT4)]);<br>mat$measured.FT4.c &lt;- c(measured.FT4.c[,1:length(FT4)]);<br><br>mat$TSH.cat &lt;- cut(mat$TSH, breaks = seq(from=0, to=11, by=0.1), include.lowest = TRUE, right = FALSE);<br>mat$FT3.cat &lt;- cut(mat$FT3, breaks = seq(from=2, to=17, by=0.14), include.lowest = TRUE, right = FALSE);<br>mat$FT4.cat &lt;- cut(mat$FT4, breaks = seq(from=5, to=61, by=0.55), include.lowest = TRUE, right = FALSE);<br><br>plot(mat$measured.TSH.m ~ mat$TSH, pch = 19, main = &quot;Effect of multiplicative noise only&quot;, xlab = &quot;Simulated real TSH&quot;, ylab = &quot;Simulated measured TSH&quot;, col = &quot;darkred&quot;);<br>plot(mat$measured.TSH.a ~ mat$TSH, pch = 19, main = &quot;Effect of addititve noise only&quot;, xlab = &quot;Simulated real TSH&quot;, ylab = &quot;Simulated measured TSH&quot;, col = &quot;darkred&quot;);<br>plot(mat$measured.TSH.c ~ mat$TSH, pch = 19, main = &quot;Effect of combined additive and multiplicative noise&quot;, xlab = &quot;Simulated real TSH&quot;, ylab = &quot;Simulated measured TSH&quot;, col = &quot;darkred&quot;);<br>plot(mat$measured.FT3.m ~ mat$FT3, pch = 19, main = &quot;Effect of multiplicative noise only&quot;, xlab = &quot;Simulated real FT3&quot;, ylab = &quot;Simulated measured FT3&quot;, col = &quot;darkgreen&quot;);<br>plot(mat$measured.FT3.a ~ mat$FT3, pch = 19, main = &quot;Effect of addititve noise only&quot;, xlab = &quot;Simulated real FT3&quot;, ylab = &quot;Simulated measured FT3&quot;, col = &quot;darkgreen&quot;);<br>plot(mat$measured.FT3.c ~ mat$FT3, pch = 19, main = &quot;Effect of combined additive and multiplicative noise&quot;, xlab = &quot;Simulated real FT3&quot;, ylab = &quot;Simulated measured FT3&quot;, col = &quot;darkgreen&quot;);<br>plot(mat$measured.FT4.m ~ mat$FT4, pch = 19, main = &quot;Effect of multiplicative noise only&quot;, xlab = &quot;Simulated real FT4&quot;, ylab = &quot;Simulated measured FT4&quot;, col = &quot;darkblue&quot;);<br>plot(mat$measured.FT4.a ~ mat$FT4, pch = 19, main = &quot;Effect of addititve noise only&quot;, xlab = &quot;Simulated real FT4&quot;, ylab = &quot;Simulated measured FT4&quot;, col = &quot;darkblue&quot;);<br>plot(mat$measured.FT4.c ~ mat$FT4, pch = 19, main = &quot;Effect of combined additive and multiplicative noise&quot;, xlab = &quot;Simulated real FT4&quot;, ylab = &quot;Simulated measured FT4&quot;, col = &quot;darkblue&quot;);<br><br>cat(&quot;CV in relation to TSH value categories:\n&quot;);<br>print(CV.cat &lt;- tapply(mat$measured.TSH.c, mat$TSH.cat, CV));<br><br>plot(CV.cat, xaxt = &quot;n&quot;, ylim = c(5, 30), pch = 19, main = &quot;CV in relation to TSH value categories&quot;, xlab = &quot;TSH class&quot;, ylab = &quot;CV&quot;, col = &quot;darkred&quot;);<br>axis(side = 1, at = 1:length(CV.cat), labels = names(CV.cat));<br><br>cat(&quot;\nCV in relation to FT3 value categories:\n&quot;);<br>print(CV.cat &lt;- tapply(mat$measured.FT3.c, mat$FT3.cat, CV));<br><br>plot(CV.cat, xaxt = &quot;n&quot;, ylim = c(5, 30), pch = 19, main = &quot;CV in relation to FT3 value categories&quot;, xlab = &quot;FT3 class&quot;, ylab = &quot;CV&quot;, col = &quot;darkgreen&quot;);<br>axis(side = 1, at = 1:length(CV.cat), labels = names(CV.cat));<br><br>cat(&quot;\nCV in relation to FT4 value categories:\n&quot;);<br>print(CV.cat &lt;- tapply(mat$measured.FT4.c, mat$FT4.cat, CV));<br><br>plot(CV.cat, xaxt = &quot;n&quot;, ylim = c(5, 30), pch = 19, main = &quot;CV in relation to FT4 value categories&quot;, xlab = &quot;FT4 class&quot;, ylab = &quot;CV&quot;, col = &quot;darkblue&quot;);<br>axis(side = 1, at = 1:length(CV.cat), labels = names(CV.cat));</pre><p>Compound noise is a good approximation of the observed behaviour of hormone assays (Figs. 5 to 7).</p><figure><img alt="Plot showing simulated compound noise vs. a representation of Clerico’s equation explaining the relation between concentration and CV of a hormone assay" src="https://cdn-images-1.medium.com/max/1024/1*viJN6n8Qg9dNGTVUUmo4mQ.png" /><figcaption><strong>Fig. 5: </strong>Simulated compound noise (blue curve) provides a good approximation of the relation between a hormone concentration and the precision of an assay system. The results are similar to those of the empirical equation by Clerico et al. (red curve).</figcaption></figure><figure><img alt="Results of Monte Carlo simulations of TSH with compound noise. The abscissa represents the real TSH concentration, the ordinate represents the measured results delivered by the assay system." src="https://cdn-images-1.medium.com/max/1024/1*Pz9_JJGVYd5M5QbkdVJcWQ.png" /><figcaption><strong>Fig. 6: </strong>Results of Monte Carlo simulations of TSH with compound noise. The abscissa represents the real TSH concentration, the ordinate represents the measured results delivered by the assay system.</figcaption></figure><figure><img alt="Results of Monte Carlo simulations of TSH with compound noise. The abscissa represents the TSH concentration, the ordinate represents the coefficient of variation of the measurement." src="https://cdn-images-1.medium.com/max/1024/1*-22YpLsHXPGAvc7I4YP1Uw.png" /><figcaption><strong>Fig. 7: </strong>Results of Monte Carlo simulations of TSH with compound noise. The abscissa represents the TSH concentration, the ordinate represents the coefficient of variation of the measurement.</figcaption></figure><p>This technique can be used for <em>in silico</em> comparison of the reliability of measured hormone concentrations with that of the structure parameter inference approach of thyroid homeostasis (SPINA Thyr):</p><p>Simulating the behaviour of the feedback loop with SimThyr 4.0 delivers sets of concentrations of TSH, free thyroxine (FT4) and free triiodothyronine (FT3) concentrations. By systematically varying key structure parameters of the control system, <em>viz</em>. thyroid’s secretory capacity (GT) and the sum activity of peripheral step-up deiodinases (GD), and exposing the results to compound noise we get different point clouds for the respective configurations of the homeostatic system.</p><pre>unit Simulator;<br><br>{ SimThyr Project }<br>{ A numerical simulator of thyrotropic feedback control }<br><br>{ Version 4.0.0 (Merlion) }<br><br>{ (c) J. W. Dietrich, 1994 - 2017 }<br>{ (c) Ludwig Maximilian University of Munich 1995 - 2002 }<br>{ (c) Ruhr University of Bochum 2005 - 2017 }<br><br>{ This unit implements the main simulation methods }<br><br>{ Source code released under the BSD License }<br>{ See http://simthyr.sourceforge.net for details }<br><br>{$mode objfpc}<br>{$R+}<br>{$define UseCThreads}<br>{$ASSERTIONS ON}<br><br>interface<br><br>uses<br>  {$IFDEF UNIX}{$IFDEF UseCThreads}<br>  cthreads,<br>  {$ENDIF}{$ENDIF}<br>  Classes, Forms, SyncObjs, SysUtils, SimThyrTypes, SimThyrResources, SimThyrServices, SimThyrLog,<br>  SimThyrPlot, SimThyrPrediction, HandleNotifier, UnitConverter;<br><br>const<br>  THREE_FIFTH = 3 / 5; { optimization for speed }<br>  MAX_DEAD = 300;      { maximum queue length for dead-time interval element }<br><br>type<br>  TQueue_xt = array[0..MAX_DEAD] of real;<br>  TSimulationThread = class(TThread)<br>  public<br>    procedure Pause;<br>    procedure Restart;<br>    procedure Execute; override;<br>    procedure SafeFree;<br>  end;<br><br>var<br>  xt1, xt2, xt22, xt3, xt4: TQueue_xt;<br>  nt1, nt2, nt22, nt3, nt4: integer;<br>  i2, rastergap_text, rastergap_werte: integer;<br>  i: longint;<br>  SimCS: TCriticalSection;<br>  SimThread: TSimulationThread;<br><br>function cycles (var n: longint; n_text: str255): integer;<br>procedure InitSimulationControl;<br>procedure SimHypothalamus(const inv_hpd: real);<br>procedure SimPituitary(const gainOfTSH: real; const ultrashortFeedbackGain: real; memory: boolean);<br>procedure SimThyroidGland(const gainOfT4: real; memory: boolean);<br>procedure SimCentralDeiodination(const gainOfCentralT3: real; memory: boolean);<br>procedure SimPeripheralDeiodination(const gainOfPeripheralT3: real; memory: boolean);<br>procedure SetBaseVariables;<br>procedure StandardValues;<br>procedure InitSimulation;<br><br>implementation<br><br>{-----------------&gt; Blocks of feedback control &lt;--}<br><br> procedure pt1 (var vpt, tpt, x0, xe, ya: real);<br> {First order delay element, according to Neuber}<br>  var<br>   f: real;<br> begin<br>  assert((vpt &gt;= 0) and (tpt &gt;=0), kError101);<br>  f := exp(-delt / tpt);<br>  ya := f * x0 + vpt * (1 - f) * xe;<br>  x0 := ya;<br> end;<br><br><br> function pt0 (var xt: TQueue_xt; nt: integer; xe: real): real;<br> {dead-time element, according to Neuber, improved}<br>  var<br>   i: integer;<br> begin<br>  assert((nt &gt;= 0) and (nt &lt;= MAX_DEAD), kError101);<br>  pt0 := xt[nt];<br>  if nt &gt; 1 then<br>   begin<br>    for i := nt downto 1 do<br>     begin<br>      xt[i] := xt[i - 1]<br>     end;<br>   end;<br>  xt[1] := xe;<br>  xt[0] := xe;<br> end;<br><br><br>{-----------------&gt; Help routines &lt;--}<br><br> function InitialValues (var xt: TQueue_xt; nt: integer; xe: real): TQueue_xt;<br> {fills virtual signal memory (&quot;anfangswert&quot; in old SimThyr versions)}<br>  var<br>   i: integer;<br> begin<br>  assert((nt &gt;= 0) and (nt &lt;= MAX_DEAD), kError101);<br>  for i := 0 to nt do<br>   begin<br>    xt[i] := xe;<br>   end;<br>  InitialValues := xt;<br> end;<br><br> function cycles (var n: longint; n_text: str255): integer;<br> {determines number of loops from given simulation time (&quot;cycles&quot; in old SimThyr versions)}<br> begin<br>  assert(n &gt;= 0, kError101);<br>  if pos(&#39;w&#39;, n_text) &gt; 0 then<br>   factor := SECONDS_PER_WEEK<br>  else if ((pos(&#39;d&#39;, n_text) &gt; 0) or (pos(&#39;T&#39;, n_text) &gt; 0)) then<br>   factor := SECONDS_PER_DAY<br>  else if ((pos(&#39;h&#39;, n_text) &gt; 0) or (pos(&#39;St&#39;, n_text) &gt; 0)) then<br>   factor := SECONDS_PER_HOUR<br>  else if pos(&#39;m&#39;, n_text) &gt; 0 then<br>   factor := SECONDS_PER_MINUTE<br>  else if pos(&#39;s&#39;, n_text) &gt; 0 then<br>   factor := 1<br>  else<br>   factor := round(delt);<br>  cycles := round(n * factor / delt) + 1;<br> end;<br><br>function rnorm (mean, sd: real): real;<br>{Calculates Gaußian random numbers according to the Box-Müller approach}<br> var<br>  u1, u2: real;<br>begin<br>  assert(sd &gt;= 0, kError101);<br>  u1 := random;<br>  u2 := random;<br>  rnorm := mean * abs(1 + sqrt(-2 * (ln(u1))) * cos(2 * pi * u2) * sd);<br> end;<br><br> function getgauss (sigma: real): real;<br> {controllable function to calculate random numbers of a normal distribution}<br> begin<br>  assert(sigma &gt;= 0, kError101);<br>  if noiseflag then<br>   begin<br>    getgauss := rnorm(1, sigma);<br>   end<br>  else<br>   getgauss := 1;<br> end;<br><br> procedure InitSimulationControl;<br> { sets standard initial values for time and parameters that control the simulation process }<br> begin<br>  i := 1;<br>  t := 0;<br>  delt := 100;                 {calculation steps in seconds; e.g. 1/3 of smallest Halflife}<br>  signalflag := false;         {Is test signal set?}<br>  i0 := 0;<br> end;<br><br> procedure SetBaseVariables;<br> { set initial values for hormone levels and other behavioural parameters  }<br> begin<br>  dTSH := 0.001;               {mU/s  Inhibited production rate [calculated according to D&#39;Angelo 1976, Okuno 1979 and Greenspan 1997]}<br>{InitialValues:}<br>  gActiveModel.Equilibrium.TRHs := 2500;                {ng/l, endogenious TRH, according to Rondeel et al. 1988}<br>  TRH := TRH0;<br>  TSH := 2;                    {mU/l  from reference value}<br>  TSHz := 4;                   {Mittlerer Wert}<br>  T4 := ConvertedValue(7, T4_MOLAR_MASS, &#39;mcg/dl&#39;, &#39;mol/l&#39;);    {from reference value}<br>  FT4 := ConvertedValue(1.3, T4_MOLAR_MASS, &#39;ng/dl&#39;, &#39;mol/l&#39;);  {from reference value}<br>  T3p := ConvertedValue(130, T3_MOLAR_MASS, &#39;ng/dl&#39;, &#39;mol/l&#39;);  {from reference value}<br>  FT3 := ConvertedValue(3.2, T3_MOLAR_MASS, &#39;pg/ml&#39;, &#39;mol/l&#39;);  {from reference value}<br>  T3z := ConvertedValue(8200, T3_MOLAR_MASS, &#39;pg/ml&#39;, &#39;mol/l&#39;); {from reference value}<br>  TBG := 3e-7;                 {mol/l  from reference value}<br>  TBPA := 4.5e-6;              {mol/l  from reference value}<br>  IBS := 8e-6;                 {mol/l  estimated from TBG level, corrected for intracellular accumulation [Hays et al. 1988]}<br>                               {                CRYM, Mu-crystallin homolog also known as NADP-regulated thyroid-hormone-binding     }<br>                               {                protein (THBP) could be a biochemical representation of IBS}<br> end;<br><br> procedure SetDerivedVariables;<br> { calculate initial values for variables that have been derived from others }<br> begin<br>  T3n := T3z / (1 + k31 * IBS);<br>  T3R := GR * T3n / (DR + T3n); {Calculated from physiological initial values for T3z}<br>  gH := dTSH * (DH + TRH0) * (1 + LS * T3R) * (1 + Ss * alphaS2 * dTSH / (betaS2 * DS + alphaS2 * dTSH)) / TRH0;   {Max. ungebremste Sekretionsleitung der Hypophyse; Näherungswert: 817 mU/s}<br> end;<br><br> procedure SimHypothalamus(const inv_hpd: real);<br> { Simulator module for hypothalamic function }<br> { invoked by TSimulationThread }<br> var<br>   circadianControl: real;<br> begin<br>   assert(inv_hpd &gt;= 0, kError101);<br>   omega := 2 * pi * f; {Angular frequency}<br>   chi := 2 * pi * inv_hpd * 5;<br>   if circadianflag then<br>     circadianControl := cos(omega * t - chi)<br>   else<br>     circadianControl := 0;<br>   TRHi := gActiveModel.Equilibrium.TRH1 + THREE_FIFTH * gActiveModel.Equilibrium.TRHs * circadianControl * UTRH;<br>   TRH := TRHi + TRHe; {Total TRH is sum of internal and external TRH}<br>   TRH := TRH * getgauss(0.5); {Noise}<br> end;<br><br> procedure SimPituitary(const gainOfTSH: real; const ultrashortFeedbackGain: real; memory: boolean);<br> { Simulator module for pituitary gland }<br> { invoked by TSimulationThread and from Equilibriumdiagram unit }<br> begin<br>   assert((gainOfTSH &gt;= 0) and (ultrashortFeedbackGain &gt;= 0), kError101);<br>   T3n := T3z / (1 + k31 * IBS);<br>   T3R := GR * T3n / (dR + T3n);<br>   dTSH := gH * TRH / ((dH + TRH) * (1 + LS * T3R) * (1 + SS * TSHz / (DS + TSHz)));<br>   {differential quotient of secretory rate only, no degradation}<br>   if memory then<br>     begin<br>       {Simulation variant with first order memory elements}<br>       {used for normal simulation run}<br>       {Equifinal approximation: TSHz := (alphaS2 / betaS2) * dTSH;}<br>       vpt10 := ultrashortFeedbackGain;<br>       pt1(vpt10, tpt16, x6, dTSH, TSHz);<br>       TSHz := pt0(xt22, nt22, TSHz); {pituitary TSH for Brokken-Wiersinga-Prummel loop}<br>       {optional: TSHz := TSHz * getgauss(0.2); {additional Noise}}<br>       vpt10 := gainOfTSH;<br>       pt1(vpt10, tpt12, x2, dTSH, TSH);<br>       {Equifinal approximation: TSH := alphaS * dTSH / betaS;}<br>       TSH := pt0(xt2, nt2, TSH);<br>     end<br>   else<br>     begin<br>       {Equifinal approximation for equilibrium diagram}<br>       TSHz := ultrashortFeedbackGain * dTSH;<br>       TSH := gainOfTSH * dTSH;<br>     end;<br> end;<br><br> procedure SimThyroidGland(const gainOfT4: real; memory: boolean);<br> { Simulator module for thyroid gland }<br> { invoked by TSimulationThread and from Equilibriumdiagram unit  }<br> begin<br>   assert(gainOfT4 &gt;= 0, kError101);<br>   dT4 := GT * TSH / (dT + TSH);<br>   if memory then begin<br>     vpt10 := gainOfT4;<br>     pt1(vpt10, tpt13, x3, dT4, T4);<br>     {Equifinal approximation: T4 := alphaT * dT4 / betaT;}<br>     T4 := pt0(xt3, nt3, T4);<br>   end<br>   else<br>     {Equifinal approximation for equilibrium diagram}<br>     T4 := gainOfT4 * dT4;<br>   FT4 := T4 / (1 + k41 * TBG + k42 * TBPA);<br> end;<br><br> procedure SimCentralDeiodination(const gainOfCentralT3: real; memory: boolean);<br> { Simulator module for central deiodination }<br> { invoked by TSimulationThread and from Equilibriumdiagram unit  }<br> begin<br>   assert(gainOfCentralT3 &gt;= 0, kError101);<br>   dT3z := GD2 * FT4 / (kM2 + FT4);<br>   if memory then begin<br>     vpt10 := gainOfCentralT3;<br>     pt1(vpt10, tpt14, x4, dT3z, T3z);<br>     T3z := pt0(xt4, nt4, T3z);<br>   end<br>   else<br>     {Equifinal approximation: T3z := alpha32 * dT3z / beta32;}<br>     T3z := gainOfCentralT3 * dT3z;<br> end;<br><br> procedure SimPeripheralDeiodination(const gainOfPeripheralT3: real; memory: boolean);<br> { Simulator module for peripheral deiodination }<br> { invoked by TSimulationThread and from Equilibriumdiagram unit  }<br> begin<br>   assert(gainOfPeripheralT3 &gt;= 0, kError101);<br>   dT3p := GD1 * FT4 / (kM1 + FT4);<br>   if memory then begin<br>     vpt10 := gainOfPeripheralT3;<br>     pt1(vpt10, tpt15, x5, dT3p, T3p);<br>   end<br>   else<br>     {Equifinal approximation: T3p := alpha31 * dT3p / beta31;}<br>     T3p := gainOfPeripheralT3 * dT3p;<br>   FT3 := T3p / (1 + k30 * TBG);<br> end;<br><br> procedure StandardValues;<br> begin<br>{ Set initial values for structure parameters and time constants }<br><br>{Reference values:}<br>{TRH: 5 — 6 ng/l in peripheral plasma, ca. 2000 ng/l in portal plasma}<br>{TSH: 0,4 — 4 mU/l or 9 — 29 µmol/l}<br>{TT4: 4,5 — 10 µg/dl or 57,9 — 128,7 nmol/l}<br>{FT4: 0,8 — 1,8 ng/dl or 10 — 23 pmol/l}<br>{TT3: 80 — 180 ng/dl or 1,23 — 2,77 nmol/l}<br>{FT3: 2,3 — 4,2 pg/ml or 3,5 — 6,5 µmol/l}<br><br>{Transfer parameters:}<br>  alphaR := 0.4;               {/l: Dilution factor for TRH in TRH-Test, as alphaS}<br>  alphaS := 0.4;               {/l: from V0 = 2.5l (peptide hormone disbributing in peripheral plasma only)}<br>  betaS := 2.3e-4;             {/s: from halflife of about 50 Min. [Li et al. 1995, Odell et al. 1967]}<br>  alphaS2 := 2.6e5;            {/l: from V0 = 3,8µl (calculated according to Edelman 1959 and other sources)}<br>  betaS2 := 140;               {/s: primary unknown kinetics, conclusions by analogy from typical receptor potentials, corresponding to halflife of 5 ms}<br>  dH := 47e-9;                 {mol/l: [Le Dafniet et al. 1994]: 47 nmol/l}<br>  dR := 0.1e-9;                {mol/l: [Vybok et al. 1994, Lazar et al., 1990]}<br>  GR := 1;                     {mol/s: scaled to 1, as amplification of feedback path quantified by LS}<br>  SS := 100;                   {l/mU: calculated from results of [Kakita et al. 1984] with Lineweaver-Burk regression}<br>  DS := 50;                    {mU/l: calculated from results of [Kakita et al. 1984] with Lineweaver-Burk regression}<br>  GT := 1.5e-12 * 2.25;        {mol/s: Mean production rate times 2.25 [Li et al. 1995]}<br>  alphaT := 0.1;               {/l: from V0 = 10 l [Greenspan 1997]}<br>  betaT := 1.1e-6;             {/s: from halflife of seven days [Greenspan 1997]}<br>  dT := 2.75;                  {mU/l: averaged from[Dumont &amp; Vassart 1995]}<br>  GD1 := 2.8e-8;               {mol/sec: determined from reference values from SPINA I trial}<br>  GD2 := 4.3e-15;              {mol/sec: calculated from pituitary T3 content}<br>  alpha31 := 2.6e-2;           {/l: from V0 = 38 l [Greenspan 1997]}<br>  beta31 := 8e-6;              {/s: from halflife of 24h [Greenspan 1997]}<br>  alpha32 := 1.3e5;            {/l: calculated from V0 = 7.6 µl}<br>  beta32 := 8.3e-4;            {/s: from halflife of 15 minutes [Oppenheimer et al. 1967}<br>  kM1 := 0.5e-6;               {mol/l: [Greenspan 1997]}<br>  kM2 := 1e-9;                 {mol/l: [Visser et al. 1983]}<br>  k30 := 2e9;                  {l/mol: [Li et al. 1995]}<br>  k31 := 2e9;                  {l/mol: estimated}<br>  k41 := 2e10;                 {l/mol: [Li et al. 1995]}<br>  k42 := 2e8;                  {l/mol: [Li et al. 1995]}<br>  k3 := GD2 * alpha32 / (beta32 * (1 + k31 * IBS)); {for calculating LS from clinical data}<br>  G3 := k3 * GR / (k3 + dR);   {dto.: Amplification factor for T3z }<br>  AC1 := 500;                  {dto.: typical non-brakes TSH concentration}<br>  MI := AC1 / 0.001;           {dto.: strength of inhibition}<br>  LS := MI / G3;               {Compensation for GR; LS therefore depending from empirical data only; approximation: 1.68 e6 l/mol}<br><br>  SetDerivedVariables;<br>  if gStartup then<br>    gH0 := gH                  {stores standard value for gH}<br>  else<br>    gH := gH0;                 {restores gH to native value in order to avoid interference as gH is infered from other parameters}<br><br>  x1 := TRH0;<br>  x2 := TSH;<br>  x3 := T4;<br>  x4 := T3z;<br>  x5 := T3p;<br>  x6 := TSHz;<br><br>{Time constants:}<br>  t121 := 300;                 {TRH: Halflife in seconds}<br>  betaR := ln(2) / t121;       {Clearance-Exponent für TRH}<br>  t122 := ln(2) / betaS;       {TSH: Halflife in seconds}<br>  t123 := ln(2) / betaT;       {T4: Halflife in seconds}<br>  t124 := ln(2) / beta32;      {T3z: Halflife in seconds}<br>  t125 := ln(2) / beta31;      {T3p: Halflife in seconds}<br>  t126 := ln(2) / betaS2;      {TSHz: Halflife in seconds}<br>  tpt11 := t121 / ln(2);       {1st order delay constant for TRH}<br>  tpt12 := t122 / ln(2);       {1st order delay constant for TSH}<br>  tpt13 := t123 / ln(2);       {1st order delay constant for T4}<br>  tpt14 := t124 / ln(2);       {1st order delay constant for T3z}<br>  tpt15 := t125 / ln(2);       {1st order delay constant for T3p}<br>  tpt16 := t126 / ln(2);       {1st order delay constant for TSHz}<br>  Tt1 := 1800;                 {dead time for TRH: Tau 0 R}<br>  Tt2 := 120;                  {dead time for TSH: Tau 0 S}<br>  Tt22 := 3240;                {dead time for Ultrashort feedback effect [derived from Greenspan 1997]: Tau 0 S2}<br>  Tt3 := 300;                  {dead time for T4: Tau 0 T}<br>  Tt4 := 3600;                 {dead time for T3z: Tau 0 3z}<br>  nt2 := trunc(Tt2 / delt);<br>  nt22 := trunc(Tt22 / delt);<br>  nt3 := trunc(Tt3 / delt);<br>  nt4 := trunc(Tt4 / delt);<br><br> end;<br><br>procedure TSimulationThread.Pause; {Implements a suspend function even on Unix systems}<br>begin<br> Notice.Hide;<br> haltsim := true;<br>end;<br><br>procedure TSimulationThread.Restart; {implements a resume function even on Unix systems}<br>begin<br> if not simready then Notice.ShowOnTop;<br> if not assigned(SimCS) then<br>   SimCS := TCriticalSection.Create;<br> haltsim := false;<br>end;<br><br>procedure TSimulationThread.Execute; {Main simulation thread}<br>var<br>  theContents: tResultContent;<br>  nmaxString, iString: string;<br>  T4conversionFactor, T3conversionFactor: real;<br>  inv_hpd, inv_nmax, inv_UTRH: real;<br>  ultrashortFeebackGain: real;<br>  gainOfTSH, gainOfT4, gainOfCentralT3, gainOfPeripheralT3: real;<br>begin<br>  inv_hpd := 1 / HoursPerDay; { optimization for speed: }<br>  inv_nmax := 1 / nmax;         { on most processors multiplications are }<br>  inv_UTRH := 1 / UTRH;         { faster than divisions }<br>  ultrashortFeebackGain := alphaS2 / betaS2;<br>  gainOfTSH := alphaS / betaS;<br>  gainOfT4 := alphaT / betaT;<br>  gainOfCentralT3 := alpha32 / beta32;<br>  gainOfPeripheralT3 := alpha31 / beta31;<br>  SimCS.Enter;<br>  try<br>    simready := false;<br>    nmaxString := IntToStr(nmax);<br>    { Precompute conversion factors in order to speed up simulation:}<br>    T4conversionFactor := ConvertedValue(1, T4_MOLAR_MASS, &#39;mol/l&#39;, &#39;ng/dl&#39;);<br>    T3conversionFactor := ConvertedValue(1, T3_MOLAR_MASS, &#39;mol/l&#39;, &#39;pg/ml&#39;);<br>    while i &lt;= nmax do<br>      begin<br>        iString := IntToStr(i);<br>        if not haltsim then<br>          begin<br>            gResultMatrix[i-1, i_pos] := i;<br>            gResultMatrix[i-1, t_pos] := AsTime(t);<br>            gResultMatrix[i-1, TRH_pos] := TRH * inv_UTRH;<br>            gResultMatrix[i-1, pTSH_pos] := TSHz;<br>            gResultMatrix[i-1, TSH_pos] := TSH;<br>            gResultMatrix[i-1, TT4_pos] := T4 * T4conversionFactor;<br>            gResultMatrix[i-1, FT4_pos] := FT4 * T4conversionFactor;<br>            gResultMatrix[i-1, TT3_pos] := T3p * T3conversionFactor;<br>            gResultMatrix[i-1, FT3_pos] := FT3 * T3conversionFactor;<br>            gResultMatrix[i-1, cT3_pos] := T3z * T3conversionFactor;<br>            theContents[i_pos] := iString;<br>            theContents[t_pos] := FormattedTime(t);<br>            theContents[TRH_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, TRH_pos] * gParameterFactor[TRH_pos]); {TRH}<br>            theContents[pTSH_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, pTSH_pos] * gParameterFactor[pTSH_pos]); {portal TSH}<br>            theContents[TSH_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, TSH_pos] * gParameterFactor[TSH_pos]); {serum TSH}<br>            theContents[TT4_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, TT4_pos] * gParameterFactor[TT4_pos]); {T4}<br>            theContents[FT4_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, FT4_pos] * gParameterFactor[FT4_pos]); {FT4}<br>            theContents[TT3_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, TT3_pos] * gParameterFactor[TT3_pos]); {T3p}<br>            theContents[FT3_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, FT3_pos] * gParameterFactor[FT3_pos]); {FT3}<br>            theContents[cT3_pos] := FormatFloat(gNumberFormat, gResultMatrix[i-1, cT3_pos] * gParameterFactor[cT3_pos]); {T3z}<br>            writeTableCells(SimThyrLogWindow.ValuesGrid, theContents);<br>            if i mod 30 = 0 then<br>              SetStatusBarPanel0(iString, nmaxString);<br>            if nmax &gt; 0 then<br>              SimThyrLogWindow.ProgressBar1.Position := trunc(100 * i / nmax)<br>            else<br>              SimThyrLogWindow.ProgressBar1.Position := 100;<br>            t := t + delt;<br>{Hypothalamus:}<br>            SimHypothalamus(inv_hpd);<br>{Pituitary:}<br>            SimPituitary(gainOfTSH, ultrashortFeebackGain, true);<br>{Thyroid:}<br>            SimThyroidGland(gainOfT4, true);<br>{5&#39;-Deiodinase type II (central):}<br>            SimCentralDeiodination(gainOfCentralT3, true);<br>{5&#39;-Deiodinase type I (peripheral):}<br>            SimPeripheralDeiodination(gainOfPeripheralT3, true);<br>            i := i + 1;<br>{Load:}<br>            if (i &gt; i1) and testflag then<br>              begin<br>                signalflag := true;<br>                TRHe := UTRH * (200000 * alphaR * exp(-betaR * (t - i1 * delt)));<br>              end<br>              else if (i &gt; i1) and tbgflag then<br>              begin<br>                signalflag := true;<br>                TBG := 4.5e-7;<br>              end;<br>          end;<br>      end;<br>    simready := true;<br>    DrawPlot(false);<br>    SimThyrLogWindow.Caption := LOG_TITLE;<br>    SetStatusBarPanel0(iString, nmaxString);<br>    SimThyrLogWindow.ProgressBar1.Position := 0;<br>  finally<br>    SimCS.Leave;<br>    SimCS.Destroy;<br>  end;<br>end;<br><br>procedure TSimulationThread.SafeFree;  {avoids a dead-lock situation}<br>begin<br>  Terminate;<br>  WaitFor;<br>  if not FreeOnTerminate then<br>    Free;<br>end;<br><br>procedure simulate; {Creates and starts simulation thread}<br>const<br>  SECONDS_PER_DAY = 86400;<br>begin<br>  SetStatusBarPanel0(&#39;   0&#39;, IntToStr(nmax));<br>  graphready := false;<br>  ValuesPlot.Caption := WAIT_TITLE;<br>  SimThyrLogWindow.Caption := WAIT_TITLE;<br>  SetLength(gResultMatrix, nmax, RES_MAX_COLS);<br>  Notice.ShowOnTop;<br>  haltsim := false;<br>  f := 1 / SECONDS_PER_DAY; {Frequency of circadian rhythm of TRH secretion}<br>  SimCS := TCriticalSection.Create;<br>  if assigned(SimThread) then<br>    SimThread.Execute<br>  else<br>    SimThread := TSimulationThread.Create(false);<br>end;<br><br>procedure InitSimulation;  {sets initial conditions and calculates fixpoints}<br>begin<br>  i2 := 1;<br><br>  PredictEquilibrium;                        {predicted values}<br>  if previewflag and (i &lt;= 1) then<br>   begin                                     {use calculated equilibrium values}<br>    TSH := gActiveModel.Equilibrium.TSH1;<br>    FT4 := gActiveModel.Equilibrium.FT41;<br>    T4 := FT4 * (1 + k41 * TBG + k42 * TBPA);<br>    FT3 := gActiveModel.Equilibrium.FT31;<br>    T3p := FT3 * (1 + k30 * TBG);<br>    T3z := gActiveModel.Equilibrium.T3z1;<br>    T3R := gActiveModel.Equilibrium.T3R1;<br>    x2 := TSH;<br>    x3 := T4;<br>    x4 := T3z;<br>    x5 := T3p;<br>   end;<br>  if i &lt;= 1 then<br>   begin<br>    xt2 := InitialValues(xt2, nt2 + 1, TSH); {prepares dead-time elements}<br>    xt22 := InitialValues(xt22, nt22 + 1, TSHz);<br>    xt3 := InitialValues(xt3, nt3 + 1, T4);<br>    xt4 := InitialValues(xt4, nt4 + 1, T3z);<br>  end;<br><br>  ShowPredictedValues(false);<br>  GridRows := nmax + 2;<br>  SimThyrLogWindow.ValuesGrid.RowCount := GridRows;<br>  SimThyrLogWindow.Show;<br>  ValuesPlot.ShowOnTop;<br>  simulate;<br>end;<br><br>end.<br><br>{References:  }<br><br>{1. Neuber, H., &quot;Simulation von Regelkreisen auf Personal Computern  }<br>{  in Pascal und Fortran 77&quot;, IWT, Vaterstetten 1989  }<br><br>{2. Mark, D., C. Reed, &quot;Macintosh Pascal Programming Primer&quot;  }<br>{  Addison-Wesley, Reading, Ma., Mento Park, Ca., New York 3° 1993  }<br><br>{3. Borenstein, Ph., J. Mattson, &quot;THINK Pascal™ User Manual&quot;  }<br>{  Symantec Corporation, Cupertino, Ca. 1990   }<br><br>{4. Dahl, G. E., N. P. Evans, L. A. Thrun, f. J. Karsch (1994) &quot;A Central   }<br>{  Negative Feedback Action of Thyroid Hormones on Thyrotropin-  }<br>{  Releasing Hormone Secretion&quot;, Endocrinology 195: 2392-7  }<br><br>{5. Samuels, M. H., P. Henry, M. Luther, E. C. Ridgway (1993) &quot;Pulsatile  }<br>{  TSH Secretion during 48-Hour Continuous TRH Infusions&quot;, Thyroid  }<br>{  3: 201-6  }<br><br>{6. Li, G., B. Liu, Y. Liu (1995) &quot;A dynamical model of the pulsatile  }<br>{  secretion of the hypothalamo-pituitary-thyroid axis&quot;, BioSystems  }<br>{  35: 83-92  }<br><br>{7. Greenspan, F. S. &quot;The Thyroid Gland&quot; in: Greenspan, F. S.,  }<br>{  Strewler, G. J., &quot;Basic and Clinical Endocrinology&quot;,  }<br>{  Appleton &amp; Lange, Stamford, CT, 1997  }<br><br>{8. Visser, T. J., Kaplan, M. M., Leonard, J. L., Larsen, P. R. (1983)  }<br>{  &quot;Evidence for Two Pathways of Iodothyronine 5&#39;-Deiodination in Rat  }<br>{  Pituitary That Differ in Kinetics, Propylthiouracil Sensitivity and  }<br>{  Respone to Hypothyroidism&quot;, J. Clin. Invest. 71: 992-1002  }<br>{9. Lee TW; Anderson LA; Eidne KA; Milligan G (1995)   }<br><br>{  &quot;Comparison of the signalling properties of the long and short   }<br>{  isoforms of the rat thyrotropin - releasing - hormone receptor  }<br>{   following expression in rat 1 fibroblasts&quot;, Biochem J 310: 291-8  }<br><br>{10. Karhapaa L; Tornquist K (1995) &quot;Caffeine inhibits the binding of  }<br>{  thyrotropin-releasing hormone in GH4C1 pituitary cells.&quot;  }<br>{  Biochem Biophys Res Commun 210(3):726-32  }<br><br>{11. Dumont, J. E., Vassart, G. &quot;Thyroid Regulation&quot; in De. Groot  }<br>{  &quot;Endocrinology&quot;, WB Saunders 1995  }<br><br>{12. Jackson. I. M. D., &quot;Thyrotropin Releasing Factor&quot; in Adelman, G.  }<br>{  &quot;Encyclopedia of Neuroscience&quot;, Volume II, Birkhäuser, Boston,  }<br>{  Basel, Stuttgart, 1987  }<br><br>{13. Okuno, A., Taguchi, T., Takimoto, M. (1979) &quot;Kinetic Analysis of   }<br>{  Plasma TSH Dynamics after TRH Stimulation&quot; Horm. Metab. Res. 11:  }<br>{  293-5  }<br><br>{14. D&#39;Angelo, S. A., Paul, D. H., Wall, N. R., Lombardi, D. M. (1976)  }<br>{  &quot;Pituitary Thyrotropin (TSH) Rebound Phenomenon and Kinetics of  }<br>{  Secretion in the Goitrous Rat: Differential Effects of Thyroxine on  }<br>{  Synthesis and Release of TSH&quot; Endocrinology 99: 935-43  }<br><br>{15. Rondeel, J. M. M., de Greef, W. J., van der Schoot, P., Karels, B.,  }<br>{  Klootwijk, W., Visser, T. J. (1988) &quot;Effect of Thyroid Status and  }<br>{  Paraventricular Area Lesions on the Release of Thyrotropin-  }<br>{  Releasing Hormone and Catecholamines into Hypophysial Portal  }<br>{  Blood&quot; Endocrinology 123:523-7  }<br><br>{16. Oppenheimer, J. H., G. Bernstein, J. Hasen (1967) &quot;Estimation of  }<br>{  Rapidly Exchangeable Cellular Thyroxine from the Plasma  }<br><br>{  Disappearance Curves of Simultaneously Administered Thyroxine-  }<br>{  131I and Albumin-125I&quot; J. Clin. Invest 46: 762-77  }<br><br>{17. Edelman, I. S., J. Leibman (1959) &quot;Anatomy of Body Water and  }<br>{  Electrolytes&quot;, Am. J. Med. 27, 256-77  }<br><br>{18. Kakita, T., Laborde, N. P., Odell, W. D. (1984) &quot;Autoregulatory  }<br>{  Control of Thyrotrophin in Rabbits&quot;, Endocrinology 114: 2301-5  }<br><br>{19. Dietrich, J. W., Tesche, A., Pickardt, C. R., Mitzdorf, U. (2004) }<br>{  &quot;Thyrotropic Feedback Control: Evidence for an Additional Ultrashort }<br>{  Feedback Loop from Fractal Analysis&quot;, Cybernetics and Systems 35: }<br>{  315-31 }<br>{20. Dietrich JW, Stachon A, Antic B, Klein HH, Hering S. (2008) }<br><br>{  &quot;The AQUA-FONTIS study: protocol of a multidisciplinary, cross-sectional }<br>{  and prospective longitudinal study for developing standardized diagnostics }<br>{  and classification of non-thyroidal illness syndrome&quot;, BMC Endocr Disord. }<br>{  8:13. doi: 10.1186/1472-6823-8-13. PMID 18851740 }<br><br>{21. Dietrich JW, Landgrafe G, Fotiadou EH. (2012) &quot;TSH and Thyrotropic }<br>{  Agonists: Key Actors in Thyroid Homeostasis&quot;, J Thyroid Res. 2012:351864. }<br>{  doi: 10.1155/2012/351864. PMID 23365787 }<br><br>{22. Hoermann R, Midgley JE, Larisch R, Dietrich JW. (2013) &quot;Is pituitary }<br>{  TSH an adequate measure of thyroid hormone-controlled homoeostasis during }<br>{  thyroxine treatment?&quot;, Eur J Endocrinol. 168(2):271-80. }<br>{  doi: 10.1530/EJE-12-0819. PMID 23184912. }<br><br>{23. Midgley JE, Hoermann R, Larisch R, Dietrich JW. (2013) &quot;Physiological }<br>{  states and functional relation between thyrotropin and free thyroxine in }<br>{  thyroid health and disease: in vivo and in silico data suggest a }<br>{  hierarchical model&quot;, J Clin Pathol. 66(4):335-42. }<br>{  doi: 10.1136/jclinpath-2012-201213. PMID 23423518. }<br><br>{24. Hoermann R, Midgley JE, Larisch R, Dietrich JW (2015). }<br>{  Integration of Peripheral and Glandular Regulation of }<br>{  Triiodothyronine Production by Thyrotropin in Untreated and }<br>{  Thyroxine-Treated Subjects. Hormone and Metabolic Research, }<br>{  47(9):674-80. PMID: 25750078 doi: 10.1055/s-0034-1398616. }<br><br>{25. Midgley JE, Larisch R, Dietrich JW, Hoermann R. (2015). }<br>{  Variation in the biochemical response to l-thyroxine therapy and }<br>{  relationship with peripheral thyroid hormone conversion efficiency. }<br>{  Endocr Connect. 2015 Dec;4(4):196-205. doi: 10.1530/EC-150056. }<br>{  PMID 26335522. }<br><br>{26. Dietrich JW, Midgley JE, Larisch R, Hoermann R. (2015). }<br>{  Of rats and men: thyroid homeostasis in rodents and human beings. }<br>{  Lancet Diabetes Endocrinol. 2015 Dec;3(12):932-3. }<br>{  doi: 10.1016/S2213-8587(15)00421-0. PMID 26590684. }<br><br>{27. Hoermann R, Midgley JE, Larisch R, Dietrich JW. (2015). }<br>{  Homeostatic Control of the Thyroid-Pituitary Axis: Perspectives for }<br>{  Diagnosis and Treatment. Front Endocrinol (Lausanne). 2015 }<br>{  Nov 20;6:177. doi: 10.3389/fendo.2015.00177. PMID 26635726. }<br><br>{28. Dietrich JW, Landgrafe-Mende G, Wiora E, Chatzitomaris A, }<br>{  Klein HH, Midgley JE, Hoermann R. (2016). Calculated Parameters }<br>{  of Thyroid Homeostasis: Emerging Tools for Differential Diagnosis }<br>{  and Clinical Research. Front Endocrinol (Lausanne). 2016 Jun 9;7: }<br>{  57. doi: 10.3389/fendo.2016.00057. PMID 27375554. }</pre><p>In the next step, we try to reconstruct the two structure parameters from the simulated hormone concentrations that had been generated in the simulation and modified by compound noise. Thereby, we receive estimates for GT and GD, termed SPINA-GT and SPINA-GD.</p><p>Finally, we can use the results to compare the dispersion of both measured and calculated parameters of thyroid homeostasis (Fig. 8).</p><figure><img alt="Plots showing the results of Monte Carlo simulations of SPINA-GT and SPINA-GD based on simulated imprecise hormone assays. Hormone concentrations were modelled in SimThyr 4.0 with different predefined values for GT and GD, respectively. In the next step, simulated hormone concentrations were converted to measurements using the S/R script shown above. The script injected additive and multiplicative noise to arrive at vendor-reported concentration-dependent coefficients of variation." src="https://cdn-images-1.medium.com/max/1024/1*_OTu4VPjqehbGsc7GB5luw.png" /><figcaption><strong>Fig. 8: </strong>Results of Monte Carlo simulations of SPINA-GT and SPINA-GD based on simulated imprecise hormone assays. Hormone concentrations were modelled in SimThyr 4.0 with different predefined values for GT and GD, respectively. In the next step, simulated hormone concentrations were converted to measurements using the S/R script shown above. The script injected additive and multiplicative noise to arrive at vendor-reported concentration-dependent coefficients of variation. The lines show the mean ± standard deviation of hormone concentrations predicted by structure parameters calculated from simulated noisy measurements. CVs of SPINA-GT and SPINA-GD are below 10% even in low concentrations, where the CVs of corresponding hormone assays exceed 20% (figure from Dietrich et al. 2016, CC BY license).</figcaption></figure><p>The combination of continuous simulation with SimThyr and Monte Carlo simulation of imprecisions in the assay systems suggests that SPINA-GT and SPINA-GD have higher reliability than hormone concentrations that are interpreted on a univariable basis. Very similar results were found in a clinical study (Tab. 1).</p><figure><img alt="Test-retest reliability measures of TSH, FT4, FT3, SPINA-GT, and SPINA-GD from repeated measurements with at an inerval of least one in 20 healthy volunteers from the SPINA network. e: repeatability = (interindividual variance)/( intraindividual variance + interindividual variance). Larger figures denote higher reliability. SPINA-GT has higher reliability then TSH, FT4 or FT3 measurements." src="https://cdn-images-1.medium.com/max/576/1*Luhm7RoF4s6XcHY5BzwyLg.png" /><figcaption><strong>Table 1: </strong>Test-retest reliability measures of TSH, FT4, FT3, SPINA-GT, and SPINA-GD from repeated measurements with at an inerval of least one in 20 healthy volunteers from the SPINA network. e: repeatability = (interindividual variance)/( intraindividual variance + interindividual variance). Larger figures denote higher reliability (Dietrich et al. 2012).</figcaption></figure><p><strong>References</strong></p><p>Andersen S, Pedersen KM, Bruun NH, Laurberg P. Narrow individual variations in serum T(4) and T(3) in normal subjects: a clue to the understanding of subclinical thyroid disease. J Clin Endocrinol Metab. 2002 Mar;87(3):1068–72. doi: 10.1210/jcem.87.3.8165. PMID: 11889165.</p><p>Clerico A, Ripoli A, Zucchelli GC, Plebani M. Harmonization protocols for thyroid stimulating hormone (TSH) immunoassays: different approaches based on the consensus mean value. Clin Chem Lab Med. 2015 Feb;53(3):377–82. doi: <a href="https://doi.org/10.1515/cclm-2014-0586">10.1515/cclm-2014–0586</a>. PMID: <a href="https://pubmed.ncbi.nlm.nih.gov/25241732/">25241732</a>.</p><p>Dietrich JW, Landgrafe G, Fotiadou EH. TSH and Thyrotropic Agonists: Key Actors in Thyroid Homeostasis. J Thyroid Res. 2012;2012:351864. doi: <a href="https://doi.org/10.1155/2012/351864">10.1155/2012/351864</a>. Epub 2012 Dec 30. PMID: <a href="https://pubmed.ncbi.nlm.nih.gov/23365787/">23365787</a>.</p><p>Dietrich JW, Landgrafe-Mende G, Wiora E, Chatzitomaris A, Klein HH, Midgley JE, Hoermann R. Calculated Parameters of Thyroid Homeostasis: Emerging Tools for Differential Diagnosis and Clinical Research. Front Endocrinol (Lausanne). 2016 Jun 9;7:57. doi: <a href="https://doi.org/10.3389/fendo.2016.00057">10.3389/fendo.2016.00057</a>. PMID: <a href="https://pubmed.ncbi.nlm.nih.gov/27375554/">27375554</a>.</p><p>Dietrich JW, Bazika-Gerasch B. Lebensqualität bei Schilddrüsenerkrankungen. Forum Sanitas. 2022;(4):25–28.</p><p>Larisch R, Giacobino A, Eckl W, Wahl HG, Midgley JE, Hoermann R. Reference range for thyrotropin. Post hoc assessment. Nuklearmedizin. 2015;54(3):112–7. doi: 10.3413/Nukmed-0671–14–06. Epub 2015 Jan 8. PMID: 25567792.</p><p>Siemens: Evolution of TSH Assays: A Third Generation Viewpoint</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2efac70e3ca7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/scientific-pascal/estimating-the-reliability-of-diagnostic-tools-in-endocrinology-with-computer-simulations-2efac70e3ca7">Assessing diagnostic tools in endocrinology with computer simulations</a> was originally published in <a href="https://medium.com/scientific-pascal">Scientific Pascal</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mathematical modelling helps understanding cerebral haemodynamics and their effects on intracranial…]]></title>
            <link>https://medium.com/scientific-pascal/mathematical-modelling-helps-understanding-cerebral-haemodynamics-and-their-effects-on-intracranial-19786831ad59?source=rss-107fdb07ecb------2</link>
            <guid isPermaLink="false">https://medium.com/p/19786831ad59</guid>
            <category><![CDATA[mathematical-modelling]]></category>
            <category><![CDATA[intracranial-pressure]]></category>
            <category><![CDATA[delphi-programming]]></category>
            <category><![CDATA[cerebral-haemodynamics]]></category>
            <category><![CDATA[computer-simulation]]></category>
            <dc:creator><![CDATA[Johannes W. Dietrich]]></dc:creator>
            <pubDate>Sat, 27 Jul 2024 18:29:54 GMT</pubDate>
            <atom:updated>2024-07-27T18:29:54.116Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mathematical modelling helps understanding cerebral haemodynamics and their effects on intracranial pressure</h3><p>Intracranial pressure (ICP) is vital for decisions in neurointensive care. Its dynamics are only partly understood. Computer simulations in Object Pascal with Embarcadero Delphi provide new insights by clarifying the role of the interstitial fluid.</p><figure><img alt="The unilateral hydrodynamic model proposed by Czosnyka" src="https://cdn-images-1.medium.com/max/1024/1*kz6Gpt7KFk_quW71f4BovQ.png" /><figcaption>The unilateral hydrodynamic model proposed by Czosnyka</figcaption></figure><figure><img alt="Simulations of the infusion tests (between tstart and tstop) with the models (a); and the analysis with the ICM+® software, illustrating the pressure-volume relationships represented by the original (b) and new © models" src="https://cdn-images-1.medium.com/max/1024/1*3LgktloadNBwFYfdEVM7dQ.png" /><figcaption>Simulations of the infusion tests (between tstart and tstop) with the models (a); and the analysis with the ICM+® software, illustrating the pressure-volume relationships represented by the original (b) and new © models</figcaption></figure><p>Read the full article at <a href="https://doi.org/10.1016/j.bas.2024.102772">https://doi.org/10.1016/j.bas.2024.102772</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19786831ad59" width="1" height="1" alt=""><hr><p><a href="https://medium.com/scientific-pascal/mathematical-modelling-helps-understanding-cerebral-haemodynamics-and-their-effects-on-intracranial-19786831ad59">Mathematical modelling helps understanding cerebral haemodynamics and their effects on intracranial…</a> was originally published in <a href="https://medium.com/scientific-pascal">Scientific Pascal</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>