-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); | ||
} |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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.
Trey, Thanks! |
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
After getPrimaryRangeValues() fix, this branch is good to merge. |
Please test it and let me know if there is still anything wrong.
Thanks!