Skip to content

Dm 4127 mask over lay #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 27, 2016
Merged

Dm 4127 mask over lay #189

merged 5 commits into from
Sep 27, 2016

Conversation

lznakano
Copy link
Contributor

Please test it and let me know if there is still anything wrong.

Thanks!

Copy link
Contributor

@robyww robyww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested flip with lots of different data and it all appears to be working. I think the problem is fixed!

However, the code needs some clean up. I have pointed out several places where it appears to code is unnecessary or working too hard.

@@ -16,6 +16,7 @@
import nom.tam.fits.ImageHDU;
import nom.tam.util.ArrayFuncs;
import nom.tam.util.Cursor;
import org.apache.commons.lang.ArrayUtils;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not used.

private Histogram hist;
private double betaValue;

public BasicHDU fitsHDU=null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not used.

if (!SUPPORTED_BIT_PIXS.contains(new Integer(imageHeader.bitpix))) {
System.out.println("Unimplemented bitpix = " + imageHeader.bitpix);
}
//get the data and store into float array
if ( header.containsKey("EXTTYPE") && header.getStringValue("EXTTYPE").equalsIgnoreCase("mask") ){
isMaskData=true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to treat data as a mask even if it is just a simple fits file. It might not be be an extension or marked as mask. It would be mask data for another fits file.

if (SUTDebug.isDebug()) {
printInfo(slow, shigh, imageHeader.bitpix, rangeValues);
}
int lastLine, ImageMask[] lsstMasks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doStretch function is just for mask.

  • It should be clear in the function name. some thing like: doStretchMask
  • mapBlankToZero is always passed a false. I think the parameter should come out altogehter.
  • rangeValues is not used. It should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree and will make the corresponding changes. Since it worked OK, I can do a clean up to remove everything added as testing the mask layer.

short[] masks= (short[]) ArrayFuncs.convertArray(float1d, Short.TYPE, true);
for (int i=0; i<fMasks.length; i++){
masks[i] = (short) fMasks[i];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you call convertArray for float1d then assigning it to fMasks. Could you do this:

short[] masks= (short[]) ArrayFuncs.convertArray(fMask, Short.TYPE, true);

I am not totally clear that I understand this code but it appears to be working twice as hard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this was part of the test codes which I compared the results. Then I deleted only the comparison part and left this part accidentally. I need to remove all the codes added when I debug.

float[] fdata = new float[noneZerorData.size()];
for (int i=0; i<noneZerorData.size(); i++){
fdata[i]=noneZerorData.get(i).floatValue();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ says that fdata is never used. It that is true then is noneZerorData used?
Could both of the loops be removed?

break;
}
return type;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added this exact same function to FitsRead. Call the FitsRead one instead of make another.

@lznakano
Copy link
Contributor Author

Trey,
Please take a look again. I removed all the debugging codes. I also changed the doStretch for mask as you suggested.

Thanks!
Lijun

export function StretchDropDownView({plotView:pv}) {
var enabled= pv ? true : false;
var rv= primePlot(pv).plotState.getRangeValues();
var rv= primePlot(pv).plotState.getPrimaryRangeValues();//getRangeValues();//LZ 9/21/16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be any different than what was there before. In the JavaScript PlotState, getPrimaryRangeValues() is the same as getRangeValues() when passed with no parameters. Making this change should make no difference.

Also, I plan to deprecate getPrimaryRangeValues() on the JS side.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the line back as what it was: "var rv= primePlot(pv).plotState.getRangeValues()". But the color stretch box can no longer be opened because PlotState.js has not getRangeValues method. When "getPrimaryRangeValues()" is used, the color stretch box can be opened.

@robyww
Copy link
Contributor

robyww commented Sep 27, 2016

After getPrimaryRangeValues() fix, this branch is good to merge.

@lznakano lznakano merged commit 92225c6 into dev Sep 27, 2016
@robyww robyww deleted the DM-4127-maskOverLay branch September 28, 2016 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants