# RawImageGuess module

**URL:** <https://discourse.slicer.org/t/rawimageguess-module/5697>\
**Category:** Support\
**Created:** [February 8, 2019, 5:15pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697 "2019-02-08T17:15:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [February 8, 2019, 5:15pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/1 "2019-02-08T17:15:33Z")

</div>

This project is potentially useful for our user base to facilitate raw image import from microCT scanners without having to create nhdr header to define them. I have tried with a sample data that I have in [https://blogs.uw.edu/maga/2018/09/importing-microct-data-from-scanco-into-slicer/](https://blogs.uw.edu/maga/2018/09/importing-microct-data-from-scanco-into-slicer/)

But encountered some issues. Specifically, I can’t seem to enter a header size bigger than 2500, I can’t type specific values in the image dimension boxes.

Can one of the developers tell me who we can contribute?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 8, 2019, 5:38pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/2 "2019-02-08T17:38:22Z")

</div>

@nagy.attila this one’s for you!

---

<div class="post-metadata">

**Author:** ![nagy.attila](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nagy.attila/32/79295_2.png) [@nagy.attila](https://discourse.slicer.org/u/nagy.attila)\
**Post date:** [February 12, 2019, 11:15am UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/3 "2019-02-12T11:15:20Z")

</div>

Hi all,

sorry for getting a little bit late here 🙂

Actually there are no restrictions in the code, at least none that I explicitly put there. I checked, and really, no data can be entered that is beyond 2500 header and 5000x2500 (X x Y dimensions) - even worse, if I move the slider for Z up to 1567, then Slicer catches an exception, saying Bad Allocation.

Generic Warning: In D:\D\S\Slicer-4101-build\VTK\IO\Image\vtkImageReader2.cxx, line 757  
File operation failed. row = 0, Read = 5000, FilePos = -1

Unable to allocate 19550000000 elements of size 1 bytes.

“Slicer has caught an internal error.\n\nYou may be able to continue from this point, but results are undefined.\n\nSuggested action is to save your work and restart.\n\nIf you have a repeatable sequence of steps that causes this message, please report the issue following instructions available at [http://slicer.org](http://slicer.org)\n\n\nThe message detail is:\n\nException thrown in event: bad allocation”

19550000000 indeed equals 5000 x 2500 x 1564.

This equals around 18GB of data if we take an 8bit pixel color depth, if I calculated correctly.

This part is beyond me, so we still might need someone else to chime in!

As for the header, I will look into this. Also downloading your data right now.

---

<div class="post-metadata">

**Author:** ![nagy.attila](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nagy.attila/32/79295_2.png) [@nagy.attila](https://discourse.slicer.org/u/nagy.attila)\
**Post date:** [February 12, 2019, 12:58pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/4 "2019-02-12T12:58:03Z")

</div>

Okay, too long time passed to edit my previous post

So there were restrictions and they were arbitrary. But not in the code but in the UI file…  
I edited it and checked in the changes into master.  
Also checked in a slightly newer version of the python file.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 12, 2019, 1:17pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/5 "2019-02-12T13:17:15Z")

</div>

Thanks @nagy.attila 👍

The memory allocation error is not unexpected. The machines are finite, so we may as well let people push up to the limits.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [February 12, 2019, 5:26pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/6 "2019-02-12T17:26:55Z")

</div>

Thanks @nagy.attila. I will give a try.  
As for the limits, I think it might be useful to precalculate the datasize as you did above, and give a warning about its consequences.

I think in general, we need a consistent way of resampling the stack without needing to load the entire stack into the Slicer. This will come in handy for datasets from high-resolution mCT as well as microscopy to load into computer with limited resources. @smrolfe started one sometime ago, so there might be some synergy there…

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 19, 2019, 3:56pm UTC](https://discourse.slicer.org/t/rawimageguess-module/5697/7 "2019-12-19T15:56:30Z")

</div>

For posterity. RawImageGuess is now an official extension. See

> [@New extension: RawImageGuess - for loading of images from unrecognized file format](https://discourse.slicer.org/t/new-extension-rawimageguess-for-loading-of-images-from-unrecognized-file-format/9219):
>
> There are proprietary image file formats the 3D Slicer does not recognize and so refuses to load. @nagy.attila in collaboration with Slicer core developers created an extension that can be used to load data from files that use an unknown format. [RawImageGuess extension](https://github.com/acetylsalicyl/SlicerRawImageGuess) offers a number of parameters (image header size, dimensions, pixel type, etc.) that users can adjust and see the resulting image in real-time. This makes it possible to guess the image format in a couple of minutes. See a demo …
