当前位置:网站首页>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
边栏推荐
- 《乔布斯传》英文原著重点词汇笔记(十一)【 chapter nine】
- PHP微信抢红包的算法
- 加了定位的文字如何水平垂直居中
- LandingSite eBand B1冒烟测试用例
- 攻防世界pwn题:Recho
- 技术人创业:失败不是成功,但反思是
- Error in PIP installation WHL file: error: is not a supported wheel on this platform
- [C question set] of V
- Basic concepts of image and deep understanding of yuv/rgb
- [QT] QT multithreading development - four methods to realize multithreading design
猜你喜欢
[shutter] shutter gesture interaction (small ball following the movement of fingers)
pip安裝whl文件報錯:ERROR: ... is not a supported wheel on this platform
An overview of the development of affective computing and understanding research
Evolution of messaging and streaming systems under the native tide of open source cloud
Ransack combined condition search implementation
What is it that makes you tremble? Those without fans can learn
Error in PIP installation WHL file: error: is not a supported wheel on this platform
How to write a good program when a big book speaks every day?
[shutter] shutter application theme (themedata | dynamic modification theme)
Secondary development of ANSYS APDL: post processing uses command flow to analyze the result file
随机推荐
[shutter] shutter application theme (themedata | dynamic modification theme)
Kubernetes resource object introduction and common commands (4)
LandingSite eBand B1冒烟测试用例
phpcms实现订单直接支付宝支付功能
Bridge emqx cloud data to AWS IOT through the public network
【leetcode】1380. Lucky number in matrix
Secondary development of ANSYS APDL: post processing uses command flow to analyze the result file
Market Research - current market situation and future development trend of third-party data platform
How to write a good program when a big book speaks every day?
在beforeDestroy中销毁localStorage中的值无效
U++ 学习笔记 ----松弛
ServiceMesh主要解决的三大痛點
Leetcode theme [array] -169- most elements
《乔布斯传》英文原著重点词汇笔记(十)【 chapter eight】
Promise optimized callback hell
PHP微信抢红包的算法
[C question set] of V
Une semaine de vie
#include<>和#include“”的区别
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!