<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ujjwal's Mindspace</title>
    <description>Ujjwal's Mindspace</description>
    <link>/</link>
    <atom:link href="/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 27 Feb 2025 12:45:58 +0530</pubDate>
    <lastBuildDate>Thu, 27 Feb 2025 12:45:58 +0530</lastBuildDate>
    <generator>Jekyll v3.9.0</generator>
    
      <item>
        <title>True Intelligence - Part 1</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 110}
});
&lt;/script&gt;

&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;/h1&gt;

&lt;p&gt;True intelligence lies in the ability to adapt to the unknown. This poses one of the most enduring challenges in artificial intelligence: how to create systems capable of reasoning and solving problems beyond their initial training data. While AI systems excel in specific tasks with clear data boundaries, they often falter when presented with novel problems or contexts, such as rare medical conditions or unseen scenarios in robotics. The essence of intelligence, both human and artificial, involves compositional reasoning—the ability to deconstruct tasks into core components and recombine them in new contexts.&lt;/p&gt;

&lt;p&gt;In this blog, we explore the principles of compositional understanding, the theoretical underpinnings of true intelligence, and potential approaches to achieving adaptability in artificial systems.&lt;/p&gt;

&lt;h1 id=&quot;the-challenge-of-adaptation&quot;&gt;The Challenge of Adaptation&lt;/h1&gt;

&lt;p&gt;The human mind excels at navigating unknown situations. For instance, a clinician encountering an unfamiliar disease can rely on foundational medical knowledge and observations to draw meaningful conclusions. In contrast, many AI models are brittle, trained to excel only within narrowly defined distributions.&lt;/p&gt;

&lt;p&gt;The challenge can be mathematically framed as follows:&lt;/p&gt;

&lt;p&gt;Given an input space \(X\), a task space \(T\), and a distribution \(P(X, T)\) over these spaces, an AI model \(M\) is designed to map inputs \(x \in X\) to outputs \(t \in T\). True intelligence requires \(M\) to generalize to distributions \(P'(X, T)\), where \(P'(X, T)\) may be significantly different from \(P(X, T)\). This requires learning core abstractions \(A\) such that:&lt;/p&gt;

\[\text{Adaptation: } f: A \times P'(X, T) \to M'\]

&lt;p&gt;where \(M'\) is the adapted model for the new distribution.&lt;/p&gt;

&lt;h1 id=&quot;compositional-reasoning&quot;&gt;Compositional Reasoning&lt;/h1&gt;

&lt;p&gt;Humans achieve generalization by leveraging compositional reasoning. This involves identifying atomic concepts or sub-problems and combining them to solve complex tasks. In mathematical terms, compositional reasoning can be expressed as:&lt;/p&gt;

\[M(x) = f\Big(\sum_{i=1}^{n} g_i(x)\Big)\]

&lt;p&gt;where \(g_i(x)\) represents atomic functions capturing fundamental logic or features, and \(f\) is the recombination function that enables solving a new problem.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Recognizing individual shapes (\(g_i(x)\)) in a visual scene.&lt;/li&gt;
  &lt;li&gt;Recombining these shapes (\(f\)) to infer the presence of an object.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach mirrors how humans decompose problems like understanding a sentence by identifying words, syntax, and semantics.&lt;/p&gt;

&lt;h1 id=&quot;bottlenecks-in-current-ai-systems&quot;&gt;Bottlenecks in Current AI Systems&lt;/h1&gt;

&lt;p&gt;Current AI systems primarily rely on pattern recognition, which struggles with:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Out-of-distribution scenarios&lt;/strong&gt;: Rare or novel cases are often misclassified.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Spurious correlations&lt;/strong&gt;: Systems often mistake correlation for causation.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Lack of interpretability&lt;/strong&gt;: Deep learning models often function as “black boxes.”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To move beyond these limitations, we must design systems that exhibit reasoning rather than rote memorization.&lt;/p&gt;

&lt;h1 id=&quot;the-path-to-true-intelligence&quot;&gt;The Path to True Intelligence&lt;/h1&gt;

&lt;p&gt;True intelligence requires overcoming the combinatorial explosion of possibilities in real-world tasks. Consider program synthesis as an analogy: generating all possible programs that solve a task is infeasible. Instead, humans use intuition and abstraction to navigate vast solution spaces.&lt;/p&gt;

&lt;h2 id=&quot;abstraction-and-generalization&quot;&gt;Abstraction and Generalization&lt;/h2&gt;

&lt;p&gt;Abstractions are reusable building blocks that form the foundation of reasoning. They can be conceptualized as:&lt;/p&gt;

\[A = \{ a_1, a_2, \dots, a_k \}\]

&lt;p&gt;where \(a_i\) represents a primitive abstraction derived from past experiences. A system capable of generalization must:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Learn \(A\) from data.&lt;/li&gt;
  &lt;li&gt;Recombine \(A\) to form solutions for unseen problems.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;framework-for-compositional-ai&quot;&gt;Framework for Compositional AI&lt;/h2&gt;

&lt;p&gt;We propose a dual-phase framework:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Abstraction Generation&lt;/strong&gt;: Discover core abstractions using techniques like clustering, unsupervised learning, or symbolic representation.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Synthesis and Reasoning&lt;/strong&gt;: Use abstraction banks to compose solutions for novel tasks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The formal process is:&lt;/p&gt;

\[S(x, T) = f(A, T)\]

&lt;p&gt;where \(S(x, T)\) synthesizes solutions \(x \to T\) using abstractions \(A\) and recombination logic \(f\).&lt;/p&gt;

&lt;h1 id=&quot;applications-in-high-stakes-domains&quot;&gt;Applications in High-Stakes Domains&lt;/h1&gt;

&lt;p&gt;Compositional AI is particularly relevant in high-stakes domains like healthcare. For example, in stroke detection:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Abstraction&lt;/strong&gt;: Identify features such as gaze deviation or ischemic regions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Reasoning&lt;/strong&gt;: Combine these features to diagnose rare stroke patterns.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Similarly, in robotics, compositional reasoning allows systems to adapt to dynamic environments by recombining learned motor skills and sensory processing.&lt;/p&gt;

&lt;h1 id=&quot;toward-explainability&quot;&gt;Toward Explainability&lt;/h1&gt;

&lt;p&gt;An essential requirement for true intelligence is interpretability. A system’s reasoning process must be transparent and explainable, enabling users to trust its decisions. This can be achieved through structured outputs, such as:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Semantic annotations&lt;/strong&gt;: Annotating decisions with explanations tied to abstractions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Visual grounding&lt;/strong&gt;: Linking outputs to visual or sensory evidence.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Structured reasoning graphs&lt;/strong&gt;: Representing inference paths as directed acyclic graphs (DAGs).&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;the-future-of-ai-research&quot;&gt;The Future of AI Research&lt;/h1&gt;

&lt;p&gt;True intelligence is the next frontier in AI. It requires bridging the gap between pattern recognition and reasoning through abstractions and composition. The future lies in:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Developing datasets and benchmarks that emphasize compositional complexity.&lt;/li&gt;
  &lt;li&gt;Designing architectures that integrate deep learning with symbolic reasoning.&lt;/li&gt;
  &lt;li&gt;Incorporating feedback loops for real-time adaptation and learning.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;True intelligence is not just about solving problems but understanding them in a way that allows adaptation to new, unknown challenges. By pursuing compositional AI, we take a significant step toward systems that mirror the adaptability and creativity of human cognition.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Follow me on Twitter &lt;a href=&quot;https://twitter.com/theujjwal9&quot;&gt;@theujjwal9&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Sun, 01 Dec 2024 00:00:00 +0530</pubDate>
        <link>/articles/24/intro-to-true-intelligence</link>
        <guid isPermaLink="true">/articles/24/intro-to-true-intelligence</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Introduction to Diffusion Models</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 110}
});
&lt;/script&gt;

&lt;p&gt;Diffusion models have emerged as a powerful class of generative models, particularly in generating high-quality images. They operate by progressively adding noise to training data and then learning to reverse this process, effectively generating new data samples from random noise. This approach is deeply rooted in concepts from statistical physics and stochastic differential equations (SDEs).&lt;/p&gt;

&lt;h2 id=&quot;generative-modeling-and-the-role-of-the-score-function&quot;&gt;Generative Modeling and the Role of the Score Function&lt;/h2&gt;

&lt;p&gt;In generative modeling, our goal is to estimate a data distribution \(q_{\text{data}}(x)\) using a model \(p_{\theta}(x)\) parameterized by \(\theta\). A key concept in this context is the &lt;em&gt;score function&lt;/em&gt;, defined as the gradient of the log-density of the data distribution:&lt;/p&gt;

\[s(x) = \nabla_x \log q_{\text{data}}(x)\]

&lt;p&gt;This score function provides the direction in which the data density increases most rapidly and is instrumental in guiding the generation of new samples.&lt;/p&gt;

&lt;h2 id=&quot;langevin-dynamics-and-the-fokker-planck-equation&quot;&gt;Langevin Dynamics and the Fokker-Planck Equation&lt;/h2&gt;

&lt;p&gt;Langevin dynamics describe the evolution of a system under both deterministic forces and stochastic noise. In the context of diffusion models, they are used to sample from a distribution by iteratively updating samples with both gradient information (from the score function) and Gaussian noise:&lt;/p&gt;

\[x_{t+1} = x_t + \frac{\epsilon}{2} s(x_t) + \sqrt{\epsilon} z_t\]

&lt;p&gt;where \(\epsilon\) is a step size and \(z_t \sim \mathcal{N}(0, I)\) is Gaussian noise. The corresponding Fokker-Planck equation describes the time evolution of the probability density function of the system’s state, ensuring that, under appropriate conditions, the samples converge to the target distribution.&lt;/p&gt;

&lt;h2 id=&quot;constructing-the-forward-and-reverse-processes&quot;&gt;Constructing the Forward and Reverse Processes&lt;/h2&gt;

&lt;p&gt;Diffusion models define a forward process that gradually adds noise to the data, transforming it into a simple prior distribution (e.g., Gaussian). This process can be modeled as a stochastic differential equation:&lt;/p&gt;

\[dx = f(x, t)\, dt + g(t)\, dW_t\]

&lt;p&gt;where \(f(x, t)\) is a drift term, \(g(t)\) is a diffusion coefficient, and \(W_t\) represents a Wiener process. The reverse process, which aims to denoise and generate new samples, follows a similar SDE but with time running backward.&lt;/p&gt;

&lt;h2 id=&quot;estimating-the-score-function&quot;&gt;Estimating the Score Function&lt;/h2&gt;

&lt;p&gt;A critical challenge in diffusion models is accurately estimating the score function \(s(x)\). One effective method is &lt;em&gt;denoising score matching&lt;/em&gt;, which involves training a neural network to predict the gradient of the log-density of noisy data. The objective function for this training is:&lt;/p&gt;

\[\mathbb{E}_{q_{\sigma}(x)} \left[ \frac{1}{2} \left\| s_{\theta}(x) - \nabla_x \log q_{\sigma}(x) \right\|^2 \right]\]

&lt;p&gt;where \(q_{\sigma}(x)\) is the distribution of data corrupted with noise of level \(\sigma\). By minimizing this objective, the model learns to approximate the true score function, enabling effective sample generation.&lt;/p&gt;

&lt;h2 id=&quot;training-and-sampling-with-diffusion-models&quot;&gt;Training and Sampling with Diffusion Models&lt;/h2&gt;

&lt;p&gt;Training a diffusion model involves two main steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Defining a Noise Schedule&lt;/strong&gt;: Set a schedule for the noise levels to be added during the forward process, typically increasing over time.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Learning to Denoise&lt;/strong&gt;: Train a neural network to reverse the noising process by estimating the score function at various noise levels.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once trained, sampling from the model is achieved by starting with random noise and iteratively applying the learned reverse process to generate data samples that resemble the training data distribution.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Follow me on Twitter &lt;a href=&quot;https://twitter.com/theujjwal9&quot;&gt;@theujjwal9&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Thu, 12 Oct 2023 00:00:00 +0530</pubDate>
        <link>/articles/23/intro-to-diffusion-model</link>
        <guid isPermaLink="true">/articles/23/intro-to-diffusion-model</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Introduction to Lean</title>
        <description>&lt;p&gt;Lean is an open source proof assistant developed by Microsoft Research.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ujjwal-9/theorems&quot;&gt;[Github repo for this blog series]&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Mathematics is characterised by the inferences allowed in the justification for the statements. The justification of one mathematician can be checked by
another by checking that each inference is between those allowed.&lt;/p&gt;

&lt;p&gt;Mathematicians usually write proofs in natural languages using some special symbols to denote mathematical operations (\(\int\) - Integration) and objects (\(e\) - Euler’s number). Logicians have agreed upon &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_rules_of_inference&quot;&gt;rules of inference&lt;/a&gt; which supports validity of proof.&lt;/p&gt;

&lt;p&gt;Since these rules are mechanical, the process of checking is also mechanical as of now. But with advent of interactive theorem proving assistant it is possible to represent these proof in a manner that a machine can verify. One such proof assistant is lean (among other like Coq).&lt;/p&gt;

&lt;h1 id=&quot;background-on-lean&quot;&gt;Background on Lean&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;Lean = Functional Programming + Logic&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lean encodes formal language in a version of &lt;strong&gt;dependent type theory&lt;/strong&gt; (alternative to set theory) called &lt;em&gt;Calculus of Constructions&lt;/em&gt;, with a countable hierarchy of non-cumulative universes and inductive types.&lt;/p&gt;

&lt;p&gt;The only two things Lean can do is:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;create terms&lt;/li&gt;
  &lt;li&gt;check their types&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By iterating these two operations one can teach Lean to verify complex mathematical proofs.&lt;/p&gt;

&lt;p&gt;Lets first look at simple type theory.&lt;/p&gt;

&lt;h2 id=&quot;simple-type-theory&quot;&gt;Simple Type Theory&lt;/h2&gt;

&lt;p&gt;Everything is a set, including numbers, functions, triangles, stochastic processes, and Riemannian manifolds. Using these sets we can construct rich mathematical intutions. But it will be helpful if we can manage and keep track of the various kinds of mathematical objects we are working with.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Type theory&lt;/em&gt; states that every mathematical expression has a type. For example, \(x\) may denote natural numbers and \(f(x)\) may denote function on natural numbers maping them to lets say complex numbers. Such types conversions also make simple type theory even more powerful.&lt;/p&gt;

&lt;p&gt;Lets see how we declare mathematical objects in lean and declare their types.&lt;/p&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;        -- m is a natural number&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;  -- declare two constants at once&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                -- output: nat&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;               -- bool&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;         -- &quot;&amp;amp;&amp;amp;&quot; is boolean and&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;         -- boolean or&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;constant&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;constants&lt;/code&gt; commands introduce new constant symbols into the working environment. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#check&lt;/code&gt; command asks Lean to report their types.&lt;/p&gt;

&lt;p&gt;Lets see how we convert make new types out of others.&lt;/p&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;'&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;)   &lt;span class=&quot;cd&quot;&gt;-- has the same type as g!&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;           -- type the arrow as &quot;\to&quot; or &quot;\r&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F&lt;/span&gt; : (&lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;) &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;   -- a &quot;functional&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                     -- ℕ&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                       -- ℕ → ℕ&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                       -- ℕ&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                     -- ℕ&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thing to note from above example:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Application of a function f to a value x is denoted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f x&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Arrows associate to the right, example. &lt;em&gt;the type of g is nat → (nat → nat)&lt;/em&gt;. Thus g is a function that takes natural numbers and returns another function that takes a natural number and returns a natural number.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Type theory also allows for partial application of a function where, as told in point 2 above, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g m&lt;/code&gt; is a function that waits for argument &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; to return &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g m n&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Currying&lt;/strong&gt;, redefining a function to look like other.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;types-as-objects&quot;&gt;Types as Objects&lt;/h2&gt;

&lt;p&gt;Leans dependent type theory extends simple type theory by making types as object of study themselves. We can also declare new constants and constructors for types.&lt;/p&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; α β : &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F&lt;/span&gt; : &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;G&lt;/span&gt; : &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;               -- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;              -- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;        -- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;×&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;        -- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; α                 &lt;span class=&quot;cd&quot;&gt;-- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F&lt;/span&gt; α               &lt;span class=&quot;cd&quot;&gt;-- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;F&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;             -- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;G&lt;/span&gt; α               &lt;span class=&quot;cd&quot;&gt;-- Type → Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;G&lt;/span&gt; α β             &lt;span class=&quot;cd&quot;&gt;-- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;G&lt;/span&gt; α &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;           -- Type&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Type list α denotes the type of lists of elements of type α.&lt;/p&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; α : &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;list&lt;/span&gt; α    &lt;span class=&quot;cd&quot;&gt;-- Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;  -- Type&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;Lean has an infinite hierarchy of types. It’s type also has type.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;     -- Type 1&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;   -- Type 2&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;   -- Type 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;functions&quot;&gt;Functions&lt;/h2&gt;

&lt;p&gt;How do we create a function from another expression? We use process known as &lt;em&gt;abstraction&lt;/em&gt;, or &lt;em&gt;lambda abstraction&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x: α&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;t: β&lt;/code&gt;. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fun x : α, t&lt;/code&gt; is equivalent with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;λ x : α, t&lt;/code&gt;. Both are object of type α → β.&lt;/p&gt;

&lt;p&gt;Example. \(f(x) = x + 5\), where \(x\) is natural number. It is translated in lean as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;λ x : nat, x + 5&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; α β  : &lt;span class=&quot;kt&quot;&gt;Type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a2&lt;/span&gt; : α
&lt;span class=&quot;k&quot;&gt;constants&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt; : β

&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; : α &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; α
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; : α &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; β
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; : α &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; β &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; α
&lt;span class=&quot;k&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; : α &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; α &lt;span class=&quot;o&quot;&gt;→&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bool&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                      -- α → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                        -- α → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;)                    &lt;span class=&quot;cd&quot;&gt;-- α → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                     -- α → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; : β, &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                     -- β → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;)) (&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt;) &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt;)  &lt;span class=&quot;cd&quot;&gt;-- α → bool&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α, &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; : β, &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;) &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;         -- α → β → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; : α) (&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; : β), &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;) &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;        -- α → β → α&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;#check&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;λ&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;) &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;                    -- α → β → α&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;Expression &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;λ x : α, x&lt;/code&gt; denotes the identity function on α&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;We can leave type annotations on the variable, lean will infer it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;λ x, g (f x)&lt;/code&gt; == &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;λ x : α, g (f x)&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;example&quot;&gt;Example&lt;/h1&gt;

&lt;p&gt;Here we prove that &lt;strong&gt;prime numbers are more than any assigned multitude of prime numbers&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;This proposition states that there are more than any finite number of prime numbers, that is to say, there are infinitely many primes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;outline-of-proof&quot;&gt;Outline of proof&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://mathcs.clarku.edu/~djoyce/java/elements/bookIX/propIX20.html&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Suppose that there are n primes, a1, a2, …, an. Euclid, as usual, takes an specific small number, n = 3, of primes to illustrate the general case. Let m be the least common multiple of all of them.
    &lt;blockquote&gt;
      &lt;p&gt;The least common multiple was also considered in proposition &lt;a href=&quot;https://mathcs.clarku.edu/~djoyce/java/elements/bookIX/propIX14.html&quot;&gt;IX.14&lt;/a&gt;. It wasn’t noted in the proof of that proposition that the least common multiple of primes is their product, and it isn’t noted in this proof, either.&lt;/p&gt;
    &lt;/blockquote&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Consider the number m + 1. If it’s prime, then there are at least n + 1 primes.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;So suppose m + 1 is not prime. Then according to &lt;a href=&quot;https://mathcs.clarku.edu/~djoyce/java/elements/bookVII/propVII31.html&quot;&gt;VII.31&lt;/a&gt;, some prime g divides it. But g cannot be any of the primes a1, a2, …, an, since they all divide m and do not divide m + 1. Therefore, there are at least n + 1 primes. Q.E.D.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;This proposition is not used in the rest of the Elements.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;lean-proof&quot;&gt;Lean Proof&lt;/h2&gt;

&lt;div class=&quot;language-lean highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cd&quot;&gt;-- Definitions about natural numbers and primes&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;prime&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;

-- Library on linear arithmatic&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tactic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linarith&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;

-- Define namespace, which is natural numbers in this case&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt; 


-- Define theorem or goal to prove&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;theorem&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;infinitude_of_primes&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;∀&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;, &lt;span class=&quot;o&quot;&gt;∃&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;prime&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; :=&lt;span class=&quot;cd&quot;&gt;
-- between begin-end block we write tactics&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;
  -- define N to be a natural number as a part of our local hypothesis&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;intro&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;,

  &lt;span class=&quot;cd&quot;&gt;-- Continue with proof as mentioned in link provided in header
  -- let M to be N! + 1 : local definition&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;M&lt;/span&gt; := &lt;span class=&quot;n&quot;&gt;factorial&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;,
  
  &lt;span class=&quot;cd&quot;&gt;-- let p be smallest prime factor of M which is not 1&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; := &lt;span class=&quot;n&quot;&gt;min_fac&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;,


  &lt;span class=&quot;cd&quot;&gt;-- define supporting hypothesis pp, p is prime&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;have&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pp&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;prime&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; :=&lt;span class=&quot;cd&quot;&gt; 
  -- begin proof for supporting p being prime&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;cd&quot;&gt;
    -- minimum factor of a number is prime, but what about if M = 1&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;refine&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;min_fac_prime&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;,
    &lt;span class=&quot;cd&quot;&gt;-- so here we prove M != 1 (or M &amp;gt; 1)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;have&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;factorial&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; := &lt;span class=&quot;n&quot;&gt;factorial_pos&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;,
    &lt;span class=&quot;cd&quot;&gt;-- this just automatically takes care of linear arithmatic required for proof&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;linarith&lt;/span&gt;,
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;,

  &lt;span class=&quot;cd&quot;&gt;-- before this we had existenial statement but now we have condition in p&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;,

  &lt;span class=&quot;cd&quot;&gt;-- split our goal in  2 subgoals&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;split&lt;/span&gt;,

  &lt;span class=&quot;cd&quot;&gt;-- proof by contradiction so it should output False&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;by_contradiction&lt;/span&gt;,
   
   &lt;span class=&quot;o&quot;&gt;/-&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;hypothesis&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h1&lt;/span&gt;, &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;divides&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;proved&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;by&lt;/span&gt;  
   &lt;span class=&quot;n&quot;&gt;min_fac_dvd&lt;/span&gt; : &lt;span class=&quot;o&quot;&gt;∀&lt;/span&gt; (&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; : &lt;span class=&quot;o&quot;&gt;ℕ&lt;/span&gt;), &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;min_fac&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;∣&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;-/&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;have&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₁&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;∣&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;factorial&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; := &lt;span class=&quot;n&quot;&gt;min_fac_dvd&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;M&lt;/span&gt;, 
   
   &lt;span class=&quot;cd&quot;&gt;-- hypothesis h2, p divides N!&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;have&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₂&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;∣&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;factorial&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;N&lt;/span&gt; := 
   &lt;span class=&quot;k&quot;&gt;begin&lt;/span&gt;
     &lt;span class=&quot;n&quot;&gt;refine&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dvd_factorial&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mpr&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;,
     &lt;span class=&quot;cd&quot;&gt;-- proved p &amp;lt;= N, using hypothsis h&lt;/span&gt;
     &lt;span class=&quot;n&quot;&gt;exact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;le_of_not_ge&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;,
   &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;,
   &lt;span class=&quot;o&quot;&gt;/-&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;proved&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dvd_add_right&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;support&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;hypothesis&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₂&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₁&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;-/&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;have&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; : &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;∣&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; := (&lt;span class=&quot;n&quot;&gt;nat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dvd_add_right&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₂&lt;/span&gt;)&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mp&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;₁&lt;/span&gt;,
   &lt;span class=&quot;cd&quot;&gt;-- prime not dividing one using local hypothesis pp and h&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;exact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;prime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;not_dvd_one&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pp&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;, &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;,
   &lt;span class=&quot;cd&quot;&gt;-- second part of proof is just our hypothesis pp that we already proved&lt;/span&gt;
  &lt;span class=&quot;err&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exact&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pp&lt;/span&gt;, &lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;,
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;

&lt;ol class=&quot;bibliography&quot;&gt;&lt;li&gt;&lt;span id=&quot;Sphinx_2021_github&quot;&gt;&lt;i&gt;Theorem Proving in Lean — Theorem Proving in Lean 3.23.0 Documentation&lt;/i&gt;. &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://leanprover.github.io/theorem_proving_in_lean/&quot;&gt;https://leanprover.github.io/theorem_proving_in_lean&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;Mathematical_Induction_2021_github&quot;&gt;&lt;i&gt;Logical Verification 2020–2021&lt;/i&gt;. &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://lean-forward.github.io/logical-verification/2020/&quot;&gt;https://lean-forward.github.io/logical-verification/2020&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;Last_First_2021_ac&quot;&gt;&lt;i&gt;The Natural Number Game&lt;/i&gt;. &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://www.ma.imperial.ac.uk/ buzzard/xena/natural_number_game/&quot;&gt;https://ma.imperial.ac.uk/ buzzard/xenanatural_number_game&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;Mario_Carneiro_2021_ru&quot;&gt;Carneiro, Mario. &lt;i&gt;Formalizing 100 Theorems&lt;/i&gt;. 2021, &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://www.cs.ru.nl/ freek/100/index.html&quot;&gt;https://cs.ru.nl/ freek/100/index.html&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;Doing_2021_wordpress&quot;&gt;Doing. &lt;i&gt;Xena | Mathematicians Learning Lean by Doing.&lt;/i&gt; &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://xenaproject.wordpress.com/&quot;&gt;https://xenaproject.wordpress.com&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;Discussing_His_Vision_2021_youtube&quot;&gt;Vision, Discussing His. &lt;i&gt;The Future of Mathematics? - YouTube&lt;/i&gt;. &lt;a style=&quot;color:black; text-decoration: underline;&quot; href=&quot;https://www.youtube.com/watch?v=Dp-mQ3HxgDE&quot;&gt;https://youtube.com/watch?v=Dp-mQ3HxgDE&lt;/a&gt;.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;!-- [Theorem proving in lean](https://leanprover.github.io/theorem_proving_in_lean/)

[lean-forward.github.io](https://lean-forward.github.io/logical-verification/2020/)

[Natural Number Game By Kevin Buzzard and Mohammad Pedramfar.](https://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/)

[Formalizing 100 theorems](http://www.cs.ru.nl/~freek/100/index.html)

[Xena Project](https://xenaproject.wordpress.com/)

[The Future of Mathematics?](https://www.youtube.com/watch?v=Dp-mQ3HxgDE&amp;ab_channel=MicrosoftResearch) --&gt;
</description>
        <pubDate>Sun, 11 Dec 2022 00:00:00 +0530</pubDate>
        <link>/articles/22/intro-to-lean</link>
        <guid isPermaLink="true">/articles/22/intro-to-lean</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Never Split the Difference</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 100}
});
&lt;/script&gt;

&lt;p&gt;Negotiation is everywhere from finalizing a time and location to meet with friends to buying a gym membership at a reasonable price. This is a self help book for anyone who wants to hone their negotation skill.&lt;/p&gt;

&lt;p&gt;Negotitaion = Information Gathering + Behavior Influence&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Great negotiation is when you win but make it seem like your counterpart won. Great negotiation is about great collaboration.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;chapter-1-the-new-rules&quot;&gt;Chapter 1: The New Rules&lt;/h2&gt;

&lt;p&gt;Book starts with a very niche technique to consider during negotiation to get out of a tight spot. Below is an excerpt from the book which illustrates the technique.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; “C’mon. Get me the money or I cut your son’s throat right now,” Mnookin said. Testy.
I gave him a long, slow stare. Then I smiled.
“How am I supposed to do that?” &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Open-ended questions&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Such open-ended questioning gives your counterparts &lt;em&gt;illusion of control&lt;/em&gt;. They start thinking that they possess the key to this negotiation. All this gives you one of the most important thing during negotiation &lt;strong&gt;the time to think&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; “I’m sorry, Robert, how do I know he’s even alive?” I said, using an apology and his first name, seeding more warmth into the interaction in order to complicate his gambit to bulldoze me. “I really am sorry, but how can I get you any money right now, much less one million dollars, if I don’t even know he’s alive?”&lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Hey I have a problem, solve it for me friend!&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Presenting the problem with the terms of negotition in question form (and not straight away pointing out the issue) may compels your counterparts in negotitaion to understand the unreasonable nature of the terms.&lt;/p&gt;

&lt;p&gt;Apologetic tone coupled with friendly use of words during address eases the conversation. This technique can be used when you aren’t getting any authority in negotiation. This technique will give you some chances to steer the negotitaion your way.&lt;/p&gt;

&lt;p&gt;Both of the above examples correspond to tactics called &lt;strong&gt;calibrated questions&lt;/strong&gt;: queries that the other side can respond to but that have no fixed answers. Main purpose of this tactics to buy you some time to think.&lt;/p&gt;

&lt;p&gt;Answering such question demand that you possess deep emotional strength i.e you need to keep aside your emotions and your feeling about what other side means and from my point of view, you could even raise a counter question, like &lt;em&gt;what seems to be the problem with which you think I can help you&lt;/em&gt;. This will give us insights into line of thinking of your counterpart about why he/she needs time to think through our offer or what bothers him/her. Once you get the information which your counterpart is hiding like the motive of negotitaion or even some small information which can help with your terms, you can gain authority without letting the other party know.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In negotiation, one should follow a strict sequence of actions (like in &lt;a href=&quot;/articles/21/banta-zopa&quot;&gt;Banta &amp;amp; Zopa&lt;/a&gt;) rather play around as per the psychology and nature of your counterpart.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Other mistake in negotiation is to think that your counterpart is fully rational and selfish and is not affected by emotions, rather its found in studies that emotion plays a very important role in negotiation which has the power to influence the rational thinking and logical mind. &lt;label for=&quot;thinking-fast-and-slow&quot; class=&quot;margin-toggle sidenote-number&quot;&gt;&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;thinking-fast-and-slow&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;sidenote&quot;&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow&quot;&gt;Thinking, Fast and Slow&lt;/a&gt;  by Daniel Kahneman. &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Fisher and Ury’s approach &lt;label for=&quot;getting-to-say-yes&quot; class=&quot;margin-toggle sidenote-number&quot;&gt;&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;getting-to-say-yes&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;sidenote&quot;&gt;Talked about in the book &lt;a href=&quot;https://en.wikipedia.org/wiki/Getting_to_Yes&quot;&gt;getting to say yes&lt;/a&gt;. &lt;/span&gt; was introduced with acceptance of the above stated idea, and to mitigate or remove these emotions from the negotiation to collectively solve the problem in a more rational manner. The core principle of the approach was:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Seperate the emotions in negotiation&lt;/li&gt;
  &lt;li&gt;Not to target the &lt;em&gt;what they are asking for&lt;/em&gt; and rather look for &lt;em&gt;why they are asking for it&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;Work in co-operation to reach a win-win deal&lt;/li&gt;
  &lt;li&gt;Establish some standards for the negotiation which should be agreed by both parties&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Decision made by people can be influenced by \(n\) number of ways. One of which is &lt;em&gt;framing effect&lt;/em&gt;. It is a proven technique showcasing that people respond differently to same question framed in different way - positive or negative connotations; e.g. as a loss or as a gain. People tend to avoid risk when a positive frame is presented but seek risks when a negative frame is presented. &lt;label for=&quot;prospect-theory&quot; class=&quot;margin-toggle sidenote-number&quot;&gt;&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;prospect-theory&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;sidenote&quot;&gt;Such behaviour is caused due to people being more sensitivity towards loss than for gain when things are uncertain. &lt;a href=&quot;https://en.wikipedia.org/wiki/Loss_aversion&quot;&gt; [Loss Aversion]&lt;/a&gt; but when the loss becomes more and more uncertain people tend to take more risks. &lt;/span&gt;&lt;/p&gt;

&lt;style&gt;
  .embed-container {
    position: relative;
    padding-bottom:56.25%;
    padding-top:30px;
    overflow: hidden;
    max-width: 70%;
    margin-bottom: -23%;
  }
  .embed-container iframe,
  .embed-container object,
  .embed-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    height: 55%;
  }
&lt;/style&gt;

&lt;div class=&quot;embed-container&quot;&gt;
  &lt;iframe title=&quot;YouTube video player&quot; width=&quot;480&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/vBX-KulgJ1o&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;Example: Bet, if I win, you give me $10 and if you win I give you $10. This will be decided with a flip of coin. Most people avert the risk and decline to play. But when same experiment is conducted with more number of trials coupled more payoff when you win, say I give you $20 but when you lose you only give $10 on each trail, people tend to take interest. This is due uncertainity of loss mathematically. \(P(heads) = 0.5\) and \(P(tails) = 0.5\). So mathematically speaking, you will win in 50% of cases and get paid with $20.&lt;/p&gt;

&lt;p&gt;From the above experiment, it quite evident that people are not fully rational and rely on their gut feeling or lets say emotion to make decision. So developing a positive relationship with your counterpart is important to influence their emotions.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; It all starts with the universally applicable premise that people want to be understood and accepted. Listening is the cheapest, yet most effective concession we can make to get there. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Active Listening&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;When people think they are being listened attentively they listen to themselves in much more constructive manner lower their defenses on their point of view and become willing to accept other’s opinion. This whole technique is refered as &lt;strong&gt;Tactical Empathy&lt;/strong&gt;. This technique imparts the power of influence while balancing the emotions of your counterpart during a negotiation.&lt;/p&gt;

&lt;h2 id=&quot;chapter-2-be-a-mirror&quot;&gt;Chapter 2: Be a Mirror&lt;/h2&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; Good negotiators, going in, know they have to be ready for possible surprises; great negotiators aim to use their skills to reveal the surprises they are certain exist. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Surprise Surprise&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The moment seasoned negotiators enters a negotiation, they start forming various hypothesis about various factors affecting the negotiation. Then they use their secret weapons, i.e listening, calibrated questioning or mirroring, and narrow down the variables in negotiation. Here listening not only removes element of surprise from your counterpart’s end but also gives you enough intel to form your own arsenal of surprise.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; You should engage the process with a mindset of discovery. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Explore then exploit&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You try forego any bias and explore uncharted territories of your counterpart’s mind as farther as you can. This is a systematic approach so never delve in any negotiation with preconcieved notions or conclusions. You can only form conclusions once you know what and who are dealing with.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; Great negotiators are able to question the assumptions that the rest of the involved players accept on faith or in arrogance, and thus remain more emotionally open to all possibilities, and more intellectually agile to a fluid situation. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Assumptions are big no.&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You come across an assumption, next time question it right away. Extract intel, get to the your counterparts basis of assumption, what that assumption accomplish. For example. You are at a basketball court and the maintainance staff says its maintainance day. Its normal to assume that its under maintainance, but if you really want to play question them and ask if its undergoing maintainance at the very moment. If that is case, wish good bye and walk home and if not then politely ask, “can you play for sometime until they start with work?”, giving them sence of authority. You can always persist and extract more information with “How am I supposed to do that, we walked 3-5miles to come here” yada yada yada. You get my point.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; until you know what you’re dealing with, you don’t know what you’re dealing with. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Know better&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Apart from the content and context of mind set revealed by your counterpart during your covert interogation, do not just relax with you copy pen in hand, try and match content with tone of voice, body language as they might be trying to through you off feeding you false information. You dont help the one you want to make a deal with by assuming pieces of information make his story consistent for you brain. In short. &lt;em&gt;Look for inconsistencies&lt;/em&gt;.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; state of schizophrenia: everyone just listening to the voice in their head. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Am I schizophrenic&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Its quite often the case that once you get hold of some key information which can act as pivot for your argument we go on to solidify it in our head. Essentially converting the negotiation an incomplete and futile assault towards &lt;em&gt;your way&lt;/em&gt;. You dont indulge in such pedastrian tactics. You go steps and steps untill your counterpart has nothing else to give you. You dont attack early, you have secrets use then when you are certain of a win.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; Wants are easy to talk about, representing the aspiration of getting our way, and sustaining any illusion of control we have as we begin to negotiate; needs imply survival, the very minimum required to make us act, and so make us vulnerable. But neither wants nor needs are where we start; it begins with listening, making it about the other people, validating their emotions, and creating enough trust and safety for a real conversation to begin. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;I want to listen&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The above excerpt really sums up why to listen. &lt;strong&gt;Start with listening, breach thier defences, let them reveal, dont stop them, let them reveal, punch when you have weak points&lt;/strong&gt;.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; Going too fast is one of the mistakes all negotiators are prone to making. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Fast &amp;amp; Furious&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You go on fast, you feel everything is under control. Stop! The very thing letting it be under control is the rapport you have established with your counterpart listening to him and investing time. Keep things slow and calm.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; My job was to find a way to keep him talking. I switched into my Late-Night, FM DJ Voice: deep, soft, slow, and reassuring. &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Legendary FM DJ Voice&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;FM DJ Voice is a downward lilt voice. It’s best employed when establishing points of negotiation that are immovable. It is to be used in conversation no more than 20% of the time. This maintains integrity of its effect and let it convey the immovable points in arguments.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; “Hey, what happened to Joe?”
I said, “Joe’s gone. This is Chris. You’re talking to me now.”
I didn’t put it like a question. I made a downward-inflecting statement, in a downward-inflecting tone of voice.
 &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Its not up for discussion&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Above is an excerpt from the book depicting the effect of FM DJ Voice. But for major part of the conversation try to be more playful and accomodating. This helps in taking negotation forward. Try to radiate good emotions, this will make your counterpart assume that emotion. Just like when we wave and say good morning to a by stander at bus stop they replicate your emotion and action. This is how you control emotions apart from usual conversational aspects. This will get you through people of different cultures as emotions are same across the earth.&lt;/p&gt;

&lt;p&gt;There is another tone called assertive. This voice is declarative, straight up, and delivered like a punch in the nose. And it converts negotiation in boxing. Dont use it until and unless absolutely necessary. It breaks more than it makes.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; “The other vehicle’s not out there because you guys chased my driver away . . .” he blurted.
“We chased your driver away?” I mirrored.
“Well, when he seen the police he cut.”
“We don’t know anything about this guy; is he the one who was driving the van?” I asked.
 &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;You answer, I question.&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Mirroring is where you try to comfort your counterpart by imitating &lt;label for=&quot;mirror-imitate&quot; class=&quot;margin-toggle sidenote-number&quot;&gt;&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;mirror-imitate&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;sidenote&quot;&gt;Humans copy each other to comfort each other. We can copy content like using their words on them as a question or imitate their body language or tone. &lt;/span&gt; them.&lt;/p&gt;

&lt;p&gt;As per FBI, you repeat last one to three words of what someone has just said to create a mirror. This gives you superpower to seem agreeable while disagreeing to someones point.&lt;/p&gt;

&lt;p&gt;Now you might be thinking how to deal with someone who is just throwing punches, talking assertive. Obviously, you can’t mirror him there. So you first of all summon your &lt;em&gt;Late Night FM DJ Voice&lt;/em&gt;. Then do following:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Start with apology to comfort&lt;/li&gt;
  &lt;li&gt;Mirror&lt;/li&gt;
  &lt;li&gt;Be silence, 3-4 seconds to let mirror have effect&lt;/li&gt;
  &lt;li&gt;Repeat&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below is a small conversation on how to take on assetive person.&lt;/p&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt; “Let’s make two copies of all the paperwork.” boss said&lt;br /&gt;
“I’m sorry, two copies?” she mirrored in FM DJ voice + inquisitive tone (meaning to ask for help)&lt;br /&gt;
“Yes,” her boss responded, “one for us and one for the customer.” &lt;br /&gt;
“I’m sorry, so you are saying that the client is asking for a copy and we need a copy for internal use?” She asked&lt;br /&gt;
“Actually, I’ll check with the client—they haven’t asked for anything. But I definitely want a copy. That’s just how I do business.” boss replied&lt;br /&gt;
“Absolutely,” she responded. “Thanks for checking with the customer. Where would you like to store the in-house copy? There’s no more space in the file room here.” She asked &lt;br /&gt;
“It’s fine. You can store it anywhere,” he said, slightly perturbed now.&lt;br /&gt;
“Anywhere?” she mirrored again, with calm concern.&lt;br /&gt;
“As a matter of fact, you can put them in my office,” he said, with more composure than he’d had the whole conversation.&lt;br /&gt;
“I’ll get the new assistant to print it for me after the project is done. For now, just create two digital backups.” Boss said &lt;/p&gt;&lt;footer&gt;, &lt;cite&gt;Sorry but I will mirror&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Use mirrors to create a bond, keep people talking, buy time, and encourage your counterparts to reveal their strategy.&lt;/p&gt;

&lt;!-- ## Chapter 3: Don’t Feel Their Pain, Label It --&gt;
</description>
        <pubDate>Fri, 05 Feb 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/never-split-the-difference</link>
        <guid isPermaLink="true">/articles/21/never-split-the-difference</guid>
        
        
        <category>book</category>
        
      </item>
    
      <item>
        <title>BANTA &amp; ZOPA</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 100}
});
&lt;/script&gt;

&lt;h2 id=&quot;banta&quot;&gt;Banta&lt;/h2&gt;

&lt;p&gt;“BATNA” is an acronym which stands for ‘Best Alternative to a Negotiated Agreement. It helps you in making a guess about your options if you are unsuccessful in agreeing on a deal.&lt;/p&gt;

&lt;p&gt;During negotiation, you not only need to access your BANTA but also of your negotiation counterparts. If your counterpart doesn’t have options then your BANTA doesn’t hold too much significance and same goes for you.&lt;/p&gt;

&lt;p&gt;Apart from establishing a BANTA, it is also advised to establish a &lt;strong&gt;Reservation Value&lt;/strong&gt;, which is least favourable number on which you will agree.&lt;/p&gt;

&lt;p&gt;Example: If you are in a condition where you already have a initial offer on a piece of hardware, say $1900, then such offer can act as BANTA as long as you are comfortable with it and willing to accept it. Then you might want to set a bit higher reservation value, let say $2000, for your other negotitions.&lt;/p&gt;

&lt;h2 id=&quot;zopa&quot;&gt;Zopa&lt;/h2&gt;

&lt;p&gt;&quot;”ZOPA” stands for Zone of Possible Agreement. As the name suggests, it is range which both parties consider favourable as per their established BANTA.&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;&lt;a href=&quot;http://www.successfulnegotiators.com/negotiators-blog/2017/1/16/basic-negotiation-terminology-batna-reservation-value-zopa&quot;&gt;Source&lt;/a&gt;&lt;/figcaption&gt;&lt;img src=&quot;/assets/img/banta-zopa/banta-zopa.png&quot; /&gt;&lt;/figure&gt;

&lt;p&gt;We generally are more interested in knowing our counterpart’s BANTA and reservation value. It is found out which some certainity during the negotition. But before the negotiation, we need to collect some open information like if you can get his/her bid for similar item, etc. Then using such information, we make our initial estimate.&lt;/p&gt;
</description>
        <pubDate>Tue, 02 Feb 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/banta-zopa</link>
        <guid isPermaLink="true">/articles/21/banta-zopa</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Thinking, Fast and Slow</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 100}
});
&lt;/script&gt;

&lt;p&gt;The book revolves around two systems that drive human thought:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;System 1: Fast, automatic, intuitive, and emotional. It operates effortlessly and is prone to biases and errors due to its reliance on heuristics.&lt;/li&gt;
  &lt;li&gt;System 2: Slow, deliberate, analytical, and logical. It requires effort and is often engaged for complex or unfamiliar problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: System 1 helps us quickly judge if someone looks angry, while System 2 is needed to solve a math problem like 17 × 24.&lt;/p&gt;

&lt;h2 id=&quot;anchoring-effect&quot;&gt;Anchoring Effect&lt;/h2&gt;

&lt;p&gt;Our judgments are often influenced by arbitrary numbers or information we encounter, even when they are irrelevant to the task at hand. This is the anchoring effect.&lt;/p&gt;

&lt;p&gt;Example: When asked to estimate the percentage of African nations in the UN, participants’ answers were influenced by spinning a wheel of fortune showing random numbers. A higher number led to higher estimates.&lt;/p&gt;

&lt;p&gt;Anchoring occurs when individuals rely too heavily on the first piece of information they encounter&lt;/p&gt;

&lt;h2 id=&quot;the-availability-heuristic&quot;&gt;The Availability Heuristic&lt;/h2&gt;

&lt;p&gt;People judge the probability of an event based on how easily examples come to mind. This can lead to overestimating the likelihood of dramatic or recent events.&lt;/p&gt;

&lt;p&gt;Example: Plane crashes are perceived as more frequent than they are because they receive extensive media coverage, making them easier to recall compared to car accidents, which are far more common.&lt;/p&gt;

&lt;h2 id=&quot;loss-aversion&quot;&gt;Loss Aversion&lt;/h2&gt;

&lt;p&gt;Humans feel the pain of loss more acutely than the pleasure of gain. This principle explains why people often avoid risks, even when potential rewards outweigh the risks.&lt;/p&gt;

&lt;p&gt;Example: Losing $50 feels more painful than the pleasure gained from winning $50.&lt;/p&gt;

&lt;p&gt;Loss aversion is a key concept in prospect theory, which explains decision-making under risk.&lt;/p&gt;

&lt;h2 id=&quot;the-endowment-effect&quot;&gt;The Endowment Effect&lt;/h2&gt;

&lt;p&gt;Ownership increases the perceived value of an object. People often demand much more to give up an item they own than they would be willing to pay to acquire it.&lt;/p&gt;

&lt;p&gt;Example: A person who owns a mug might value it at $10, but if they didn’t own it, they might only be willing to pay $5 for it.&lt;/p&gt;

&lt;h2 id=&quot;overconfidence-bias&quot;&gt;Overconfidence Bias&lt;/h2&gt;

&lt;p&gt;People tend to overestimate the accuracy of their judgments and knowledge. This can lead to poor decision-making, especially in complex situations where uncertainty is high.&lt;/p&gt;

&lt;p&gt;Example: Experts in fields like stock market prediction often overrate their ability to forecast trends accurately.&lt;/p&gt;

&lt;h2 id=&quot;the-planning-fallacy&quot;&gt;The Planning Fallacy&lt;/h2&gt;

&lt;p&gt;People are overly optimistic about how much time, resources, or effort a task will take, often underestimating potential obstacles.&lt;/p&gt;

&lt;p&gt;Example: Construction projects frequently take longer and cost more than initially planned due to this bias.&lt;/p&gt;

&lt;p&gt;The planning fallacy is a tendency to underestimate time, costs, and risks, while overestimating benefits.&lt;/p&gt;

&lt;h2 id=&quot;the-halo-effect&quot;&gt;The Halo Effect&lt;/h2&gt;

&lt;p&gt;First impressions or a single positive trait can influence how we perceive unrelated attributes of a person or situation.&lt;/p&gt;

&lt;p&gt;Example: A competent and friendly employee might be assumed to be more capable than they actually are, just because of their warmth.&lt;/p&gt;

&lt;h2 id=&quot;regression-to-the-mean&quot;&gt;Regression to the Mean&lt;/h2&gt;

&lt;p&gt;When outcomes are extreme, they tend to be followed by more moderate outcomes. This is not due to causation but simply statistical probability.&lt;/p&gt;

&lt;p&gt;Example: A student who scores unusually high on a test is likely to score closer to average on subsequent tests.&lt;/p&gt;

&lt;p&gt;These excerpts illustrate the rich insights from Thinking, Fast and Slow and highlight its relevance to understanding decision-making, biases, and human behavior. Let me know if you’d like to explore specific chapters or concepts further!&lt;/p&gt;

</description>
        <pubDate>Sun, 31 Jan 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/thinking-fast-and-slow</link>
        <guid isPermaLink="true">/articles/21/thinking-fast-and-slow</guid>
        
        
        <category>book</category>
        
      </item>
    
      <item>
        <title>Lean Proof Assistant</title>
        <description>
</description>
        <pubDate>Thu, 21 Jan 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/a-test-draft</link>
        <guid isPermaLink="true">/articles/21/a-test-draft</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>How to read HeadCT</title>
        <description>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
MathJax.Hub.Config({
  &lt;!-- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, --&gt;
  jax: [&quot;input/TeX&quot;,&quot;output/HTML-CSS&quot;],
  displayAlign: &quot;left&quot;,
  &quot;HTML-CSS&quot;: { scale: 100}
});
&lt;/script&gt;

&lt;p&gt;This blogs talks about how to read head ct scans and how to identify different types of bleeds.&lt;/p&gt;

&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Head CT is also called Brain CT. It refers to computed tomography examination of the brain and surrounding structures. It can be performed in 2 ways:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Non-Contrast Study&lt;/li&gt;
  &lt;li&gt;Contrast Study&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Preparation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without Contrast: No preparation is required.&lt;/p&gt;

&lt;p&gt;With Contrast:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Only one CT contrast study should be scheduled within a 48 hour period.&lt;/li&gt;
  &lt;li&gt;BUN &amp;amp; Creatinine must be done within 72 hours of the scan.&lt;/li&gt;
  &lt;li&gt;Nothing but clear liquid after midnight before the scan.&lt;/li&gt;
  &lt;li&gt;NPO 4 hours prior to exam (no food or drink).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;During examination of CT scans, it is important to review old scans as they may provide information which is as clinically important as the current scans&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt;:&lt;/p&gt;

&lt;figure&gt;&lt;figcaption&gt;Example of how past cases may influence diagnosis and treatment.&lt;/figcaption&gt;&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/pathology/previous.jpg&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;img src=&quot;&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;This elderly patient - who presented with acute confusion - has a large area of low density in the right frontal lobe seen on the current CT Review of a previous CT revealed that the abnormality in the brain was not new, but related to an infarct which occurred 5 months earlier The current CT appearances were not the cause of the acute confusion (urinary tract infection in this case)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://wwww.radiologymasterclass.co.uk/tutorials/ct/ct_acute_brain/ct_brain_details&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;approach&quot;&gt;Approach&lt;/h1&gt;

&lt;p&gt;In emergency situations radiologists tend to follow this mnemonic: &lt;strong&gt;Blood Can Be Very Bad&lt;/strong&gt; (BCBVB).&lt;/p&gt;

&lt;p&gt;B: blood&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;look for epidural hematoma, subdural hematoma, intraparenchymal hemorrhage, intraventricular hemorrhage, subarachnoid hemorrhage and (also) extracranial hemorrhage&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;C: cisterns&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;look for the presence of blood, effacement and asymmetry in four key cisterns (perimesencephalic, suprasellar, quadrigeminal and Sylvian cisterns)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;B: brain&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;look for asymmetry or effacement of the sulcal pattern, gray-white matter differentiation (including the insular ribbon sign), structural shifts and abnormal hypodensities (e.g. air, edema, fat) or hyperdensities (e.g. blood, calcification)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;V: ventricles&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;look for intraventricular hemorrhage, ventricular effacement or shift and for hydrocephalus&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;B: bone&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;look for skull fractures (especially basal) on bone windows (soft tissue swelling, mastoid air cells and paranasal sinuses fluid in the setting of trauma should raise the possibility of a skull fracture; intracranial air means that the skull and the dura have been violated somewhere)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://radiopaedia.org/articles/emergency-ct-head-mnemonic?lang=us&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To look for these neuropathology, there is a 3 step process:&lt;/p&gt;
&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/step1.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Step 1&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/step2.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Step 2&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/step3.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Step 3&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;For this blog, we focus on bleeds/hemorrhage and its subtypes.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The following points can be used as a guide to assess a brain CT to demonstrate/exclude a hemorrhage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brain parenchyma&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;is there asymmetry anywhere or obliteration of the gyri sulci pattern?&lt;/li&gt;
  &lt;li&gt;abnormal gray-white matter differentiation?&lt;/li&gt;
  &lt;li&gt;hypo/hyperdense abnormalities?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hemorrhage&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;type/cause/location?&lt;/li&gt;
  &lt;li&gt;subarachnoid cisterns; obliteration of the W shape, pentagon, moon shape, Sylvian fissure?&lt;/li&gt;
  &lt;li&gt;mass effect or signs of herniation?  is there still space around the brain stem?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Ventricular system&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;hydrocephalus?&lt;/li&gt;
  &lt;li&gt;intraventricular blood?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bone&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;extracranial soft tissue swelling?&lt;/li&gt;
  &lt;li&gt;fracture? Pneumocephalus?&lt;/li&gt;
  &lt;li&gt;normal air content of the sinuses and the mastoid?  Air-fluid (blood) levels in the sinus? (CAUTION: fracture!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Old examinations&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;new findings?&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;hemorrhage-categorization&quot;&gt;Hemorrhage Categorization&lt;/h1&gt;

&lt;p&gt;When a blood vessel within the skull is ruptured or leaks, it is called &lt;strong&gt;Intracranial hemorrhage (ICH)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ICH encompasses many conditions characterized by the extravascular accumulation of blood within different intracranial spaces. Following categorization is based on locaiton:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Intra-axial hemorrhage&lt;/strong&gt; is bleeding within the brain itself, or cerebral hemorrhage. This category includes intraparenchymal hemorrhage (bleeding within the brain tissue) and intraventricular hemorrhage (bleeding within the brain’s ventricles).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Subtypes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;intracerebral hemorrhage&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;lobar hemorrhage&lt;/li&gt;
  &lt;li&gt;hypertensive hemorrhage
    &lt;ul&gt;
      &lt;li&gt;basal ganglia hemorrhage&lt;/li&gt;
      &lt;li&gt;pontine hemorrhage&lt;/li&gt;
      &lt;li&gt;cerebellar hemorrhage&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Intracerebral hemorrhage also called intraparenchymal cerebral hemorrhage, is a subset of an intracranial hemorrhage. It is the acute accumulation of blood within the parenchyma (tissues) of the brain.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Extra-axial hemorrhage&lt;/strong&gt;, bleeding that occurs within the skull but outside of the brain tissue, falls into three subtypes: Epidural hemorrhage (extradural hemorrhage) which occur between the dura mater (the outermost meninx) and the skull, is caused by trauma.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Subtypes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;extradural hemorrhage (EDH)&lt;/li&gt;
  &lt;li&gt;intralaminar dural hemorrhage&lt;/li&gt;
  &lt;li&gt;subdural hemorrhage (SDH)&lt;/li&gt;
  &lt;li&gt;subarachnoid hemorrhage (SAH)&lt;/li&gt;
  &lt;li&gt;intraventricular hemorrhage (IVH)&lt;/li&gt;
  &lt;li&gt;subpial hemorrhage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets look at above mentioned neuropathology based on 3 steps metioned in Introduction:&lt;/p&gt;

&lt;h2 id=&quot;brain-parenchyma&quot;&gt;Brain Parenchyma&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Intra-axial hemorrhages&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;lobar-hemorrhage&quot;&gt;Lobar hemorrhage&lt;/h3&gt;

&lt;p&gt;Location : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Lobar -&amp;gt; Lobes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hyperdense collection of blood&lt;/strong&gt;, located superficially within the lobes of the brain (i.e. not in the basal ganglia).&lt;/p&gt;

&lt;p&gt;They are usually large and more common in elderly patients.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/lobar-bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Assoc Prof Frank Gaillard, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/10678&quot;&gt;rID: 10678&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Extension into the subdural or subarachnoid and even intraventricular(common to basal ganglia hemorrhage - &lt;strong&gt;hypertensive&lt;/strong&gt;) space may be seen.&lt;/p&gt;

&lt;h3 id=&quot;hypertensive-hemorrhage&quot;&gt;Hypertensive hemorrhage&lt;/h3&gt;

&lt;p&gt;Distribution that matches incidence of hypertensive hemorrhages:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;80% around basal ganglia&lt;/li&gt;
  &lt;li&gt;10% pons&lt;/li&gt;
  &lt;li&gt;10% cerebellum&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/hypertensive-dist.png&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Hypertensive hemorrhages&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;1- &lt;strong&gt;Basal ganglia hemorrhage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Name pretty much gives away the location of hemorrhage: around basal ganglia.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abnormal Hyperdensity&lt;/strong&gt; centered on the basal ganglia or thalamus. It will be characterized as intraparenchymal hemorrhage.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/basal-ganglia-bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Assoc Prof Frank Gaillard, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/2764&quot;&gt;rID: 2764&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Often times there may be an intraventricular extension. In this case it also becomes intraventricular hemorrhage.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/basal-ganglia-bleed-extension.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Jeremy Jones, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/6223&quot;&gt;rID: 6223&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;2- &lt;strong&gt;Pontine hemorrhage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pontine -&amp;gt; pons&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;These bleeds frequently rupture into the 4th ventricle as shown in figure.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/pontine-bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Assoc Prof Frank Gaillard, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/11062&quot;&gt;rID: 11062&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;3- &lt;strong&gt;Cerebellar hemorrhage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cerebellar hemispheres&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It appears as hyperdensity within the cerebellar hemispheres. Extension into the fourth ventricle or subarachnoid space is relatively common.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/cerebellar-bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Farzad Pirzad, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/9620&quot;&gt;rID: 9620&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;outside-brain-parenchyma&quot;&gt;Outside Brain Parenchyma&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Extra-axial hemorrhage&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;extradural-hemorrhage&quot;&gt;Extradural hemorrhage&lt;/h3&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;between the inner surface of the skull and outer layer of the dura&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;shape: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bi-convex (or lentiform)&lt;/code&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/diagram-intracranial-haemorrhage.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Matt Skalski, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/21542&quot;&gt;rID: 21542&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Extradural hematoma (EDH), also known as an epidural hematoma.&lt;/p&gt;

&lt;p&gt;EDHs are &lt;strong&gt;hyperdense&lt;/strong&gt;. Depending on their size, secondary features of mass effect (e.g. midline shift, subfalcine herniation, uncal herniation) may be present.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/extradural-bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Sandeep Bhuta , &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/4458&quot;&gt;rID: 4458&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id=&quot;intralaminar-dural-hemorrhage&quot;&gt;Intralaminar dural hemorrhage&lt;/h3&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;between the two layers of the dura mater&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Intralaminar dural hematomas in the intracranial space, are exceedingly rare.&lt;/p&gt;

&lt;h3 id=&quot;subdural-hemorrhage&quot;&gt;Subdural hemorrhage&lt;/h3&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;between the dura and arachnoid mater of the meninges around the brain&lt;/code&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/diagram-subdural-haemorrhage.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Matt Skalski, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/21542&quot;&gt;rID: 21542&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;The aspect of a Subdural hemorrhage (SDH) on a CT may vary: from hyperdense/heterogeneous in the acute phase to iso/hypodense during the chronic phase. In a mixed picture, fresh hemorrhages are seen in a chronic subdural hematoma.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hyperacute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;appearance: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;relatively isodense (same density) to cortex with swirled appearance&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;mass-effect: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cerebral swelling accentuates the mass-effect created by the collection of the clot, serum and ongoing unclotted blood.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Acute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;shape: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crescent-shaped&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;appearance: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hyperdense relative to the cortex&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subacute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;duration: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;takes 3-21 days&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;appearance: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isodense to the adjacent cortex&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Isodense appearance makes it hard to detect&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;key-id’s : &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mass-effect, thickening of cortex, CSF-filled sulci do not reach the skull but rather fade out into the subdural.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chronic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;duration: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~3 weeks&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;shape: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;crescentic shape may change to a biconvex&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;appearance: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hypodense&lt;/code&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/subdural-acute-chronic.png&quot; width=&quot;500&quot; /&gt;
&lt;figcaption&gt;Chronic subdural hematoma (= hypodense) at right with an acute bleeding component (= hyperdense). &lt;a href=&quot;https://www.startradiology.com/internships/neurology/brain/ct-brain-hemorrhage/&quot;&gt;Source&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Please refer to ct scans for all above stages &lt;a href=&quot;https://radiopaedia.org/articles/subdural-haemorrhage?lang=us&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;subarachnoid-hemorrhage-sah&quot;&gt;Subarachnoid hemorrhage (SAH)&lt;/h3&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;subarachnoid spaces&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The subarachnoid spaces include the basal cisterns (= space around the brain stem), the Sylvian fissure, the cerebral sulci, the intraventricular space and the interhemispheric fissure&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/diagram-subarachnoid-haemorrhage.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Dr Matt Skalski, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/21542&quot;&gt;rID: 21542&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Small amounts of blood can sometimes be appreciated pooling in the interpeduncular fossa, appearing as a small hyperdense triangle, or within the occipital horns of the lateral ventricles.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/subarachnoid-prepontine-cisterns-bleed.png&quot; width=&quot;500&quot; /&gt;
&lt;figcaption&gt;Subarachnoid blood in the prepontine cisterns (hyperdense obliteration of the moon shape).&lt;a href=&quot;https://www.startradiology.com/internships/neurology/brain/ct-brain-hemorrhage/&quot;&gt;Source&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/subarachnoid-cortical.png&quot; width=&quot;500&quot; /&gt;
&lt;figcaption&gt;Blood along the right cerebral convexity. The blood follows the cortical gyri sulci pattern, characteristic of subarachnoid blood.&lt;a href=&quot;https://www.startradiology.com/internships/neurology/brain/ct-brain-hemorrhage/&quot;&gt;Source&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/subarachnoid-intraventricular.png&quot; width=&quot;500&quot; /&gt;
&lt;figcaption&gt;Extensive intraventricular blood in the left lateral ventricle, the aqueduct and the 4th ventricle.&lt;a href=&quot;https://www.startradiology.com/internships/neurology/brain/ct-brain-hemorrhage/&quot;&gt;Source&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id=&quot;intraventricular-hemorrhage&quot;&gt;Intraventricular hemorrhage&lt;/h3&gt;

&lt;p&gt;Intraventricular hemorrhage (IVH) denotes the presence of blood within the cerebral ventricular system.&lt;/p&gt;

&lt;p&gt;IVH is divided in 2 types: &lt;label for=&quot;side-note-3&quot; class=&quot;margin-toggle sidenote-number&quot;&gt;&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;side-note-3&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;sidenote&quot;&gt;\(P(primary) &amp;lt; P(secondary) \rightarrow\) P being probablity &lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Primary - blood in the ventricles with little (if any) parenchymal blood&lt;/li&gt;
  &lt;li&gt;Secondary - a large extraventricular component is present (e.g. parenchymal or subarachnoid) with secondary extension into the ventricles&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In above sections on hypertensive hemorrhage and subarachnoid hemorrhage, IVH CT scan is shown.&lt;/p&gt;

&lt;h3 id=&quot;subpial-hemorrhage&quot;&gt;Subpial hemorrhage&lt;/h3&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;between the cortical surface and the pia mater&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Difficult to distinguish from subarachnoid hemorrhage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is very rare type of extra-axial intracranial hemorrhage.&lt;/p&gt;

&lt;h2 id=&quot;cerebral-hemorrhagic-contusion&quot;&gt;Cerebral hemorrhagic contusion&lt;/h2&gt;

&lt;p&gt;location: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in the frontal lobes adjacent to the floor of the anterior cranial fossa and in the temporal poles&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;appearance: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hyperdense foci&lt;/code&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/cerebral-contusions-bifrontal.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of Assoc Prof Frank Gaillard, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/7149&quot;&gt;rID: 7149&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Hemorrhagic contusion are common to see in significant head injury. Most contusions represent the brain coming to a sudden stop against the inner surface of the skull (contrecoup) accentuated by the natural contours of the skull.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Contusions vary in size and can appear as small petechial foci of hyperdensity/hemorrhages involving the grey matter and subcortical white matter or large cortical/subcortical bleed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;key-findings&quot;&gt;Key Findings&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Midline Shift&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Midline of the brain is curved due to pressure build up inside brain either due to swelling or bleeding.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/read-ct/midline.jpg&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Case courtesy of UoE Radiology, &lt;a href=&quot;https://radiopaedia.org/&quot;&gt;Radiopaedia.org&lt;/a&gt;. From the case &lt;a href=&quot;https://radiopaedia.org/cases/34098&quot;&gt;rID: 34098&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Caused due to following:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;extra-axial collection causing mass effect&lt;/li&gt;
  &lt;li&gt;parenchymal tumor causing mass effect&lt;/li&gt;
  &lt;li&gt;stroke with associated edema causing mass effect&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Mass Effect&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mass effect describes what happens around a tumor in the brain. It may be caused by:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;tumors&lt;/li&gt;
  &lt;li&gt;cerebral abscess&lt;/li&gt;
  &lt;li&gt;infarction and associated edema&lt;/li&gt;
  &lt;li&gt;hemorrhage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Hydrocephalus&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It describes the situation where the intracranial ventricular system is enlarged because of increased pressure. It may be caused by:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;obstruction of CSF flow.&lt;/li&gt;
  &lt;li&gt;altered CSF dynamics.&lt;/li&gt;
&lt;/ol&gt;

</description>
        <pubDate>Sat, 09 Jan 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/how-to-read-head-ct</link>
        <guid isPermaLink="true">/articles/21/how-to-read-head-ct</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Brain Anatomy using CT Scans</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;What is a CT scan? Brain components visible in CT scan and their relevance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This blog doesn’t dig deep into anatomy and may miss many key terms. Its purpose is to be familiar with brain anatomy for CT.&lt;/p&gt;

&lt;p&gt;CT scans use a series of X-ray beams passed through the head. The images are then developed on sensitive film. This method creates cross-sectional images of the brain and shows the structure of the brain, but not its function.&lt;/p&gt;

&lt;p&gt;Brain imaging methods allow neuroscientists to see inside the living brain. These methods help neuroscientists:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Understand the relationships between specific areas of the brain and what function they serve.&lt;/li&gt;
  &lt;li&gt;Locate the areas of the brain that are affected by neurological disorders.&lt;/li&gt;
  &lt;li&gt;Develop new strategies to treat brain disorders&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;label for=&quot;side-note-video&quot; class=&quot;margin-toggle&quot;&gt; ⊕&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;side-note-video&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;marginnote&quot;&gt;Brain Imaging, Crash Course &lt;/span&gt;&lt;/p&gt;
&lt;style&gt;
  .embed-container {
    position: relative;
    padding-bottom:56.25%;
    padding-top:30px;
    overflow: hidden;
    max-width: 70%;
    margin-bottom: -23%;
  }
  .embed-container iframe,
  .embed-container object,
  .embed-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 80%;
    height: 55%;
  }
&lt;/style&gt;

&lt;div class=&quot;embed-container&quot;&gt;
  &lt;iframe title=&quot;YouTube video player&quot; width=&quot;480&quot; height=&quot;360&quot; src=&quot;https://www.youtube.com/embed/DdPRfPm9SI4&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Understanding brain anatomy is important to read CT scans. In this blog we will go through key anatomy which will make CT scans more apparent to you. For the first, CT scans are viewed from below, so right side of the brain is on left side of viewer. Front part of head (Anterior) is on top.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/sides.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;CT Scan Orientation&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h1 id=&quot;anatomy&quot;&gt;Anatomy&lt;/h1&gt;

&lt;h2 id=&quot;skull&quot;&gt;Skull&lt;/h2&gt;

&lt;p&gt;The brain is located inside an area bounded by skull and skull base called cranial vault. It is a protective casing for brain and brianstem. At the skull base the bones of the cranial vault form the cranial fossae which accommodate and support the brain.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/6/69/1311_Brain_Stem.jpg&quot; width=&quot;400&quot; /&gt; &lt;label for=&quot;note-id&quot; class=&quot;margin-toggle&quot;&gt; ⊕&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;note-id&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;marginnote&quot;&gt;Brain Stem &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/cranial-fossae.png&quot; width=&quot;300&quot; /&gt;&lt;label for=&quot;note-id&quot; class=&quot;margin-toggle&quot;&gt; ⊕&lt;/label&gt;&lt;input type=&quot;checkbox&quot; id=&quot;note-id&quot; class=&quot;margin-toggle&quot; /&gt;&lt;span class=&quot;marginnote&quot;&gt;Cranial Fossae &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Skull sutures has jagged appearance by nature they are not to be confused with fracture. In the figure, &lt;strong&gt;dipole&lt;/strong&gt; is a porous bone tissue which seprates outer (thick and dense) and inner (thin, dense and brittle) tables. &lt;a href=&quot;https://en.wikipedia.org/wiki/Calvaria_(skull)#Layers&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/skull.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Skull Bone Structure&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Sutures&lt;/strong&gt;: There are 4 main sutures:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Coronal (Connects &lt;em&gt;frontal bone with parietal bones&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;Sagittal (Connects &lt;em&gt;parietal bones in the midline&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;Lambdoid (Connects &lt;em&gt;parietal bones with the occipital bone&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;Squamosal (Connects &lt;em&gt;squamous portion of the temporal bone with the parietal bones&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;Metopic (Present in adults, Connects &lt;em&gt;2 fontal bones&lt;/em&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/sutures.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Sutures&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;blockquote&gt;
  &lt;p&gt;Thinnest part of skull is &lt;strong&gt;PTERION&lt;/strong&gt;. The frontal, parietal, temporal and sphenoid bones unite at this point.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;sinuses&quot;&gt;Sinuses&lt;/h2&gt;

&lt;p&gt;The sinuses are hollow spaces in the skull and the face bones around your nose.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Sinuses Overlay on Face&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Sinuses Overlay on CT&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Frontal Sinuses on CT&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/sinuses-face.png&quot; width=&quot;400&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/sinuses.png&quot; width=&quot;300&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/frontal-sinuses.png&quot; width=&quot;300&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;blockquote&gt;
  &lt;p&gt;The mastoid air cells are continuous with the middle ear.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;In case of trauma, fluid in the sphenoid sinus may be a sign of a basal skull fracture.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;CT Scan for Basal skull fracture&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Symptoms&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/basilar-skull.png&quot; width=&quot;330&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;/assets/img/brain-anatomy-ct/skull-fracture-signs.png&quot; width=&quot;350&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;a href=&quot;http://www.emdocs.net/basilar-skull-fracture-basics-beyond/&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;meninges&quot;&gt;Meninges&lt;/h2&gt;

&lt;p&gt;Meninges refer to the membranous coverings of the brain and spinal cord.&lt;/p&gt;

&lt;p&gt;Knowledge about meninges is essential for understanding intracranial bleeding and infection (meningitis) in CT scans.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/meninges_4.jpg&quot; /&gt;
&lt;figcaption&gt;Meninges&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;There are three layers of meninges (Acronym: Digital Audio Player):&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Dura mater&lt;/li&gt;
  &lt;li&gt;Arachnoid mater&lt;/li&gt;
  &lt;li&gt;Pia mater.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/Overview-of-the-Meninges-of-the-Brain.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Overview of the meninges, and their relationship to the skull and brain&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Functions of these covering include:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;To act as supportive framework for the cerebral and cranial vasculature.&lt;/li&gt;
  &lt;li&gt;Acting with cerebrospinal fluid to protect the central nervous system from mechanical damage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;dura-mater&quot;&gt;Dura Mater&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://teachmeanatomy.info/neuroanatomy/structures/meninges/&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Physical property: hick, tough and inextensible.&lt;/p&gt;

&lt;p&gt;Within the cranial cavity, the dura contains two connective tissue sheets:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Periosteal layer – lines the inner surface of the bones of the cranium.&lt;/li&gt;
  &lt;li&gt;Meningeal layer – only layer present in the vertebral column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://teachmeanatomy.info/wp-content/uploads/Dura-Mater-in-Meningitis.jpg&quot;&gt;&lt;strong&gt;Viewer Discretion is advised&lt;/strong&gt; - Autopsy of a patient with meningitis. The dura mater is being retracted to show a grossly swollen cerebrum with pus accumulation.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tentorium cerebelli&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tentorium is an extension of the dura; it separates the cerebrum (brain) from the cerebellum.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/b/b7/Illu_tentorium.jpg&quot; /&gt;
&lt;/figure&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/bleed.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Tentorial Subdural Hemorrhage&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://sinaiem.org/tentorial-subdural-hemorrhage/#:~:text=They%20may%20resemble%20intraparenchymal%20bleed,portion%20of%20the%20occipital%20lobes.&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is what Tentorial Subdural Hemorrhage look like on CT. It may resemble &lt;a href=&quot;https://en.wikipedia.org/wiki/Intraparenchymal_hemorrhage#:~:text=Intraparenchymal%20hemorrhage%20(IPH)%20is%20one,a%20wide%20spectrum%20of%20disorders.&quot;&gt;intraparenchymal bleed&lt;/a&gt; on CT scans in rare cases.&lt;/p&gt;

&lt;h3 id=&quot;arachnoid-mater&quot;&gt;Arachnoid Mater&lt;/h3&gt;

&lt;p&gt;Underneath the arachnoid is a space known as the sub-arachnoid space. It contains cerebrospinal fluid, which acts to cushion the brain.&lt;/p&gt;

&lt;h3 id=&quot;pia-mater&quot;&gt;Pia Mater&lt;/h3&gt;

&lt;p&gt;Physical Property: very thin, and tightly adhered to the surface of the brain and spinal cord.&lt;/p&gt;

&lt;p&gt;It covers contours of the brain (the gyri and fissures).&lt;/p&gt;

&lt;h3 id=&quot;falx-cerebri&quot;&gt;Falx cerebri&lt;/h3&gt;

&lt;p&gt;It lies in midline and separates the left and right cerebral hemispheres.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/flax.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Falx cerebri&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;A midline shift may occur when the pressure exerted by the buildup of blood and swelling around the damaged brain tissues is powerful enough to push the entire brain off-center.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://prod-images-static.radiopaedia.org/images/13472872/cb1f533317efe6888fc9620f217ffe_gallery.jpg&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;It suggestes bleeds or swelling in brain.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;cerebrospinal-fluid-csf-spaces&quot;&gt;Cerebrospinal Fluid (CSF) spaces&lt;/h2&gt;

&lt;p&gt;The brain is surrounded by CSF fluids within the sulci, fissures and basal cisterns.&lt;/p&gt;

&lt;p&gt;It serves three main functions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Protection – acts as a cushion for the brain, limiting neural damage in cranial injuries.&lt;/li&gt;
  &lt;li&gt;Buoyancy – immersion in CSF reduces net weight of brain to ~25 grams. This prevents excessive pressure on the base of the brain.&lt;/li&gt;
  &lt;li&gt;Chemical stability – example. it maintains low extracellular K+ for synaptic transmission.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;CSF has lower density than gray or white matter (discussed ahead), hence appear darker in CT scans.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;Gyrus = a fold of the brain surface (plural = gyri)&lt;/li&gt;
  &lt;li&gt;Sulcus = furrow between the gyri which contains CSF (plural = sulci)&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/gyrus.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;It suggestes bleeds or swelling in brain.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id=&quot;fissures&quot;&gt;Fissures&lt;/h3&gt;

&lt;p&gt;These are components of brain which serperate the two halves of the brain.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Two &lt;strong&gt;hemispheres&lt;/strong&gt; are seperated by &lt;strong&gt;interhemispheric fissure&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Two &lt;strong&gt;lobes&lt;/strong&gt; - frontal and temporal lobes are seperated by &lt;strong&gt;Sylvian&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/fissures.png&quot; width=&quot;400&quot; /&gt;
&lt;figcaption&gt;Interhemispheric fissure and Sylvian.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id=&quot;ventricles&quot;&gt;Ventricles&lt;/h3&gt;

&lt;p&gt;Ventricles are spaces inside brain containing CSF and responsible for its production. There are 4 ventricles in brain:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Lateral Ventricles (left and right)&lt;/li&gt;
  &lt;li&gt;Third Ventricle&lt;/li&gt;
  &lt;li&gt;Fourth Ventricle&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
&lt;img src=&quot;/assets/img/brain-anatomy-ct/ventricles-all.png&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Ventricles&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Lateral ventricles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They are located on either side of brain.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/ventricles_lat.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Lateral Ventricle&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Function:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;It ensures the communication between the third and fourth ventricles.&lt;/li&gt;
  &lt;li&gt;It is to house the cerebrospinal fluid (CSF) and provide the passage for its circulation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The marked choroid plexus produces CSF and is usually calcified (hardened by deposition of or conversion into calcium carbonate or another insoluble calcium compound) for adults.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;The volume of the lateral ventricles increases with age.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Third Ventricle&lt;/strong&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/ventricles_third.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Third Ventricle&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Small white colored &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Foramen of Monro&lt;/code&gt; is a messenger between lateral and third ventricle.&lt;/p&gt;

&lt;p&gt;Abnormalities of the third ventricle are associated with various conditions including hydrocephalus, meningitis, and ventriculitis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fourth Ventricle&lt;/strong&gt;&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/ventricles_fourth.jpg&quot; width=&quot;600&quot; /&gt;
&lt;figcaption&gt;Fourth Ventricle&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;blockquote&gt;
  &lt;p&gt;CSF in the basal cisterns surrounds the brain stem structures.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It has 2 function:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Production of cerebrospinal fluid (CSF) by choroid plexus&lt;/li&gt;
  &lt;li&gt;Circulation of CSF&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;brain-lobes&quot;&gt;Brain Lobes&lt;/h2&gt;

&lt;p&gt;Brain has paired lobes.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.mayoclinic.org/-/media/kcms/gbs/patient-consumer/images/2013/11/15/17/44/ds00266_ds00810_im03440_bn7_lobesthu_jpg.png&quot; /&gt;
&lt;figcaption&gt;Brain Lobes&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/lobes_parietal.jpg&quot; /&gt;
&lt;figcaption&gt;Brain Lobes CT Scan&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Front Lobe&lt;/strong&gt; controls cognitive functions and voluntary movement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parietal Lobe&lt;/strong&gt; infers about temperature, taste, touch and movement from impulse recieved from receptors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Occipital Lobe&lt;/strong&gt; is primarily responsible for vision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Temporal Lobe&lt;/strong&gt; processes memories, integrating them with sensations of taste, sound, sight and touch.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Important point to note is that these lobes aren’t well defined and are difficult to point to hence these are also refered to as ‘regions’. Like temporal region, etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;grey-matter-v-white-matter&quot;&gt;Grey matter v white matter&lt;/h2&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/grey_v_white.jpg&quot; /&gt;
&lt;figcaption&gt;Gray Matter vs White Matter&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;blockquote&gt;
  &lt;p&gt;White matter is located centrally and appears blacker than grey matter due to its relatively low density but pathological processes may increase or decrease the differentiation in density between grey and white matter.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Gray Matter&lt;/strong&gt; comprises &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bitcoin (BITC)&lt;/code&gt;. Basal ganglia, Insula, Thalamus, and Cortex.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Grey matter contains relatively few axons and a higher number of cell bodies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/grey.jpg&quot; /&gt;
&lt;figcaption&gt;Gray Matter&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Lets start with cortex, probably most recognized among all. It has huge number of variants in computer science field also :laughing: like &lt;a href=&quot;https://engineering.purdue.edu/elab/CortexNet/&quot;&gt;cortexnet&lt;/a&gt;, &lt;a href=&quot;https://jspuij.github.io/Cortex.Net.Docs&quot;&gt;Cortex.Net&lt;/a&gt;, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cerebral cortex&lt;/strong&gt; is a layer of grey matter formed in gyri over the entire brain surface.&lt;/p&gt;

&lt;p&gt;Cerebral cortex is required for voluntary activities, language, speech, and multiple brain functions, such as thinking and memory. In short you conscious behaviour (as per science).&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The cerebrum is the largest brain structure and part of the forebrain (or prosencephalon). Its prominent outer portion, the cerebral cortex, not only processes sensory and motor information but enables consciousness, our ability to consider ourselves and the outside world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.visiblebody.com/learn/nervous/brain#:~:text=The%20cerebrum%20is%20the%20largest,ourselves%20and%20the%20outside%20world.&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next big thing in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BITC&lt;/code&gt; is probably &lt;strong&gt;thalamus&lt;/strong&gt;. It has many essential roles in human physiology.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Thalamus&lt;/strong&gt; is basically a translator used to convert high level impulses from receptors to low level signals for cerebral cortex.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As for clinical significance, insults to thalamus may result in thalamic pain syndrome.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/basal_ganglia_2.jpg&quot; /&gt;
&lt;figcaption&gt;Thalamus and Basal ganglia&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;Basal ganglia = lentiform nucleus + caudate nucleus&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Important thing to note about &lt;strong&gt;basal ganglia&lt;/strong&gt;, insults to this component may cause movement disorders.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.flintrehab.com/basal-ganglia-brain-damage/&quot;&gt;Symptoms to detect damage basal ganglia&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The movement disorders are generally well treated using neuroplasticity of brain - ability of brain to repair itself- meaning you excersice the affected part often.&lt;/p&gt;

&lt;p&gt;Last of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BITC&lt;/code&gt; - Insula. Name may be small but it regulates immune system itself among other major functions such as taste.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;White Matter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The internal capsules and corpus callosum are clinically important white matter tracts.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;White matter has a high content of myelinated axons.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Corpus Callosum&lt;/strong&gt; is visible in Sagittal CT’s and connects white matter of the left and right cerebral hemispheres. Its clinical significance is that it can let lesions of brain to grow from one hemisphere to other. Elsewhere flax acts as a barrier to such invasions.&lt;/p&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/corpus_callosum.jpg&quot; /&gt;
&lt;figcaption&gt;Corpus Callosum&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal Capsule&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Even a small insult to the internal capsule can have a profound affect on motor and sensory function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;
&lt;img src=&quot;https://www.radiologymasterclass.co.uk/images/ct/ct-brain/anatomy/internal_capsule.jpg&quot; /&gt;
&lt;figcaption&gt;Internal Capsule&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;calcified-structures&quot;&gt;Calcified Structures&lt;/h2&gt;

&lt;p&gt;There are some structures in brain which are normal if calcified.
&lt;a href=&quot;https://www.radiologymasterclass.co.uk/tutorials/ct/ct_brain_anatomy/ct_brain_anatomy_choroid_calcified&quot;&gt;Please refer this&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;final-words&quot;&gt;Final Words&lt;/h1&gt;

&lt;p&gt;You may also checkout &lt;a href=&quot;https://www.radiologycafe.com/medical-students/radiology-basics/head-anatomy&quot;&gt;Head and spine anatomy&lt;/a&gt;. This provides brain anatomy on slice by slice basis.&lt;/p&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.radiologymasterclass.co.uk/&quot;&gt;radiologymasterclass.co.uk&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.kenhub.com/&quot;&gt;kenhub.com&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.mayoclinic.org/&quot;&gt;mayoclinic.org&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://teachmeanatomy.info/&quot;&gt;teachmeanatomy.info&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.radiologycafe.com/medical-students/radiology-basics/head-anatomy&quot;&gt;radiologycafe.com&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Tue, 05 Jan 2021 00:00:00 +0530</pubDate>
        <link>/articles/21/ct-brain-anatomy</link>
        <guid isPermaLink="true">/articles/21/ct-brain-anatomy</guid>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>Introduction to Pydicom</title>
        <description>&lt;p&gt;&lt;a href=&quot;https://pydicom.github.io/&quot;&gt;PyDICOM Website&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code can be found @ &lt;a href=&quot;https://github.com/Ujjwal-9/medical-training/tree/master/dicom-demo&quot;&gt;Github&lt;/a&gt;. Checkout &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dicom-viewer.ipynb&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;/h1&gt;

&lt;p&gt;Pydicom is a pure Python package for working with DICOM files. It lets you read, modify and write DICOM data in an easy “pythonic” way.&lt;/p&gt;

&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using pip:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;pydicom
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Using conda:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;conda &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; conda-forge pydicom
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pydicom comes with its own set of dicom images which can be used to go through examples.&lt;/p&gt;

&lt;p&gt;They also give &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;get_dataset.py&lt;/code&gt; file to download datasets, which is also included in the &lt;a href=&quot;https://github.com/Ujjwal-9/medical-training/tree/master/dicom-demo&quot;&gt;github repo&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python get_datasets.py &lt;span class=&quot;nt&quot;&gt;--show&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;python get_datasets.py &lt;span class=&quot;nt&quot;&gt;--output&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;path&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;tutorial&quot;&gt;Tutorial&lt;/h1&gt;
&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;load_scan&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pydicom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dcmread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'/'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt;               
              &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;listdir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'SliceLocation'&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InstanceNumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ImagePositionPatient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;   
                          &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ImagePositionPatient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliceLocation&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; 
                          &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliceLocation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliceThickness&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;load_scan&lt;/code&gt; loads the dicom files and sorts them according to their &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Instance Number&lt;/code&gt;. It also extracts slice thickness which is a very important parameter in these scans as it is indicative of resolution of the scans. Lower the slice thickness, better the resolution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Slice Thickness&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Slice thickness directly impacts the precision of target localization during treatment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;figure&gt;&lt;figcaption&gt;Slice Increment and Slice Thickness.&lt;/figcaption&gt;&lt;img src=&quot;/assets/img/pydicom-tutorial/slice-increment-and-thickness.png&quot; /&gt;&lt;/figure&gt;

&lt;p&gt;Slice Increment/Spacing refers to the movement of the table/scanner for scanning the next slice.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If slice thickness is greater than slice increment than there is anatomical information loss.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If there is overlap between 2 adjacent slices that is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slice thickness &amp;gt; slice increment&lt;/code&gt; than such cases acts as error correction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HU Scaling&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_pixels_hu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_array&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;int16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;# Convert to Hounsfield units (HU)
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;slope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RescaleSlope&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;int16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        
    &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;int16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RescaleIntercept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;int16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;HU scaling is explained in my &lt;a href=&quot;http://ujjwal9.ml/blog/medicine/2020/12/28/dicom-intro.html&quot;&gt;dicom standard blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiplanar reconstruction&lt;/strong&gt;&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;Multiplanar view of brain.&lt;/figcaption&gt;&lt;img src=&quot;/assets/img/pydicom-tutorial/windowing-org.png&quot; /&gt;&lt;/figure&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sorted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;patient_dicom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliceLocation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# pixel aspects, assuming all slices are the same
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_spacing&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PixelSpacing&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SliceThickness&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ax_aspect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pixel_spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sag_aspect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pixel_spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cor_aspect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;slice_thickness&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# create 3D array
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;img3d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;zeros&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# fill 3D array with the images from the files
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;enumerate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;img2d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pixel_array&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;img3d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;img2d&lt;/span&gt;
    
&lt;span class=&quot;c1&quot;&gt;# print(img3d.shape)
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# plot 3 orthogonal slices
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'off'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img3d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'gray'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ax_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;a2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'off'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img3d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'gray'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sag_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;a3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'off'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img3d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;img_shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'gray'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cor_aspect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;img src=&quot;/assets/img/pydicom-tutorial/mpr.png&quot; /&gt;
&lt;figcaption&gt;Multiplanar reformation - axial, sagittal and coronal view&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;div class=&quot;epigraph&quot;&gt;&lt;blockquote&gt;&lt;p&gt;Multiplanar reformation or reconstruction (MPR) involves the process of converting data from an imaging modality acquired in a certain plane, usually axial, into another plane. It is most commonly performed with thin-slice data from volumetric CT in the axial plane, but it may be accomplished with scanning in any plane and whichever modality capable of cross-sectional imaging, including magnetic resonance imaging (MRI), PET and SPECT.&lt;/p&gt;&lt;footer&gt;Source, &lt;cite&gt;https://radiopaedia.org/articles/multiplanar-reformation-mpr?lang=us&lt;/cite&gt;&lt;/footer&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Windowing&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;level&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dicom_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WindowCenter&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;width&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dicom_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WindowWidth&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ...or set window/level manually to values you want
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vmin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;level&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;vmax&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;level&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hu_pixels&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'gray'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vmin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vmin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vmax&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;vmax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;figure&gt;&lt;figcaption&gt;Without Windowing.&lt;/figcaption&gt;&lt;img src=&quot;/assets/img/pydicom-tutorial/windowing-org.png&quot; /&gt;&lt;/figure&gt;
&lt;figure&gt;&lt;figcaption&gt;With Windowing.&lt;/figcaption&gt;&lt;img src=&quot;/assets/img/pydicom-tutorial/windowing-new.png&quot; /&gt;&lt;/figure&gt;
&lt;figure&gt;&lt;figcaption&gt;Windows for various scans.&lt;/figcaption&gt;&lt;img src=&quot;https://www.stepwards.com/wp-content/uploads/2019/12/Screen-Shot-2019-10-06-at-8.45.17-PM-e1577078248771.jpg&quot; /&gt;&lt;/figure&gt;

&lt;blockquote&gt;
  &lt;p&gt;Brain windows are useful for evaluation of brain hemorrhage, fluid-filled structures including blood vessels and ventricles, and air-filled spaces.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Bone windows are useful for evaluation in the setting of trauma.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://doi.org/10.1118/1.598500&quot;&gt;“Martin J. Murphy. The importance of computed tomography slice thickness in radiographic patient positioning for radiosurgery. “&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.materialise.com/en/faq/what-difference-between-slice-thickness-and-slice-increment#:~:text=Slice%20thickness%20and%20slice%20increment%20are%20central%20concepts%20that%20surround,4%20mm%20in%20the%20illustration&quot;&gt;“What is the difference between slice thickness and slice increment?”&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/topics/medicine-and-dentistry/hounsfield-scale&quot;&gt;“Hounsfield Scale”&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4220362/&quot;&gt;“Usefulness of hounsfield unit and density in the assessment and treatment of urinary stones”&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://radiopaedia.org/articles/multiplanar-reformation-mpr?lang=us&quot;&gt;“Multiplanar reformation (MPR)”. Dr Daniel J Bell and Dr Francis Fortin et al. radiopaedia.org&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Follow me on twitter &lt;a href=&quot;https://twitter.com/theujjwal9&quot;&gt;@theujjwal9&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Thu, 31 Dec 2020 00:00:00 +0530</pubDate>
        <link>/articles/20/pydicom-tutorial</link>
        <guid isPermaLink="true">/articles/20/pydicom-tutorial</guid>
        
        
        <category>blog</category>
        
      </item>
    
  </channel>
</rss>
