当前位置:网站首页>Simpleitk use - 4 Strange question
Simpleitk use - 4 Strange question
2022-07-02 22:33:00 【Ton ton don't fight wild】
List of articles
1. data dtype Type problem
1.1 Determine the cause
Phenomenon description
- windows Next use numpy Handle Nifti Image and save ,
- The resulting image is 49KB
- ITK-Snap Can open
- linux Use the same code under numpy Handle Nifti Image and save
- When getting the image 85KB
- ITK-Snap Open error report :
itk::ERROR: NiftiImageIO(000001CB27E1CD80): Unknown component type: 0
- however 3D Slicer Can open
Find out why
- Because the code is the same , Tested and saved numpy The data are the same , But the final file size is different .
- So consider data types ,dtype The problem of
experiment
Because one sentence in the code is :
skull_striper_array = np.where(pred_label_array - skull_mask_array == 1, 1, 0)
So check the data types one by one , Find out
pred_label_array.dtype
> dtype('uint8')
skull_mask_array.dtype
> dtype('uint8')
skull_striper_array.dtype
> dtype('int64')
Therefore, the consideration is due to numpy Constants are introduced in , Cause the data type to change .
skull_mask_path = "./skull_striper_mask.nii.gz"
skull_mask_image = sitk.ReadImage(skull_mask_path)
print(skull_mask_image.GetPixelIDTypeAsString())
> 64-bit signed integer
see linux The data type of the next image , Is, indeed, int64, To int32 after ,itk-snap You can open the processed image .
Consider different environments numpy Default data type for constants
- linux In the environment :numpy-1.19.2、simpleitk-2.1.1.2
test =np.array([1]) test.dtype > dtype('int64')
- windows Environmental Science :numpy-1.19.2、simpleitk-2.1.1.2
test =np.array([1]) test.dtype > dtype('int32')
1.2 numpy The default dtype type
stay numpy file -Data types in , There are the following descriptions :
NumPy Provide numpy.iinfo
and numpy.finfo
To confirm Numpy The maximum value of integers and floating-point numbers in .
np.iinfo(int) # Bounds of the default integer on this system.
iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
np.iinfo(np.int32) # Bounds of a 32-bit integer
iinfo(min=-2147483648, max=2147483647, dtype=int32)
np.iinfo(np.int64) # Bounds of a 64-bit integer
iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
So test on your own machine :
- windows On :
- linux On :
- So you know , When I use the following code , After importing an integer
skull_striper_array = np.where(pred_label_array - skull_mask_array == 1, 1, 0)
- windows The default integer (int) yes int32 position , and linux The default integer (int) yes int64 position
StackOverflow There is a similar problem on , See Specifying default dtype for np.array(1.)
1.3 itk-snap open int64 The problem of format
The phenomenon is described above :
- 64 Bit image use ITK-Snap Open error report :
itk::ERROR: NiftiImageIO(000001CB27E1CD80): Unknown component type: 0
- however 3D Slicer Can open
So consider whether ITK-Snap I won't support it int64 Bitwise image . No valid relevant content has been found for the time being .
TBD
边栏推荐
- Official announcement! The golden decade of new programmers and developers was officially released
- [QT] QT multithreading development - reentrancy and thread safety
- 【微服务|Sentinel】重写sentinel的接口BlockExceptionHandler
- [Jianzhi offer] 56 - ii Number of occurrences of numbers in the array II
- Technological Entrepreneurship: failure is not success, but reflection is
- Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation
- Introduction to victoriametrics
- scrcpy这款软件解决了和同事分享手机屏幕的问题| 社区征文
- Error in PIP installation WHL file: error: is not a supported wheel on this platform
- Attack and defense world PWN question: Echo
猜你喜欢
Technical solution of vision and manipulator calibration system
C语言,实现三子棋小游戏
Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale
pip安裝whl文件報錯:ERROR: ... is not a supported wheel on this platform
Daily book CSO advanced road first exposed
LightGBM原理及天文数据中的应用
Kubernetes resource object introduction and common commands (4)
[staff] Sibelius 7.5.1 score software installation (software download | software installation)
Oriental Aesthetics and software design
基于ASP.net的手机销售管理系统(二手手机销售管理系统)+ASP.NET+C#语言+VS2010+数据库可以用于课设、毕设学习
随机推荐
Market Research - current situation and future development trend of cell-based seafood market
Based on asp Net (used mobile phone sales management system) +asp Net+c # language +vs2010+ database can be used for course design and post design learning
Basic concepts of image and deep understanding of yuv/rgb
Unity发布WebGL播放声音的一种方法
Market Research - current market situation and future development trend of genome editing mutation detection kit
Service visibility and observability
Daily book - low code you must understand in the era of digital transformation
SimpleITK使用——4. 奇怪的问题
Socket套接字C/S端流程
Market Research - current situation and future development trend of carob chocolate market
记录一下微信、QQ、微博分享web网页功能
How to center the positioned text horizontally and vertically
[leetcode] sword finger offer 11 Rotate the minimum number of the array
Record the functions of sharing web pages on wechat, QQ and Weibo
情感计算与理解研究发展概述
Hanoi Tower problem
腾讯三面:进程写文件过程中,进程崩溃了,文件数据会丢吗?
Try to get property'num for PHP database data reading_ rows' of non-object?
Pointer array parameter passing, pointer parameter passing
Oriental Aesthetics and software design