ri-imaging / qpformat Goto Github PK
View Code? Open in Web Editor NEWPython library for opening quantitative phase imaging file formats
Home Page: https://qpformat.readthedocs.io
License: MIT License
Python library for opening quantitative phase imaging file formats
Home Page: https://qpformat.readthedocs.io
License: MIT License
SeriesData.identifier
SeriesData.get_identifier
for individual imagesSeriesFolder
images and use in get_identifier
(override SeriesData.get_identifier
This will make the code in https://github.com/RI-imaging/DryMass/blob/master/drymass/converter.py more readable and fix RI-imaging/DryMass#4.
Hello!
I have taken interferometric images with phasics SID4BIO camera using NIKONs NIS-elements software. I have successfully converted the interferometric images into phase and intensity images using MATLAB. I have then stacked the phase and intensity images using python , into a similar format as the PHASICS "SID PHA" format. However, drymass/qpformat can not seem to find my images with the command dm_convert.
This the code i use to convert my data to a TIF-stack:
from skimage import data, io, filters
from skimage.transform import resize
import numpy as np
import tifffile
#Read Intensity and Pahse tif images
inte = io.imread('Intensity.tif')
inte = resize(inte, (800, 864))
print(inte.shape)
print(inte.dtype)
phas = io.imread('Phase.tif')
phas = resize(phas, (800, 864))
print(phas.shape)
print(phas.dtype)
#Normalize with max of image
maxinte= np.max(inte)
maxphas=np.max(phas)
inte=inte/maxinte
phas=phas/maxphas
print('max Intensity :',np.max(inte))
print('max Phase :',np.max(phas))
#Create stack of Intensity and Phase data
stack=np.array([inte,phas,phas])
print(stack.shape)
print(stack.dtype)
#save images, in two formats.
tifffile.imwrite('sensor_data.tif',stack)
tifffile.imwrite('multi-channel_resized.tif', stack,photometric='minisblack', metadata={'axes': 'IYX'})
And this is the error in the anaconda prompt:
(Master) C:\Users\samue\Documents\Master-Thesis\Pyhton\Test\160922-Bild-strack>dm_convert test
DryMass version 0.12.0
Traceback (most recent call last):
File "C:\Users\samue\anaconda3\envs\Master\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\samue\anaconda3\envs\Master\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\samue\anaconda3\envs\Master\Scripts\dm_convert.exe\__main__.py", line 7, in <module>
File "C:\Users\samue\anaconda3\envs\Master\lib\site-packages\drymass\cli\converting.py", line 15, in cli_convert
path_in, path_out = dialog.main(path=path,
File "C:\Users\samue\anaconda3\envs\Master\lib\site-packages\drymass\cli\dialog.py", line 110, in main
ds = qpformat.load_data(path_in)
File "C:\Users\samue\anaconda3\envs\Master\lib\site-packages\qpformat\core.py", line 73, in load_data
fmt = guess_format(path)
File "C:\Users\samue\anaconda3\envs\Master\lib\site-packages\qpformat\core.py", line 13, in guess_format
if fmt.verify(path):
File "C:\Users\samue\anaconda3\envs\Master\lib\site-packages\qpformat\file_formats\fmts_ready\series_phase_phasics_tif_zip.py", line 85, in verify
zf = zipfile.ZipFile(path)
File "C:\Users\samue\anaconda3\envs\Master\lib\zipfile.py", line 1248, in __init__
self.fp = io.open(file, filemode)
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\samue\\Documents\\Master-Thesis\\Pyhton\\Test\\160922-Bild-strack\\test'
Files currently open in e.g. HDFView cannot be opened in qpformat. Catch the OSError correctly and display a verbose error message.
This is a specific problem of the SeriesFolder
file format when the raw data is present together with the phase data tif files.
They could be identified via the TIF tags:
# tf is tifffile.TiffFile object)
In [21]: [(key, tf.pages[0].tags[key].value) for key in dict(tf.pages[0].tags)]
Out[21]:
[(256, 1600),
(257, 1200),
(258, 16),
(259, <COMPRESSION.NONE: 1>),
(262, <PHOTOMETRIC.MINISBLACK: 1>),
(266, <FILLORDER.MSB2LSB: 1>),
(273, (8,)),
(274, <ORIENTATION.TOPLEFT: 1>),
(277, 1),
(278, 1200),
(279, (3840000,)),
(282, (1073741824, 1073741824)),
(283, (1073741824, 1073741824)),
(284, <PLANARCONFIG.CONTIG: 1>),
(296, <RESUNIT.NONE: 1>),
(305, 'National Instruments IMAQ'),
(339, <SAMPLEFORMAT.UINT: 1>)]
``
If you are interested in this format, please respond here.
Possible experimental data for testing:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.