Yes Jeff,

meanwhile I did a more thorough investigation using the two sample slices provided by the OP.

It turns out that e.g. binarization or smoothing of the slice images has little to no effect on the shift parameters. Here are the shifts in pixels that I get when starting with 512x512 stacks:
                X       Y
original:       18      88
gauss r=8:      16      88
binarized:      17      87

Consequently, there appears to be no need for pre-processing the slice images.

An ImageJ-macro that processes whole stacks is only about 20 code lines long and runs really fast, even for 1024x1024 slice images.

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 08.08.25 um 05:28 schrieb Jeff Stokes:
Herbie,

    Looks like it worked pretty well, from the images you sent.

Jeff


-----Original Message-----
From: Gluender <[email protected]>
Sent: Thursday, August 7, 2025 1:02 AM
To: [email protected]
Subject: Re: Registering objects to a rectangular area

Greetings Jeff!

"cross-correlate two frames"

That's exactly what I did to obtain the result shown in my earlier reply.

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::
Am 07.08.25 um 02:22 schrieb Jeff Stokes:
Prof. Al-Hinnawi,

     It looks like you're trying to register multiple frames containing a 
fairly noisy feature, in order to produce a lower-noise final image. The 
obvious thought is to cross-correlate two frames of find the appropriate x-y 
shift needed to add them together. You have to be mindful of the edges of the 
frames; it's best if the feature is well surrounded by zeros or a constant 
value. (When I've done this, I pad the frame with zeros out to image size 3+ 
times the maximum width of the feature.) Given the very noisy nature of each 
individual image, the cross correlation might not indicate the true shift 
needed accurately enough. Perhaps smoothing (low-pass filter) each frame first 
before performing the autocorrelations will yield more nearly correct shifts. 
Then add the unfiltered frames together using the shifts thus determined. These 
processes are all mathematical, i.e. can be done automatically with code.  If 
they can't be done in ImageJ or ImageJ macros, they are easily done in Matlab, 
with the final images saved for viewing with ImageJ.

     As Michael suggests below, tabulating the center of the object in each 
slice is promising. It may be that the mathematical centroid of the object in 
the image will give you its 'position' as well or better than a manual method 
and of course will be faster. Again, if not ImageJ, then Matlab, Python, etc.
     I don't claim my ideas above are better than or as good as the 
registration tools Michael pointed you to below. (I have not explored them.)
     Best of luck.
Jeff Stokes
San Diego, USA


-----Original Message-----
From: Cammer, Michael <[email protected]>
Sent: Wednesday, August 6, 2025 1:48 PM
To: [email protected]
Subject: Re: Registering objects to a rectangular area

If you are willing to click on the center of the object of interest in each of 
the 400 slices, then it is simple to write a macro that with each click, the XY 
coordinates are saved and the macro progresses to the next slice automatically, 
and at the end all images are repositioned to center on the XY locations.

Or you could try one of the registration tools such as 
https://bigwww.epfl.ch/thevenaz/stackreg/

Cheers-


Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone 
Health, 540 First Avenue, New York, NY  10016
Office: RB (formerly Skirball) 4-102  -- call if door is locked (phone near 
elevators)
Office: 646-501-0567 Cell (voice only, not text): 914-309-3270  
[email protected] <mailto:[email protected]>  
http://nyulmc.org/micros  http://microscopynotes.com/ Scheduling the time you want is 
far more reliable by phone call.  Why not provide your phone number?


-----Original Message-----
From: AR.M. AlHinnawi <[email protected] <mailto:[email protected]> 
>
Sent: Wednesday, August 6, 2025 3:24 PM
To: [email protected] <mailto:[email protected]>
Subject: Registering objects to a rectangular area

[EXTERNAL]

Dear ImageJ

I have a stack of 400 images. They all show the same objects but at different 
settings, resulting in irregular displacements.

The interested objects can be confined in a rectangular area in the first slice 
(a rectangular area that can be drawn manually).

I aim to make similar objects in all remaining slices to fit in the rectangle. 
For example, I attached the first and last slice.

It doesn't seem easy.

Please, can you advise?

Thank you

*Abdel-Razzak Al-Hinnawi, (Full Prof.)  (B.Sc., M.Sc., Ph.D. Medical Imaging  Sciences 
& Digital Image Processing & Biomedical Engineering)* *Faculty of Allied 
Medical Sciences* *ISRA University* *11622, Amman, **JORDAN*
*phone: +962 780515199*
*e-mail:   [email protected] <mailto:[email protected]>  
<[email protected] <mailto:[email protected]> >
   [email protected] <mailto:[email protected]>  
<[email protected] <mailto:[email protected]> >*

--
ImageJ mailing list: 
https://urldefense.com/v3/__http://imagej.nih.gov/ij/list.html__;!!MXfaZl3l!em9oCMotdAaa5j-SbsTMB-ZWu34WIAd_fy6C67JpL9IgdWpDzuwUu-MP7Yr2sNczfZBafYBV6blHF0a6lRQew8i9qjp6B_U$

------------------------------------------------------------
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

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



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

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



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

Reply via email to