span>
<span id="cb6-13"><a href="#cb6-13" tabindex="-1"></a>idx <span class="ot">&lt;-</span> <span class="fu">grid_to_index</span>(img, <span class="fu">matrix</span>(voxel_coords, <span class="at">nrow =</span> <span class="dv">1</span>))</span>
<span id="cb6-14"><a href="#cb6-14" tabindex="-1"></a><span class="fu">cat</span>(<span class="st">&quot;Voxel&quot;</span>, voxel_coords, <span class="st">&quot;-&gt; Linear index&quot;</span>, idx, <span class="st">&quot;</span><span class="sc">\n</span><span cl