I have a tiff image stack in uint16 datatype and I’d like to convert this to uint8 datatype. I’m not sure how to do this in Fiji.

I have loaded the stack in Fiji and I tried to change the datatype while exporting. But I couldn’t find any tab in Fiji export options for specifying the datatype.

Suggestions on how to do this in Fiji or alternatively in Python/MATLAB will be really helpful.

解决方案

The im2uint8() function can be used to convert the image from uint16 (unsigned integer 16) to uint8 (unsigned integer 8) in MATLAB.

For .tiff Files with a Single Image :

Image = imread("Test_Image.tiff");

Image = im2uint8(Image);

imshow(Image);

For .tiff Files with Multiple Images and Saving Transformed/Converted Images:

Reading the images in a loop using the imread() function with second argument being the Image_Index corresponding to the image number within the .tiff image collection can be used to grab the entire image data stored in the file. Using imwrite() in append and WriteMode will allow each converted image to be saved into one file named in this example as Converted_Image.tiff.

%Multiple image tiff conversion%

File_Name = "Test_Image.tiff";

Image_Data = imfinfo(File_Name);

Number_Of_Images = length(Image_Data);

Tiff_Structure = struct('Image_File',[]);

for Image_Index = 1: Number_Of_Images

Image = imread(File_Name,Image_Index);

Uint8_Image = im2uint8(Image);

%For more information and plotting individual images%

Tiff_Structure(Image_Index).Image_File = Uint8_Image;

%Saving the converted images to one tiff file%

imwrite(Uint8_Image,'Converted_Image.tiff','WriteMode','append');

end

Using MATLAB version: R2019b

python参数类型为uint8,将图像数据类型从uint16转换为uint8相关推荐

  1. 对Python参数类型详解以及学习中遇到的坑

    由于之前遇到过几次有关于参数类型的坑,以及经常容易把一些参数类型搞混淆,现在做一下有关参数类型的总结记录以及对之前踩坑经历的分析. 参数类型 首先我们列举一下有关于Python的参数类型,以及实际上的 ...

  2. python变量类型之间转换_Python常用数据类型之间的转换总结

    函数 描述 int(x [,base]) 将x转换为一个整数 long(x [,base] ) 将x转换为一个长整数 float(x) 将x转换到一个浮点数 complex(real [,imag]) ...

  3. python变量类型之间转换_【Python】Python 变量类型(变量赋值,数据类型,数据转换)...

    目录 Python 变量类型 变量存储在内存中的值.这就意味着在创建变量时会在内存中开辟一个空间.基于变量的数据类型,解释器会分配指定内存,并决定什么数据可以被存储在内存中.因此,变量可以指定不同的数 ...

  4. python参数类型定义_Python的参数类型

    参数类型: 1.必填参数,位置参数(positional arguments,官方定义,就是其他语言所说的参数) 2.默认值参数,非必传 3.可变参数,非必传,不限制参数个数,比如说给多个人发邮件,发 ...

  5. python参数类型限定_python限定方法参数类型、返回值类型、变量类型等|python3教程|python入门|python教程...

    https://www.xin3721.com/eschool/python.html typing模块的作用 自python3.5开始,PEP484为python引入了类型注解(type hints ...

  6. python参数类型_Python 参数类型和参数匹配模型

    Python 方法的参数种类有很多,而不是通常语言定义的那样, Python 方法的传参能力要比想象的强大很多.很多初学者可能对一些库中带 * 带 ** 的参数类型非常奇怪,但是其实这些语法正是保证 ...

  7. python变量类型怎么决定的_Python数据类型提示痛点的解决方案探讨

    几个月前,你写了一段Python代码,当时只有你和上帝能看懂.几个月后,这段代码就只有上帝能看懂了. 痛点是什么 Python是一门弱类型的动态语言,在看其他人写的一些Python项目的代码.特别是大 ...

  8. python整数类型进制表示_Python数据类型--整型

    介绍: 在Python2.x中,整型使用符号整数类型(int)和长整数类型(long)来表示,是正或负整数,不带小数点. 符号整数类型(int)的字符长度是有限制的,在32位操作系统上,整数的位数为3 ...

  9. python参数类型检查_Python中的类型检查

    本文中所有代码均运行在Python 2.7上 为什么要进行类型检查? 总所周知,Python是一门典型的动态语言,在变量定义.使用的过程中遵循duck typing,当对某一变量进行操作时才去检查它是 ...

  10. python 参数类型的多态_【Python】面向对象:类与对象\封装\继承\多态

    六.Python面向对象--类与对象\封装\继承\多态 1.什么是面向对象编程 1.1 程序设计的范式:程序可控,易于理解 1.2 抽象并建立对象模型 1.3 程序是不同对象相互调用的逻辑.每个对象在 ...

最新文章

  1. linux apache配置目录大小写,linux apache 配置URL地址栏大小写不敏感配置
  2. (0025)iOS 开发之Xcode常用快捷键
  3. Asp.net 面向接口框架之应用程序上下文作用域组件
  4. oracle 修改sgamaxsize_oracle初始化内存配置参数(sga,pga,sharepool)
  5. @async 如何返回list_图解 Await 和 Async
  6. P1678 烦恼的高考志愿
  7. 谷歌更新TensorFlow目标检测API
  8. openflow和open vSwitch简介
  9. docker 中 安装 openssh-server
  10. 计算机和信息系统安全保密管理规定,图文信息中心 计算机信息系统安全保密管理规定...
  11. 【路在前端】我的前端工作流程梳理
  12. RCTF-2015-x_xor_md5
  13. OSChina 周二乱弹 ——假装在睡觉等你搭讪等一路
  14. Histromap of World History: The rise and fall of peoples and notions for 4000 years
  15. 芯片对蓝牙耳机影响有多大?南卡N2s发布,搭载高通3040芯片
  16. 机器学习的前世今生:一段波澜壮阔的历史
  17. 使用Dreamweaver创建一个PHP程序
  18. 每天听的一首歌---奔跑
  19. 四相八拍步进c语言程序,四相八拍的步进电机简单的驱动
  20. 【SLAM文献】2017-2018 CVPR ICCV ECCV 相机位姿估计、视觉定位、SLAM相关论文综述

热门文章

  1. 如何用python计算增长率_如何用excel函数来计算增长率?
  2. python从网页提取文本_使用Python进行网页正文提取
  3. 安装Ubuntu后必须要做的几件事(一)--基础应用篇
  4. 前端时尚好用的图标项目-Font Awesome
  5. SSL基础:5:openssl常用选项说明
  6. 单击选定单元格后输入新内容_excel表格,要双击选定后才能输入,单击不能输入为什么...
  7. Windows10系统常用快捷键汇总
  8. python usb摄像头 截图_python实现摄像头远程截图功能
  9. 土方回填施工方案范本_土方回填施工方案范例(模板)
  10. 重邮第八届ACM大赛-决赛题解报告