Classification mixing problem after using PCA

I am working with Tandem-x image . I applied GLCM and then PCA on original image and my image (pc0) is like this;
But I do not know why NaN area around of my original image, now it is replaced by ‘2338973’ (as you can see in below image) and when I am using this PCA image (pc0) in SNAP for doing classification then it gives a class to around of image (I mean 2338973, look at below image).

I think (I am not quite sure) it will be solvable by replacing ‘NaN ’ value instead of 2338973 value in PCA result (pc0) but I do not know how should I do in bandmath?

Similar problem when doing RF classification

As I read there is not any solution for it, so we can not use RF in SNAP.

I used below expression in bandmath for pc0_I made an virtual band named by ‘New_band_1’-.

if PC0_slv1_30Mar2012 == 2338971 then PC0_slv1_30Mar2012 == NaN else PC0_slv1_30Mar2012

I wanted to replace ‘NAN’ instead of ‘2338971’ but the result shows that ‘0’ is replaced NOT, NaN!!!
I do not know why?

Anyway as whole 2338971 values are ‘0’ value now so, classification should work well but I do not know why again it is mixed by this time by another class!!!

I am out of idea for this!! Any help!!!

Hi,

If I understand your problem correctly, it has to do with NaN values that assigned a class when you do the classification.
In order to avoid this, you can create training data for your NaN values (draw one polygon in black area) and give it a name (lets say NaN) and perform the classification as normal. When the classification is complete, you will see that you have a class called NaN.
Then, go to this class name (NaN) and make it transparent. This class will disappear and you will have only your classified image.

Yes. Thanks.
As you can see in below image, I have one more class now that is named ’nan’ but if I want to remove this from image what can I do?

I tried ‘myband-nan’ in bandmath but it did not work.

Once you have your classification results, go to table on the bottom right window (where you have all of your classes with different colors), click on the NaN class and press none. This will make the NaN class transparent.

Thank you. yes they are transparetned but still they are labaled as class 2. Is it possible to completely remove them here in SNAP or not? Any way in bandmath?

One more question;
I do not know why I have some NaN values after classification in my classified image like salt and paper noise ! Any idea for removing them?

Dear @MCG
Do you have any idea for this? I found something here


But I did not understand what is the solution!!!

Do you mean I should put ‘confidence>= 0’ in Layer properties?