PhotometricMosiac 4.0

John

Your tool is fantastic! I hope it gets included in future releases of PixInsight as standard. I could not have done any of the below without it. It takes little time learning to use it and despite the size of the panels it's handling for me, it always delivers!
Thank you for sharing it!

Roberto

M45 - 2x2
-k0tACYGDRWY_1824x0_kLAwEngG.jpg


Veil Complex - 3x3
OF1-AlB8R4Qs_1824x0_z0-o-ol5.jpg

Hi Roberto
The images you posted are wonderful! Very nicely processed too.

Thanks for your positive feedback - it helps keep me motivated!
I have now finished writing version 3.0, and I am currently testing it. This will be a major update:
  • More accurate photometry
  • A more flexible approach is used to create the gradient models making it much easier to accurately correct the local gradients over the overlapping region but ignore these local effects when correcting the rest of the target frame.
  • The gradient graphs are now much easier to interpret.
  • The 'live' updates are now more responsive. Important for large images.
  • It is now much easier to specify where the join will occur.
I have also tried to make the script easier to use. To achieve this I now have auto settings that are calculated from values read from the FITS header - pixel size and image scale. In most situations, the user now only needs to modify a few settings for great results.

I will post version 3.0 within the next couple of days. My next challenge will be to completely rewrite the help file. The current help file is now quite misleading.

Regards
John Murphy
 
Hi John,

It would be great if we could release the new version of this script with the upcoming version 1.8.8-7 of PixInsight. Either with the official release, or later as an update.

I will post version 3.0 within the next couple of days. My next challenge will be to completely rewrite the help file. The current help file is now quite misleading.

Can you write the documentation in PIDoc format? In this way we could integrate it with our official documentation repositories.
 
Hi John,

It would be great if we could release the new version of this script with the upcoming version 1.8.8-7 of PixInsight. Either with the official release, or later as an update.

Can you write the documentation in PIDoc format? In this way we could integrate it with our official documentation repositories.

Hi Juan

Yes, please include this script (PhotometricMosaic 3.0) in the upcoming version of PixInsight.
And yes, the documentation will be written in the PIDoc format. It will probably take me a couple of weeks to write.

Please also include the helper scripts:
TrimMosaicTile which is used to erode soft or rough edges before running the main script.
SplitMosaicTile which can be used to convert an ad-hoc mosaic into a regular grid (the main script requires that the tiles form a regular grid).

I have spent the day testing the script and believe that it is ready for release. I will post the script on the forum tomorrow, with some basic instructions on how to use it.

Regards
John Murphy
 
Last edited:
PhotometricMosaic 3.0

To install
The following scripts are now included in the official PixInsight release https://pixinsight.com/forum/index.php?threads/pixinsight-1-8-8-7-released.15729/
  • PhotometricMosaic
  • SplitMosaicTile
  • TrimMosaicTile
Run the three scripts in the usual way. For example: SCRIPT -> Mosaic -> PhotometricMosaic

Prerequisites
  • Register the tiles to each other (scripts: 'Image Analysis -> ImageSolver; Utilities -> MosaicByCoordinates). If you process the tiles after MosaicByCoordinates, check that the black background remains at zero. Keep the images linear.
  • Use the script 'Mosaic -> TrimMosaicTile' to remove any ragged or soft edges from the tiles. Do not skip this step - it is vitally important for a seamless result.
  • Apply an STF to the images. The dialogs that display image data use the target and reference image's STF.
Quick Start Guide
  • Display the Photometry Graph and remove any obvious outliers:
1606491034136.png

  • Display the Sample Generation dialog. This displays the overlapping region. Use 'Position (+/-)' to position the join (indicated by the green line). Try to avoid bright stars and, if possible, avoid lower quality regions - for example image corners:
1606491781862.png

  • Press the 'Overlap gradient' button in the 'Overlap region' group box. This shows the gradient that will be used to correct the overlap area. Set the 'Gradient smoothness so that the gradient line follows the data but not the noise. If, as in this case, there is a bright star close to the join, the scattered light will create a peak in the data. If necessary, reduce the smoothness until the curve follows the peak.
1606491994277.png

  • Press the 'Target gradient' button in the 'Target image' group box. This shows the gradient that will be applied to the rest of the target image. Set the 'Gradient smoothness so that the gradient line follows the general trend, but not any local gradients (e.g. scattered light from bright stars). The script automatically rejects samples close to bright stars, which explains why there are no data points between 3600 and 3800. However, the 'wings' of the peak are still visible. We will address that next.
1606492603533.png

  • If, as in this example, more samples need to be rejected for the target image gradient, go back to the 'Sample Generation' dialog and select 'Target model'. The blue line shows the target side of the overlap region. It is important to reject all samples that are close to this line that contain scattered light from bright stars. To increase the blue rejection circle, deselect 'Auto' and then in the 'Target model sample rejection' group box, increase 'Growth limit'. Then, if necessary, increase 'Star growth rate'.
1606492986316.png

Now return to the target gradient graph and adjust the smoothness to follow the gradient trend.
  • You are now ready to press OK to produce the mosaic!
By default, a join mask is also created. Apply this mask to the mosaic to see where the join is. Toggle the mask visibility on / off (ctrl k) to check the quality of the join.

If you are creating a mosaic of more than two tiles, first join the frames into either rows or columns, and then join these strips to create the final mosaic. Try to start with the tile that has the least gradient. The script is designed for planned mosaics that form a regular grid. If your data is an ad-hoc mosaic, use the 'SplitMosaicTile' script to cut up the tiles so that a regular grid of tiles can be created.

Common problems
If the join fails really badly at the end of the join, this indicates that either the reference or target tile had a ragged edge, or the black area around the tiles is not totally black. It needs to be zero.

The script should always be able to produce a seamless join. If you are unable to achieve this, send me a link to two problem tiles (use the .xisf format, specifying XISF Data Block Compression - the black areas compress really well!) and I will provide some help.

Hope you find it useful
John Murphy
 
Last edited:
Hi John,

Congratulations on a really excellent work. Let me some time to 'process' your script to include it in the next 1.8.8-7 release. Very impressive.
 
PhotometricMosaic Version 3.0

See post #24 for an overview of the script

There have been significant changes from version 2.x to 3.0, so even if you have used 2.x before, I would recommend reading the Help sections:
  • Quick Start Guide
  • Tutorial: Sample rejection and gradient graphs
If you are new to PhotometricMosaic, you should also read the sections:
  • Prerequisites
If the mosaic tiles did not join seamlessly, read the section:
  • Common Problems
If you still have trouble, send me a link to two problem tiles (use the .xisf format, specifying XISF Data Block Compression - the black areas compress really well!) and I will provide some help.

I would like to thank members of the Basingstoke Astronomical Society for proof reading the 2.1 help file, and in particular to Dave Boddington for providing me with some useful test data (I needed data from different cameras / telescopes to determine the optimum 'Auto' settings).

John Murphy
 
Last edited:
John
Congratulations on having the script included in the general release of PixInsight and thank you again for all your hard work to get it to the state it is in now.
Best wishes for Christmas and 2021!
Roberto
 
yes i have also run thru a large mosaic example (8 panes Ha) and the results were awesome - no artifacts at all.
 
PhotometricMosaic 3.1 now available!

This includes the features that were not finished in time for the 3.0 release.
The updates include:

Random mosaic mode
The Random mosaic mode has been improved to make it really good at blending a join between two tiles with different signal to noise ratios. The number of target pixels used now tapers from none at the join region's reference edge to 100% at the join region's target edge.
1609604183252.png

The top image shows an Overlay mode join, the bottom shows the improved Random mode join. The join region was set to 200 pixels wide.

Photometric Graph: Best fit line
Provided there are more than 5 photometric stars found, the brightness scale factor now uses the LinearFunction core JavaScript object (introduced in the previous PixInsight version 1-8-8-6) instead of Least Squares Fit. This PixInsight algorithm does a much better job of ignoring outliers, and therefore produces a more accurate and reliable best fit line.

Gradient Graph: improved scaling of single channel plots
When a single color graph (i.e. red, green or blue) is displayed, the vertical graph scale is now recalculated. Previously it used the scale calculated for the RGB display, which did not work well if there were large vertical offsets between the three colors.

TrimMosaicTile:
This can now check for the FITS header entries that PhotometricMosaic needs. If they don't exist, a dialog is displayed that allows the user to add them.

1609605468279.png

1609605521994.png


The script has been attached to post #34

Regards
John Murphy
 
Last edited:
Hi John,

I was flicking through some PI scripts and saw this family of scripts that I had not noticed before. Had a quick google, had a play with some poor data (single Ha panels - i.e. not stacked) I had laying around. It worked great. I am looking forward to playing with it with more data. Thank you for doing this and providing it. Is it advisable to combine colour channels for each panel prior to mosaic formation?
 
Hi John,

I was flicking through some PI scripts and saw this family of scripts that I had not noticed before. Had a quick google, had a play with some poor data (single Ha panels - i.e. not stacked) I had laying around. It worked great. I am looking forward to playing with it with more data. Thank you for doing this and providing it. Is it advisable to combine colour channels for each panel prior to mosaic formation?
I am very pleased you like it!

For a RGB mosaic, it is probably easier to create colour tiles before using PhotometricMosaic, but make sure you use TrimMosaicTile to trim back far enough to fix ragged edges for all colour channels.

For LRGB, it might be worth creating a luminance mosaic and a RGB mosaic, and then combining the two to create the LRGB image.

Regards
John Murphy
 
PhotometricMosaic 3.1
This contains all the changes listed in post #31 and some improvements to the user interface.
  • Dialogs that contain background images now display much quicker.
  • A new checkbox can limit dialog heights to less than 900 pixels
  • The Join position / size now gets its own dialog.
I am currently updating the help file
Regards
John Murphy
 
The update has been delayed a bit - I am adding a few extra features. In particular, the TrimMosaicTile is getting a bit of a make over. It now provides a real time preview which makes accurately removing ragged edges much easier and quicker:

1611140689792.png


I have also updated the script so that it can be used with ImageContainer. This allows multiple files or views to be edited at once.
Regards
John Murphy
 
John, this is wonderful work... thank you for it. I used these tools extensively assembling a four-frame, four-filter, 218MP mosaic of the Orion region:


My one wish is to have a "feather" mode in addition to average, random, etc. I hacked the code a bit to do this and it works very nicely. Essentially it just weights the reference and target samples by x and 1-x across the join region.

Allowing the join region to be larger that 250 pixels across would also be nice. With some recent high-MP cameras, even a 5% overlap between frames can give a ~500-pixel overlap.

Best,

Russ
 
John, this is wonderful work... thank you for it. I used these tools extensively assembling a four-frame, four-filter, 218MP mosaic of the Orion region:


My one wish is to have a "feather" mode in addition to average, random, etc. I hacked the code a bit to do this and it works very nicely. Essentially it just weights the reference and target samples by x and 1-x across the join region.

Allowing the join region to be larger that 250 pixels across would also be nice. With some recent high-MP cameras, even a 5% overlap between frames can give a ~500-pixel overlap.

Best,

Russ
Hi Russ, you have produced a wonderful image! Very impressive, especially when zoomed in :)
I fully agree about the need for a feather mode, and It's already on its way! See post #31.

I chose to implement it with the 'Random' mode. In theory this should be slightly better than a feathered 'Average' mode because the 'Average' mode will produce a higher signal to noise ratio at the center of the region, which might be noticeable. In practice I suspect that either mode would do the job. I also wanted to keep the unfeathered 'Average' mode for those that wanted maximum signal to noise ratio and did not mind that this reveals the joins.

The new version also has no limit on the size of the join region - the slider's maximum range automatically adjusts to the size of the overlap region.

There are quite a lot of other improvements in this release too. As well as all those listed in post #31 and #36, I now have:

(1) A new 'Target' combine mode. This corrects the target to the reference image, but does not create a mosaic.
1611744665548.png

This is used when you have a wide field (linear) image of the area, and a high res mosaic of the same area. By use the wide field as the reference frame, any complex gradients can be removed from the high res tiles. These corrected target images can then be mosaiced together as usual. This is particularly useful for unfiltered or wide band images - for example a mosaic of the Andromeda galaxy.

(2) The ability to add manual rejection circles:
1611745216133.png

The star detection can miss some stars - for example very bright saturated stars, or stars too close to the image edge. In these cases it is now possible to add a manual rejection circle. When an added circle is selected, it shows both the overlap model and target model rejection circles so both can be edited at the same time. The selected circle is shown in green to make it stand out from the other rejection circles.

(3) Some performance enhancements that make the dialogs more responsive.

All these additions have held up the next release, but I hope it will be worth the wait. The code is almost finished, but I still need to update the help file and the tooltips.

Regards
John Murphy
 
Last edited:
Hi Russ, you have produced a wonderful image! Very impressive, especially when zoomed in :)
I fully agree about the need for a feather mode, and It's already on its way! See post #31.

I chose to implement it with the 'Random' mode. In theory this should be slightly better than a feathered 'Average' mode because the 'Average' mode will produce a higher signal to noise ratio at the center of the region, which might be noticeable. In practice I suspect that either mode would do the job. I also wanted to keep the unfeathered 'Average' mode for those that wanted maximum signal to noise ratio and did not mind that this reveals the joins.

The new version also has no limit on the size of the join region - the slider's maximum range automatically adjusts to the size of the overlap region.

There are quite a lot of other improvements in this release too. As well as all those listed in post #31 and #36, I now have:

(1) A new 'Target' combine mode. This corrects the target to the reference image, but does not create a mosaic.
View attachment 10137
This is used when you have a wide field (linear) image of the area, and a high res mosaic of the same area. By use the wide field as the reference frame, any complex gradients can be removed from the high res tiles. These corrected target images can then be mosaiced together as usual. This is particularly useful for unfiltered or wide band images - for example a mosaic of the Andromeda galaxy.

(2) The ability to add manual rejection circles:
View attachment 10138
The star detection can miss some stars - for example very bright saturated stars, or stars too close to the image edge. In these cases it is now possible to add a manual rejection circle. When an added circle is selected, it shows both the overlap model and target model rejection circles so both can be edited at the same time. The selected circle is shown in green to make it stand out from the other rejection circles.

(3) Some performance enhancements that make the dialogs more responsive.

All these additions have held up the next release, but I hope it will be worth the wait. The code is almost finished, but I still need to update the help file and the tooltips.

Regards
John Murphy

For those that are interested in trying out the new version, I have attached PhotometricMosaic version 3.2
I am currently updating the help files. Once these are finished I will be submitting the update to the PixInsight platform.

Regards, John Murphy
 
Back
Top