pixel size is slightly different when .dcm is saved as .tif

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

pixel size is slightly different when .dcm is saved as .tif

Schebique
Dear ImageJ developers.

I found slightly different results when measuring dicom images and their
respective .tif form. Let say .dcom is calibrated as 0.139999000 mm/pixel.
I save it as .tif and it is still this value. But after reopen this .tif
file pixel size is interpreted as 0.139999003, which leads to a slightly
different results in e.g. Area measurements.

In fact, it is not very important for my results, but I would like to know
where this inconsistency is coming from? If it is the bug or it is some
kind of number conversion error?

Here is the table you get by running macro on sample images
<https://drive.google.com/open?id=0BxY9MV1ofnZCdDljMGJheFE3ZWc>:

Label pixelSize Area
Mik437_Fe_dx0735.dcm 0.139999000 2620.913757974
Mik437_Fe_dx0735.tif 0.139999000 2620.913757974
Mik437_Fe_dx0735-reopen.tif 0.139999003 2620.913878054
Mik441_Fe_dx0751.dcm 0.100002000 1483.049660400
Mik441_Fe_dx0751.tif 0.100002000 1483.049660400
Mik441_Fe_dx0751-reopen.tif 0.100002000 1483.049660993
Macro:
image="Mik437_Fe_dx0735.dcm"; //"bad" image
//image="Mik441_Fe_dx0751.dcm"; //"good" image
run("Set Measurements...", "display redirect=None decimal=9");
path=getDirectory("choose folder with example images");
open(path+image);
title=replace(getTitle(), ".dcm", "");
measure();
saveAs("Tiff", path+title+".tif");
measure();
run("Revert"); //reopen last saved tif
newTitle=title+"-reopen.tif";
rename(newTitle);
measure();
close();

function measure() {
title=getTitle();
getVoxelSize(gVwidth, height, depth, unit);
getStatistics(Area);
n=nResults;
setResult("Label", n, title);
setResult("pixelSize", n, gVwidth);
setResult("Area", n, Area);

----------------------------------------
I would appreciate any hints.

Have a nice day.
Schebique

--
Mgr. Ondřej Šebesta
Laboratory of Confocal and Fluorescence Microscopy
Faculty of Science, Charles University in Prague
Vinicna 7
128 44 Prague
Czech Republic

Phone: +420 2 2195 1061
e-mail: [hidden email]

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: pixel size is slightly different when .dcm is saved as .tif

Herbie
Good day Schebique,

I fear you are reaching the limit of the number representation...

Of course this limit isn't absolute but without changing the Java code,
you have to accept it.

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 27.10.16 um 13:09 schrieb Ondřej Šebesta:

> Dear ImageJ developers.
>
> I found slightly different results when measuring dicom images and their
> respective .tif form. Let say .dcom is calibrated as 0.139999000 mm/pixel.
> I save it as .tif and it is still this value. But after reopen this .tif
> file pixel size is interpreted as 0.139999003, which leads to a slightly
> different results in e.g. Area measurements.
>
> In fact, it is not very important for my results, but I would like to know
> where this inconsistency is coming from? If it is the bug or it is some
> kind of number conversion error?
>
> Here is the table you get by running macro on sample images
> <https://drive.google.com/open?id=0BxY9MV1ofnZCdDljMGJheFE3ZWc>:
>
> Label pixelSize Area
> Mik437_Fe_dx0735.dcm 0.139999000 2620.913757974
> Mik437_Fe_dx0735.tif 0.139999000 2620.913757974
> Mik437_Fe_dx0735-reopen.tif 0.139999003 2620.913878054
> Mik441_Fe_dx0751.dcm 0.100002000 1483.049660400
> Mik441_Fe_dx0751.tif 0.100002000 1483.049660400
> Mik441_Fe_dx0751-reopen.tif 0.100002000 1483.049660993
> Macro:
> image="Mik437_Fe_dx0735.dcm"; //"bad" image
> //image="Mik441_Fe_dx0751.dcm"; //"good" image
> run("Set Measurements...", "display redirect=None decimal=9");
> path=getDirectory("choose folder with example images");
> open(path+image);
> title=replace(getTitle(), ".dcm", "");
> measure();
> saveAs("Tiff", path+title+".tif");
> measure();
> run("Revert"); //reopen last saved tif
> newTitle=title+"-reopen.tif";
> rename(newTitle);
> measure();
> close();
>
> function measure() {
> title=getTitle();
> getVoxelSize(gVwidth, height, depth, unit);
> getStatistics(Area);
> n=nResults;
> setResult("Label", n, title);
> setResult("pixelSize", n, gVwidth);
> setResult("Area", n, Area);
>
> ----------------------------------------
> I would appreciate any hints.
>
> Have a nice day.
> Schebique
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: pixel size is slightly different when .dcm is saved as .tif

Cammer, Michael
1.  Does changing the units to um or nm fix the problem?
2.  Are any of these decimal places significant anyhow?  This is out in the angstrom range.  

=========================================================================
 Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
         Cell:  914-309-3270     Office: Skirball 2nd Floor main office, back right
            http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Herbie
Sent: Thursday, October 27, 2016 8:26 AM
To: [hidden email]
Subject: Re: pixel size is slightly different when .dcm is saved as .tif

Good day Schebique,

I fear you are reaching the limit of the number representation...

Of course this limit isn't absolute but without changing the Java code, you have to accept it.

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 27.10.16 um 13:09 schrieb Ondřej Šebesta:

> Dear ImageJ developers.
>
> I found slightly different results when measuring dicom images and
> their respective .tif form. Let say .dcom is calibrated as 0.139999000 mm/pixel.
> I save it as .tif and it is still this value. But after reopen this
> .tif file pixel size is interpreted as 0.139999003, which leads to a
> slightly different results in e.g. Area measurements.
>
> In fact, it is not very important for my results, but I would like to
> know where this inconsistency is coming from? If it is the bug or it
> is some kind of number conversion error?
>
> Here is the table you get by running macro on sample images
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_open-3Fid-3D0BxY9MV1ofnZCdDljMGJheFE3ZWc&d=DQIDaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=1956Dpgo0yCBsxu01cWYmVT7QnMxicxOqg9lu1WAIiM&s=9ikBU0SOzve1eOwtPgpYIHBZMgBjn52ojn7vzt_prek&e= >:
>
> Label pixelSize Area
> Mik437_Fe_dx0735.dcm 0.139999000 2620.913757974 Mik437_Fe_dx0735.tif
> 0.139999000 2620.913757974 Mik437_Fe_dx0735-reopen.tif 0.139999003
> 2620.913878054 Mik441_Fe_dx0751.dcm 0.100002000 1483.049660400
> Mik441_Fe_dx0751.tif 0.100002000 1483.049660400
> Mik441_Fe_dx0751-reopen.tif 0.100002000 1483.049660993
> Macro:
> image="Mik437_Fe_dx0735.dcm"; //"bad" image
> //image="Mik441_Fe_dx0751.dcm"; //"good" image run("Set
> Measurements...", "display redirect=None decimal=9");
> path=getDirectory("choose folder with example images");
> open(path+image); title=replace(getTitle(), ".dcm", ""); measure();
> saveAs("Tiff", path+title+".tif"); measure(); run("Revert"); //reopen
> last saved tif newTitle=title+"-reopen.tif"; rename(newTitle);
> measure(); close();
>
> function measure() {
> title=getTitle();
> getVoxelSize(gVwidth, height, depth, unit); getStatistics(Area);
> n=nResults; setResult("Label", n, title); setResult("pixelSize", n,
> gVwidth); setResult("Area", n, Area);
>
> ----------------------------------------
> I would appreciate any hints.
>
> Have a nice day.
> Schebique
>

--
ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DQIDaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=1956Dpgo0yCBsxu01cWYmVT7QnMxicxOqg9lu1WAIiM&s=YjXa7CCgTZ_lSOmcTWY86hQcLIYMQSA4HFNydQFifDE&e= 

------------------------------------------------------------
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
=================================


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html