Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #145 from Astroua/develop
Browse files Browse the repository at this point in the history
Release 0.6 - Integration with CASA image analysis libraries
  • Loading branch information
alexstrilets committed Mar 11, 2016
2 parents 244f19d + 8567428 commit 4661a7f
Show file tree
Hide file tree
Showing 277 changed files with 16,508 additions and 2,351 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM astrilet/cartabuild:latest
COPY . /home/developer/src/CARTAvis
WORKDIR /home/developer/
USER 1000
ENV CIRUN true
ENV CIRUN $CIRCLECI
RUN /home/developer/src/CARTAvis/carta/scripts/buildcarta.sh
CMD ["bash"]
18 changes: 16 additions & 2 deletions carta/cpp/CartaLib/CartaLib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ SOURCES += \
HtmlString.cpp \
LinearMap.cpp \
Hooks/ColormapsScalar.cpp \
Hooks/ConversionIntensityHook.cpp \
Hooks/ConversionSpectralHook.cpp \
Hooks/Histogram.cpp \
Hooks/HistogramResult.cpp \
Hooks/ImageStatisticsHook.cpp \
Hooks/LoadRegion.cpp \
Hooks/Plot2DResult.cpp \
IImage.cpp \
PixelType.cpp \
Slice.cpp \
Expand All @@ -27,24 +32,31 @@ SOURCES += \
Hooks/LoadAstroImage.cpp \
PixelPipeline/CustomizablePixelPipeline.cpp \
PWLinear.cpp \
StatInfo.cpp \
VectorGraphics/VGList.cpp \
VectorGraphics/BetterQPainter.cpp \
Algorithms/ContourConrec.cpp \
IWcsGridRenderService.cpp \
ContourSet.cpp \
Algorithms/LineCombiner.cpp \
IImageRenderService.cpp \
IRemoteVGView.cpp
IRemoteVGView.cpp \
RegionInfo.cpp

HEADERS += \
CartaLib.h\
cartalib_global.h \
HtmlString.h \
LinearMap.h \
Hooks/ColormapsScalar.h \
Hooks/ConversionIntensityHook.h \
Hooks/ConversionSpectralHook.h \
Hooks/Histogram.h \
Hooks/HistogramResult.h \
Hooks/HookIDs.h \
Hooks/ImageStatisticsHook.h \
Hooks/LoadRegion.h \
Hooks/Plot2DResult.h \
IPlugin.h \
IImage.h \
PixelType.h \
Expand All @@ -60,6 +72,7 @@ HEADERS += \
PixelPipeline/IPixelPipeline.h \
PixelPipeline/CustomizablePixelPipeline.h \
PWLinear.h \
StatInfo.h \
VectorGraphics/VGList.h \
Hooks/GetWcsGridRenderer.h \
Hooks/LoadPlugin.h \
Expand All @@ -73,7 +86,8 @@ HEADERS += \
Hooks/Initialize.h \
IImageRenderService.h \
Hooks/GetImageRenderService.h \
IRemoteVGView.h
IRemoteVGView.h \
RegionInfo.h

unix {
target.path = /usr/lib
Expand Down
7 changes: 7 additions & 0 deletions carta/cpp/CartaLib/Hooks/ConversionIntensityHook.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
*
**/


#include "ConversionIntensityHook.h"

72 changes: 72 additions & 0 deletions carta/cpp/CartaLib/Hooks/ConversionIntensityHook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Hook for converting intensity units.
*
**/

#pragma once

#include "CartaLib/CartaLib.h"
#include "CartaLib/IPlugin.h"

namespace Carta
{
namespace Lib
{
namespace Image {
class ImageInterface;
}
namespace Hooks
{
class ConversionIntensityHook : public BaseHook
{
CARTA_HOOK_BOILER1( ConversionIntensityHook );

public:

typedef std::vector<double> ResultType;

/**
* @brief Params
*/
struct Params {

Params( std::shared_ptr<Image::ImageInterface> dataSource,
const QString& oldUnit, const QString& newUnit,
std::vector<double> inputXValues, std::vector<double> inputYValues,
double maxYValue, const QString& maxUnit){
m_dataSource = dataSource;
m_oldUnit = oldUnit;
m_newUnit = newUnit;
m_maxUnit = maxUnit;
m_maxValueY = maxYValue;
m_inputListX = inputXValues;
m_inputListY = inputYValues;
}

std::shared_ptr<Image::ImageInterface> m_dataSource;
std::vector<double> m_inputListX;
std::vector<double> m_inputListY;
QString m_newUnit;
QString m_oldUnit;
QString m_maxUnit;
double m_maxValueY;

};

/**
* @brief PreRender
* @param pptr
*
* @todo make hook constructors protected, so that only hook helper can create them
*/
ConversionIntensityHook( Params * pptr ) : BaseHook( staticId ), paramsPtr( pptr )
{
CARTA_ASSERT( is < Me > () );
}

ResultType result;
Params * paramsPtr;
};
}
}
}
7 changes: 7 additions & 0 deletions carta/cpp/CartaLib/Hooks/ConversionSpectralHook.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
*
**/


#include "ConversionSpectralHook.h"

64 changes: 64 additions & 0 deletions carta/cpp/CartaLib/Hooks/ConversionSpectralHook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Hook for converting intensity units.
*
**/

#pragma once

#include "CartaLib/CartaLib.h"
#include "CartaLib/IPlugin.h"

namespace Carta
{
namespace Lib
{
namespace Image {
class ImageInterface;
}
namespace Hooks
{
class ConversionSpectralHook : public BaseHook
{
CARTA_HOOK_BOILER1( ConversionSpectralHook );

public:

typedef std::vector<double> ResultType;

/**
* @brief Params
*/
struct Params {

Params( std::shared_ptr<Image::ImageInterface> dataSource,
QString oldUnit, QString newUnit,
std::vector<double> inputValues ){
m_dataSource = dataSource;
m_oldUnit = oldUnit;
m_newUnit = newUnit;
m_inputList = inputValues;
}

std::shared_ptr<Image::ImageInterface> m_dataSource;
std::vector<double> m_inputList;
QString m_newUnit;
QString m_oldUnit;
};

/**
* @brief PreRender
* @param pptr
*
* @todo make hook constructors protected, so that only hook helper can create them
*/
ConversionSpectralHook( Params * pptr ) : BaseHook( staticId ), paramsPtr( pptr )
{
CARTA_ASSERT( is < Me > () );
}

ResultType result;
Params * paramsPtr;
};
}
}
}
7 changes: 4 additions & 3 deletions carta/cpp/CartaLib/Hooks/Histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include "CartaLib/CartaLib.h"
#include "CartaLib/IPlugin.h"
#include <vector>
#include "CartaLib/Hooks/HistogramResult.h"

#include "HistogramResult.h"

namespace Carta
{
Expand All @@ -35,7 +36,7 @@ class HistogramHook : public BaseHook
*/
struct Params {

Params( std::vector<std::shared_ptr<Image::ImageInterface>> p_dataSource,
Params( std::shared_ptr<Image::ImageInterface> p_dataSource,
int p_binCount, int p_minChannel, int p_maxChannel, double p_minFrequency, double p_maxFrequency,
const QString& p_rangeUnits, double p_minIntensity, double p_maxIntensity){
dataSource = p_dataSource;
Expand All @@ -49,7 +50,7 @@ class HistogramHook : public BaseHook
rangeUnits = p_rangeUnits;
}

std::vector<std::shared_ptr<Image::ImageInterface>> dataSource;
std::shared_ptr<Image::ImageInterface> dataSource;
int binCount;
int minChannel;
int maxChannel;
Expand Down
21 changes: 4 additions & 17 deletions carta/cpp/CartaLib/Hooks/HistogramResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,15 @@ namespace Carta {
namespace Lib {
namespace Hooks {

HistogramResult::HistogramResult( const QString histogramName, const QString units,
std::vector<std::pair<double,double>> histogramData){

m_name = histogramName;
m_data = histogramData;
m_units = units;
HistogramResult::HistogramResult( const QString histogramName,
const QString unitsX, const QString unitsY,
std::vector<std::pair<double,double>> histogramData):
Plot2DResult( histogramName, unitsX, unitsY, histogramData ){
m_frequencyMin = -1;
m_frequencyMax = -1;

}

QString HistogramResult::getName() const{
return m_name;
}

std::vector<std::pair<double,double>> HistogramResult::getData() const{
return m_data;
}

QString HistogramResult::getUnits() const {
return m_units;
}

double HistogramResult::getFrequencyMin() const {
return m_frequencyMin;
Expand Down
26 changes: 4 additions & 22 deletions carta/cpp/CartaLib/Hooks/HistogramResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@
#pragma once
#include <QString>
#include <vector>
#include "Plot2DResult.h"

namespace Carta{
namespace Lib{

namespace Hooks {

class HistogramResult {
class HistogramResult : public Plot2DResult {


public:
HistogramResult( const QString name="", const QString units="",
HistogramResult( const QString name="", const QString unitsX="", const QString unitsY="",
std::vector<std::pair<double,double>> data = std::vector<std::pair<double,double>>());

/**
* Returns the (intensity,count) pairs representing the histogram data.
* @return a vector containing (intensity,count) pairs.
*/
std::vector<std::pair<double,double>> getData() const;

/**
* Returns the minimum frequency for a range selection.
* @return the minimum frequency for a cube channel range selection.
Expand All @@ -35,17 +30,7 @@ class HistogramResult {
*/
double getFrequencyMax() const;

/**
* Returns a user-friendly name for the data displayed in the histogram.
* @return a user friendly name for the histogram data.
*/
QString getName() const;

/**
* Returns the intensity (x-units) of the data.
* @return the intensity units.
*/
QString getUnits() const;

/**
* Sets the frequency range for a channels in the cube.
Expand All @@ -54,14 +39,11 @@ class HistogramResult {
*/
void setFrequencyBounds( double minFreq, double maxFreq );

~HistogramResult(){}
virtual ~HistogramResult(){}

private:
QString m_name;
QString m_units;
double m_frequencyMin;
double m_frequencyMax;
std::vector<std::pair<double,double>> m_data;
};
}
}
Expand Down
4 changes: 4 additions & 0 deletions carta/cpp/CartaLib/Hooks/HookIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ enum class UniqueHookIDs {
LoadAstroImage_ID,
HistogramHook_ID,
ColormapsScalarHook_ID,
ConversionIntensityHook_ID,
ConversionSpectralHook_ID,
LoadPlugin_ID,
LoadRegion_ID,
GetWcsGridRendererHook_ID,
GetInitialFileList_ID,
GetImageRenderService_ID,
ImageStatisticsHook_ID,

/// experimental, soon to be removed:
PreRender_ID,
Expand Down
7 changes: 7 additions & 0 deletions carta/cpp/CartaLib/Hooks/ImageStatisticsHook.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
*
**/


#include "ImageStatisticsHook.h"

Loading

0 comments on commit 4661a7f

Please sign in to comment.