How to create Local Normalization (.xnml) files from a script?

Hi John,

This is doable, although a bit complex in JavaScript. XNML is an XML-based format, so even if we (still) have no XML support in our JavaScript runtime, that is not a practical problem because you are only interested in generating these files, not in decoding or interpreting them, so this is just a matter of writing a plain text file.

The actual problem is generating the matrices of large-scale local normalization functions. These matrices are actually smooth and small images, which you can generate by interpolation of the normalization data, as our LocalNormalization tool does.

All of these tasks are completely automated in our PCL development framework. If you can read C++, take a look at the PCL implementation:


and also at our LocalNormalization tool:


If you describe the way you are doing and designing your implementation, maybe I can help you with this.

As a side note, have you considered the possibility of working with PCL/C++ instead of PJSR?
 
Hi John,

This is doable, although a bit complex in JavaScript. XNML is an XML-based format, so even if we (still) have no XML support in our JavaScript runtime, that is not a practical problem because you are only interested in generating these files, not in decoding or interpreting them, so this is just a matter of writing a plain text file.

The actual problem is generating the matrices of large-scale local normalization functions. These matrices are actually smooth and small images, which you can generate by interpolation of the normalization data, as our LocalNormalization tool does.

All of these tasks are completely automated in our PCL development framework. If you can read C++, take a look at the PCL implementation:


and also at our LocalNormalization tool:


If you describe the way you are doing and designing your implementation, maybe I can help you with this.

As a side note, have you considered the possibility of working with PCL/C++ instead of PJSR?
Hi Juan
Yes, I really should have a go at PCL/C++ in the future. The main problem is getting over the initial hurdle of creating a trivial C++ module, compiled and linked into PixInsight. It may well be a great deal easier than I fear! It would also be useful for me to get back up to speed with C++. It is over 20 years since I last used it. I still remember the concepts, but I will need to investigate how things have moved on - decide on a good IDE for C++ (Windows 10), and learn 'newer' concepts like auto pointers (I really am out of date!)

The XNML was for a script I am developing, NormalizeScaleGradient (an alternative to Local Normalization). It has turned out to be much harder to produce the results I am after than I expected. Not least because the normalization routines that already exist in PixInsight are extremely good at what they do. I am not satisfied with my first attempt, but I am not giving up yet.

At least for the time being I will not attempt to add XNML. I have other more important issues to solve.
Thanks for your help
John Murphy
 
Hi Juan
Yes, I really should have a go at PCL/C++ in the future. The main problem is getting over the initial hurdle of creating a trivial C++ module, compiled and linked into PixInsight. It may well be a great deal easier than I fear! It would also be useful for me to get back up to speed with C++. It is over 20 years since I last used it. I still remember the concepts, but I will need to investigate how things have moved on - decide on a good IDE for C++ (Windows 10), and learn 'newer' concepts like auto pointers (I really am out of date!)

The XNML was for a script I am developing, NormalizeScaleGradient (an alternative to Local Normalization). It has turned out to be much harder to produce the results I am after than I expected. Not least because the normalization routines that already exist in PixInsight are extremely good at what they do. I am not satisfied with my first attempt, but I am not giving up yet.

At least for the time being I will not attempt to add XNML. I have other more important issues to solve.
Thanks for your help
John Murphy

Not wanting to start a language war, but as with most modern developing languages, you don't have to use new features just because they are new, auto is a good example in C++, I feel it doesn't bring enough to the party over making for less readable/maintanable code.
 
Last edited:
Not wanting to start a language war, but as with most modern developing languages, you don't have to use new features just because they are new, auto is a good example in C++, I feel it doesn't bring enough to the party over making for less radable/maintanable code.
Any suggestions for a free C++ ide for Windows 10?
 
Any suggestions for a free C++ ide for Windows 10?

I've heard good things about Visual Studio Community Edition, but must admit I'm not clear on the license restrictions for it, on initial glance, it looks like you're ok for open source projects but would need to give that a once over.
 
Not wanting to start a language war, but as with most modern developing languages, you don't have to use new features just because they are new, auto is a good example in C++, I feel it doesn't bring enough to the party over making for less radable/maintanable code.

I fully agree with this. I rarely use the auto keyword in newly produced code. For example, the following construct:

C++:
for ( auto item : items )
    item.DoSomething();

is in general deplorable in my opinion. Usually code like this denotes that who wrote it is either too lazy to make the effort to write readable code, or has little idea about the items container and the type of the objects contained. In both cases we have a potentially serious problem.

Of course, other features introduced by C++11 and subsequent versions are great. A good example is the override keyword:

C++:
class Base
{
    ...
    virtual int Foo() const;
    ...
};

class Derived : public Base
{
    ...
    int Foo() const override;
    ...
};

which allows us to prevent lots of problems caused by wrongly reimplemented virtual functions, besides making the code much more readable and maintainable. But at any rate, lack of new features should never stop you from writing code in C++.
 
Any suggestions for a free C++ ide for Windows 10?

Quoting from https://visualstudio.microsoft.com/vs/community/ ->

If you act as an individual developer:

Any individual developer can use Visual Studio Community to create their own free or paid apps.

If you work as/for an organization:

An unlimited number of users within an organization can use Visual Studio Community for the following scenarios: in a classroom learning environment, for academic research, or for contributing to open source projects.
For all other usage scenarios:
In non-enterprise organizations, up to five users can use Visual Studio Community. In enterprise organizations (meaning those with >250 PCs or >$1 Million US Dollars in annual revenue), no use is permitted beyond the open source, academic research, and classroom learning environment scenarios described above

So I think you are perfectly OK using Visual Studio Community. For PixInsight development on Windows we currently use Visual Studio Professional 2019.

That said, For all PixInsight development I strongly recommend GCC 9.3.0 or later on Linux (Kubuntu 20.04 LTS strongly recommended). This is what we use on all of our development workstations. The Windows and macOS versions of PixInsight are just ports of the main development trunk on Linux.
 
Back
Top