当前位置:网站首页>DICOM to NII
DICOM to NII
2022-06-25 20:07:00 【Orange cedar】
import os
import SimpleITK as sitk
def readdcm(filepath):
# Finally, it is found that the input path has Chinese ,SimpleITK.ImageSeriesReader.GetGDCMSeriesFileNames(path) in path Cannot contain Chinese , Otherwise you cannot read .
series_id = sitk.ImageSeriesReader.GetGDCMSeriesIDs(filepath)
series_file_names = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(filepath, series_id[0])
series_reader = sitk.ImageSeriesReader() # Read data port
series_reader.SetFileNames(series_file_names) # Read name
images = series_reader.Execute()# Reading data
return images
dir_list=['./10418184/'+i for i in os.listdir('./10418184')]
for file_path in dir_list:
print(file_path)
dcm_images = readdcm(file_path) # Read the file
# print(file_path.split('/')[-1])
sitk.WriteImage(dcm_images, "./Nii/"+file_path.split('/')[-1]+".nii")# Save as nii
边栏推荐
- A necessary programming assistant for programmers! Smartcoder helps you easily integrate HMS core
- PAT B1096
- 2、 Hikaricp source code analysis of connection acquisition process II
- Impact of Huawei application transfer and application claim on user identification
- 2.6 finding the sum of the first n terms of factorial sequence
- Does redis transaction support acid?
- Redis thread level reentrant distributed lock (different unique IDs can be locked cyclically)
- II Traits (extractors)
- Connect the local browser to the laboratory server through mobaxterm
- 打新债网上开户安全吗,需要注意什么
猜你喜欢
JS asynchronism (I. asynchronous concept, basic use of web worker)
Wechat applet swiper simple local picture display appears large blank
Jsonp non homologous interaction (click trigger)
Automatic fitting when the applet reaches the top
Remember to deploy selenium crawler on the server
Jsonp function encapsulation
Vulnhub range - the planes:venus
Redis core article: the secret that can only be broken quickly
Jsonp processing non homologous
Print 1 cute every 100 milliseconds ~ with a running lantern effect
随机推荐
JQ implements tab switching
Avoid material "minefields"! Play super high conversion rate
4.ypthon function foundation
JS asynchronism (III. usage of generator and async/await)
2.14(Knight Moves)
Pcl+vs2019+opencv environment configuration
Determine whether it is a web page opened on wechat
Does redis transaction support acid?
Database data type design (the most detailed in the whole network)
3、 Hikaricp source code analysis of connection acquisition process III
Is it safe to open a new bond? Is low commission reliable
Redis practice: smart use of data types to achieve 100 million level data statistics
JS mobile phone and computer open different websites
I Space distributor
VMware failed to prompt to lock this profile exclusively
2.6 finding the sum of the first n terms of factorial sequence
PAT B1067
mysql load data infile
Applet multi image to Base64 upload
Remember to deploy selenium crawler on the server