How to make absolute measurements in millimetres simply using ImageJ?

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

How to make absolute measurements in millimetres simply using ImageJ?

njd
I am currently trying to use ImageJ to make absolute measurements in millimetres. My results are calculated as a number of pixels. Could I use a different file type (DICOM/.tiff?) to allow this to be converted to mm?

I am aware that I can use the set scale function, but am wondering whether there is some way for imagej to recognise scale from the file itself rather than the user having to do conversion measurements, which might introduce some error.

I'd be grateful if you could assist with this query.

Thanks,

Niall
Reply | Threaded
Open this post in threaded view
|

Re: How to make absolute measurements in millimetres simply using ImageJ?

Hollebolle
Hi,

maybe this snippet is helpful for You
// get Length (absolute value of the vector) and multiply by
// horizontal and vertical imager pixel spacing (if not isset imager Pixel Spacing try pixelSpacing) 
// of DICOM-Header
 /*
  * Point 1 (C1,R1)
     Point 2 (C2,R2)
     Spacing (Cs,Rs)

    distance (mm) = sqrt( ((C2-C1)*Cs)**2 + ((R2-R1)*Rs)**2 )
*/

double horizontalSpacing = ...;
double verticalSpacing = ...; 

double pixelLength = Math.sqrt(Math.pow(((lineX-distAx)*horizontalSpacing),2)+Math.pow(((lineY-distAy)*verticalSpacing),2));        		        		        		        		        		           		         		
    		
// divide by the zoomfactor
pixelLength = pixelLength/getMagnification();  
    		
// round
int pixelLengthInt = (int) Math.round(pixelLength);
    		
if(horizontalSpacing!=-1 && verticalSpacing!=-1)
    this.lineLength = pixelLengthInt+" mm";
 


njd wrote
I am currently trying to use ImageJ to make absolute measurements in millimetres. My results are calculated as a number of pixels. Could I use a different file type (DICOM/.tiff?) to allow this to be converted to mm?

I am aware that I can use the set scale function, but am wondering whether there is some way for imagej to recognise scale from the file itself rather than the user having to do conversion measurements, which might introduce some error.

I'd be grateful if you could assist with this query.

Thanks,

Niall