Exemplo n.º 1
0
bool PhysicsInterface::convertImageAlphaTo2DPolygons(const Image& image, Vector<Vector<Vec2>>& outPolygons,
                                                     bool flipHorizontally, bool flipVertically)
{
    // Check image is valid
    if (!image.isValid2DImage())
    {
        LOG_ERROR << "The passed image is not a valid 2D image: " << image;
        return false;
    }

    auto bitmap = Bitmap(image.getWidth(), image.getHeight());

    // Setup bitmap contents
    auto width = int(image.getWidth());
    for (auto i = 0U; i < bitmap.data.size(); i++)
        bitmap.set(i % width, i / width, image.getPixelColor(i % width, i / width).a > 0.5f);

    // Find all the edge pixels
    auto edgePixels = Vector<PolygonVertex>();
    for (auto y = 0; y < bitmap.height; y++)
    {
        for (auto x = 0; x < bitmap.width; x++)
        {
            if (bitmap.get(x, y) && (!bitmap.get(x - 1, y - 1) || !bitmap.get(x - 1, y) || !bitmap.get(x - 1, y + 1) ||
                                     !bitmap.get(x, y - 1) || !bitmap.get(x, y + 1) || !bitmap.get(x + 1, y - 1) ||
                                     !bitmap.get(x + 1, y) || !bitmap.get(x + 1, y + 1)))
                edgePixels.emplace(x, y);
        }
    }

    while (!edgePixels.empty())
    {
        // Start the next polygon at an unused edge pixel
        auto polygon = Vector<PolygonVertex>(1, edgePixels.popBack());

        // Each pixel that is put onto polygon can be backtracked if it leads to a dead end, this fixes problems with
        // pointy angles that can cause the edge walking to get stuck.
        auto hasBacktracked = false;

        while (true)
        {
            // Continue building this polygon by finding the next adjacent edge pixel
            auto adjacentPixel = 0U;
            for (; adjacentPixel < edgePixels.size(); adjacentPixel++)
            {
                if (bitmap.isAdjacent(polygon.back(), edgePixels[adjacentPixel]))
                    break;
            }

            // If there was no adjacent edge pixel then this polygon is malformed, so skip it and keep trying to build
            // more
            if (adjacentPixel == edgePixels.size())
            {
                if (!hasBacktracked)
                {
                    polygon.popBack();
                    hasBacktracked = true;

                    if (polygon.empty())
                        break;

                    continue;
                }
                else
                    break;
            }

            // Add the adjacent edge pixel to this polygon
            polygon.append(edgePixels[adjacentPixel]);
            edgePixels.erase(adjacentPixel);
            hasBacktracked = false;

            // Check whether this polygon is now complete, at least 4 points are required for a valid polygon
            if (polygon.size() < 4 || !bitmap.isAdjacent(polygon[0], polygon.back()))
                continue;

            // Now that a complete polygon has been constructed it needs to be simplified down as much as possible while
            // retaining key features such as large straight edges and right angles

            // Simplify perfectly horizontal and vertical edges as much as possible
            for (auto i = 0; i < int(polygon.size()); i++)
            {
                const auto& a = polygon[i];
                const auto& b = polygon[(i + 1) % polygon.size()];
                const auto& c = polygon[(i + 2) % polygon.size()];

                if ((a.x == b.x && a.x == c.x) || (a.y == b.y && a.y == c.y))
                    polygon.erase((i-- + 1) % polygon.size());
            }

            // Identify horizontal and vertical edges that are on the outside edge of the bitmap and mark their vertices
            // as important
            for (auto i = 0U; i < polygon.size(); i++)
            {
                auto& a = polygon[i];
                auto& b = polygon[(i + 1) % polygon.size()];
                if ((a.x == 0 || a.x == int(image.getWidth() - 1) || a.y == 0 || a.y == int(image.getHeight() - 1)) &&
                    a.isAxialEdge(b))
                {
                    a.keep = true;
                    b.keep = true;
                }
            }

            // Identify axial right angles and flag the relevant vertices as important
            for (auto i = 0U; i < polygon.size(); i++)
            {
                const auto& a = polygon[i];
                const auto& c = polygon[(i + 2) % polygon.size()];
                auto& b = polygon[(i + 1) % polygon.size()];

                if (a.isAxialEdge(b) && b.isAxialEdge(c) && (a - b).isRightAngle(c - b))
                    b.keep = true;
            }

            // The ends of straight edges that are not part of a right angle shape are pulled inwards by inserting new
            // vertices one pixel apart, this allows the ends of straight edges to undergo subsequent simplification.
            // The 'body' of the straight edge is then flagged as important to avoid any further simplification, which
            // will preserve the straight edge in the final result.
            const auto straightEdgePullBackSize = straightEdgeLength / 3;
            for (auto i = 0U; i < polygon.size(); i++)
            {
                auto a = polygon[i];
                auto b = polygon[(i + 1) % polygon.size()];

                if (a.isAxialEdge(b))
                {
                    auto xSign = Math::getSign(b.x - a.x);
                    auto ySign = Math::getSign(b.y - a.y);

                    if (!a.keep)
                    {
                        for (auto j = 0U; j < straightEdgePullBackSize; j++)
                            polygon.insert(i++, PolygonVertex(a.x + xSign * (j + 1), a.y + (j + 1) * ySign));

                        polygon[i].keep = true;
                    }

                    if (!b.keep)
                    {
                        for (auto j = 0U; j < straightEdgePullBackSize; j++)
                        {
                            polygon.insert(i++, PolygonVertex(b.x - (straightEdgePullBackSize - j) * xSign,
                                                              b.y - (straightEdgePullBackSize - j) * ySign));
                        }
                        polygon[i - straightEdgePullBackSize + 1].keep = true;
                    }
                }
            }

            // This is the main simplification loop, it works by trying to do progressively larger and larger
            // simplifcations on the polygon
            auto simplificationThreshold = 1.5f;
            while (polygon.size() > 3)
            {
                for (auto i = 0U; i < polygon.size(); i++)
                {
                    const auto& a = polygon[i];
                    const auto& b = polygon[(i + 1) % polygon.size()];
                    const auto& c = polygon[(i + 2) % polygon.size()];

                    // If b is important then don't try to get rid of it
                    if (b.keep)
                        continue;

                    // Get rid of point b if the line a-c is connected by an edge in the bitmap
                    if (a.distance(c) < simplificationThreshold && bitmap.arePixelsConnectedByEdge(a, c))
                        polygon.erase((i + 1) % polygon.size());
                }

                simplificationThreshold += 1.0f;
                if (simplificationThreshold >= std::max(image.getWidth(), image.getHeight()))
                    break;
            }

            if (polygon.size() < 3)
                break;

            outPolygons.enlarge(1);
            auto& outPolygon = outPolygons.back();

            // Scale to the range 0-1
            for (const auto& vertex : polygon)
                outPolygon.append(vertex.toVec2() / Vec2(float(image.getWidth() - 1), float(image.getHeight() - 1)));

            // Apply horizontal and vertical flips if requested
            if (flipHorizontally)
            {
                for (auto& vertex : outPolygon)
                    vertex.setXY(1.0f - vertex.x, vertex.y);
            }
            if (flipVertically)
            {
                for (auto& vertex : outPolygon)
                    vertex.setXY(vertex.x, 1.0f - vertex.y);
            }

            // Order vertices clockwise
            auto center = outPolygon.getAverage();
            if ((Vec3(outPolygon[0]) - center).cross(Vec3(outPolygon[1]) - center).z > 0.0f)
                outPolygon.reverse();

            break;
        }
    }

    return !outPolygons.empty();
}
Exemplo n.º 2
0
RescaleRGBAction::RescaleRGBAction() :
Action( "Image > Rescale > Rescale RGB/K", Bitmap( RescaleRGBActionIcon_XPM ), "Intensity Transformations" )
{
   SetToolTip( "Rescale" );
}
Exemplo n.º 3
0
void AlphaMask::setAlpha(Bitmap& bmp) const {
	if (!alpha) return;
	Image img = bmp.ConvertToImage();
	setAlpha(img);
	bmp = Bitmap(img);
}
Exemplo n.º 4
0
VerticalMirrorAction::VerticalMirrorAction() :
Action( "Image > Geometry > Vertical Mirror", Bitmap( VerticalMirrorActionIcon_XPM ), "Geometry" )
{
   SetToolTip( "Vertical Mirror" );
}
Exemplo n.º 5
0
Rotate90CWAction::Rotate90CWAction() :
Action( L"Image > Geometry > Rotate 90\xb0 Clockwise", Bitmap( Rotate90CWActionIcon_XPM ), L"Geometry" )
{
   SetToolTip( "Rotate 90\xb0 Clockwise" );
}
Exemplo n.º 6
0
Bitmap PngFormatter::Decode(const vector<Byte> &data) const
{
	if (!IsPng(data))
	{
		LU_LOG_E(LU_TAG "Decode", "Not PNG data");
		return {};
	}

	PngReadRes res;
	res.png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr,
			nullptr);
	if (!res.png)
	{
		LU_LOG_E(LU_TAG "Decode", "Failed while png_create_read_struct");
		return {};
	}
	res.info = png_create_info_struct(res.png);
	if (!res.info)
	{
		LU_LOG_E(LU_TAG "Decode", "Failed while png_create_info_struct");
		return {};
	}

	vector<Byte> decode;
	vector<Byte*> decode_rows;

	if (setjmp(png_jmpbuf(res.png)))
	{
		LU_LOG_E(LU_TAG "Decode", "Unknown error");
		return {};
	}

	auto it = data.cbegin();
	png_set_read_fn(res.png, &it, &PngReadData);
	png_read_info(res.png, res.info);
	ConfigureReadPng(res.png, res.info);

	Size size(png_get_image_width(res.png, res.info),
			png_get_image_height(res.png, res.info));
	const Uint color_depth = png_get_bit_depth(res.png, res.info)
			* png_get_channels(res.png, res.info);
	if (color_depth != 32)
	{
		LU_LOG_E(LU_TAG "Decode", "Wrong pixel_size");
		return {};
	}

	const Uint row_size = size.w * 4; // 32 / 8 = 4
	decode.resize(row_size * size.h);
	decode_rows.reserve(size.h);
	for (Uint i = 0; i < size.h; ++i)
	{
		decode_rows.push_back(decode.data() + (row_size * i));
	}

	if (setjmp(png_jmpbuf(res.png)))
	{
		LU_LOG_E(LU_TAG "Decode", "Unknown error");
		return {};
	}

	png_read_image(res.png, decode_rows.data());
	png_read_end(res.png, nullptr);
	return Bitmap(std::move(decode), size);
}
Exemplo n.º 7
0
PreferencesAction::PreferencesAction() :
Action( L"Edit > Global Preferences", Bitmap( PreferencesActionIcon_XPM ), L"Edit" )
{
   SetToolTip( "Global Preferences" );
}
Exemplo n.º 8
0
BinarizeAction::BinarizeAction() :
Action( "Image > Binarize", Bitmap( BinarizeActionIcon_XPM ), "Intensity Transformations" )
{
   SetToolTip( "Binarize" );
}
Exemplo n.º 9
0
ColorManagementSetupAction::ColorManagementSetupAction() :
Action( L"Edit > Color Management Setup", Bitmap( ColorManagementSetupActionIcon_XPM ), L"Edit" )
{
   SetToolTip( "Color Management Setup" );
}
Exemplo n.º 10
0
Bitmap Chunk::getBitmap() {
  return Bitmap(reinterpret_cast<word_t*>(bitmapBase()), bitmapSize() * 8);
}
Exemplo n.º 11
0
Bitmap TabBox::PageIcon( int idx ) const
{
   return Bitmap( (*API->TabBox->GetTabBoxPageIcon)( handle, idx ) );
}
Exemplo n.º 12
0
/// Replaces both the image and the bitmap.
void ThemeBase::ReplaceImage( int iIndex, wxImage * pImage )
{
   Image( iIndex ) = *pImage;
   Bitmap( iIndex ) = wxBitmap( *pImage );
}
Exemplo n.º 13
0
void SectionBar::ControlHide( Control& sender )
{
   if ( m_section != 0 && sender == *m_section )
      Title_ToolButton.SetIcon( Bitmap( ScaledResource( expand_icon ) ) );
}
Exemplo n.º 14
0
//+----------------------------------------------------------------------------+

// ----------------------------------------------------------------------------- : Includes

#include <util/prec.hpp>
#include <gui/value/symbol.hpp>
#include <gui/symbol/window.hpp>
#include <data/action/value.hpp>
#include <gui/util.hpp>

// ----------------------------------------------------------------------------- : SymbolValueEditor

IMPLEMENT_VALUE_EDITOR(Symbol)
	, button_down(-2)
{
	button_images[0] = Bitmap(load_resource_image(_("edit_symbol")));
}

void SymbolValueEditor::draw(RotatedDC& dc) {
	SymbolValueViewer::draw(dc);
	// draw helper text if there are no symbols
	if (symbols.empty()) {
		dc.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxNORMAL));
		dc.SetTextForeground(*wxBLACK);
		RealSize text_size = dc.GetTextExtent(_("double click to edit symbol"));
		dc.DrawText(_("double click to edit symbol"), align_in_rect(ALIGN_MIDDLE_CENTER, text_size, style().getInternalRect()));
	}
	if (nativeLook()) {
		// draw editor buttons
		dc.SetFont(*wxNORMAL_FONT);
		drawButton(dc, 0, _BUTTON_("edit symbol"));
Exemplo n.º 15
0
FITSHeaderAction::FITSHeaderAction() :
   Action( L"File > FITS Header", Bitmap( ":/icons/table.png" ), L"File" )
{
   SetToolTip( "FITS Header" );
}
Exemplo n.º 16
0
ReadoutOptionsAction::ReadoutOptionsAction() :
Action( L"Edit > Readout Options", Bitmap( ReadoutOptionsActionIcon_XPM ), L"Edit" )
{
   SetToolTip( "Readout Options" );
}
    AberrationInspectorAction::AberrationInspectorAction() :
    Action("Image > ImageInspection > Aberration Spotter", Bitmap(AberrationInspectorIcon_XPM), "ImageInspection")
    {
		SetAccelerator(KeyModifier::Alt, KeyCode::S);
        SetToolTip("Copy corners to NewImage.");
    }
Exemplo n.º 18
0
/*--------------------------------------------------------------------------*/
void PegCheckBox::Draw(void)
{
    PegBitmap *pbm;
    PegColor Color;

   #if defined(ACTIVE_BUTTON_COLOR_CHANGE)
    if (StatusIs(PSF_CURRENT))
    {
        Color.Set(muColors[PCI_STEXT], muColors[PCI_SELECTED], CF_NONE);
    }
    else
    {
        Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
    }
   #else
    Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
   #endif

    if (NumColors() < 4)
    {
        Color.uFlags = CF_FILL;
    }

    if (!(mwStyle & AF_ENABLED))
    {
        Color.uForeground = PCLR_LOWLIGHT;
        if (mwStyle & BF_SELECTED)
        {
            pbm = &gbCheckBoxOnDisabledBitmap;
        }
        else
        {
            pbm = &gbCheckBoxOffDisabledBitmap;
        }
    }
    else
    {
        if (mwStyle & BF_SELECTED)
        {
            pbm = &gbCheckBoxOnBitmap;
        }
        else
        {
            pbm = &gbCheckBoxOffBitmap;
        }
    }
    BeginDraw();

    SIGNED yCenter = (mReal.wTop + mReal.wBottom) / 2;
    PegPoint Put;

   #ifdef PEG_DRAW_FOCUS
    Put.x = mReal.wLeft + 3;
   #else
    Put.x = mReal.wLeft;
   #endif
    Put.y = yCenter - (pbm->wHeight / 2);
    Bitmap(Put, pbm);

    // now draw the text:

    Put.x = mReal.wLeft + pbm->wWidth + CBOX_SPACING;
    WORD wSize = TextHeight(mpText, mpFont);
    Put.y = yCenter - (wSize / 2);
    DrawText(Put, mpText, Color, mpFont);

    if (NumColors() < 4)
    {
        if (!(mwStyle & AF_ENABLED))
        {
            Line(Put.x, yCenter, Put.x + TextWidth(mpText, mpFont) - 2, yCenter, Color);
        }
    }

   #ifdef PEG_DRAW_FOCUS
    if (StatusIs(PSF_CURRENT))
    {
        DrawFocusIndicator(FALSE);
    }
   #endif
    EndDraw();
}
Exemplo n.º 19
0
Bitmap FileFormat::SmallIcon() const
{
   return Bitmap( (*API->FileFormat->GetFileFormatSmallIcon)( m_data->handle ) );
}
Exemplo n.º 20
0
B3EInterface::GUIData::GUIData( B3EInterface& w )
{
#define DELTA_FRAME  1

   pcl::Font fnt = w.Font();
   int labelWidth1 = fnt.Width( String( "Input wavelength 1 (nm):" ) + 'M' ); // the longest label text
   int labelWidth2 = fnt.Width( String( "Height:" ) + 'T' );
   int editWidth1 = fnt.Width( String( '0', 15 ) );
   int editWidth2 = fnt.Width( String( 'M', 30 ) );
   int ui4 = w.LogicalPixelsToPhysical( 4 );

/////////////////////// InputImage1_Sizer///////////////////////////////////////

   const char* inputImage1ToolTip = "<p>Identifier of the first input view. Must be a flux-calibrated, grayscale image.</p>";

   InputImage1_Label.SetText( "Input image 1:" );
   InputImage1_Label.SetMinWidth( labelWidth1 );
   InputImage1_Label.SetToolTip( inputImage1ToolTip );
   InputImage1_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   InputImage1_Edit.SetMinWidth( editWidth2 );
   InputImage1_Edit.SetToolTip( inputImage1ToolTip );
   InputImage1_Edit.OnEditCompleted( (Edit::edit_event_handler)&B3EInterface::__EditCompleted, w );

   InputImage1_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   InputImage1_ToolButton.SetToolTip( "<p>Select the first input view.</p>" );
   InputImage1_ToolButton.SetScaledFixedSize( 20, 20 );
   InputImage1_ToolButton.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   InputImage1_Sizer.SetSpacing( 4 );
   InputImage1_Sizer.Add( InputImage1_Label );
   InputImage1_Sizer.Add( InputImage1_Edit, 100 );
   InputImage1_Sizer.Add( InputImage1_ToolButton );

/////////////////////// InputImage2_Sizer///////////////////////////////////////

   const char* inputImage2ToolTip = "<p>Identifier of the second input view. Must be a flux-calibrated, grayscale image.</p>";

   InputImage2_Label.SetText( "Input image 2:" );
   InputImage2_Label.SetMinWidth( labelWidth1 );
   InputImage2_Label.SetToolTip( inputImage2ToolTip );
   InputImage2_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   InputImage2_Edit.SetMinWidth( editWidth2 );
   InputImage2_Edit.SetToolTip( inputImage2ToolTip );
   InputImage2_Edit.OnEditCompleted( (Edit::edit_event_handler)&B3EInterface::__EditCompleted, w );

   InputImage2_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   InputImage2_ToolButton.SetToolTip( "<p>Select the second input view.</p>" );
   InputImage2_ToolButton.SetScaledFixedSize( 20, 20 );
   InputImage2_ToolButton.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   InputImage2_Sizer.SetSpacing( 4 );
   InputImage2_Sizer.Add( InputImage2_Label );
   InputImage2_Sizer.Add( InputImage2_Edit, 100 );
   InputImage2_Sizer.Add( InputImage2_ToolButton );

//////////////////////////// Input_Sizer ///////////////////////////////////////

   Input_Sizer.SetSpacing( 6 );
   Input_Sizer.Add( InputImage1_Sizer );
   Input_Sizer.Add( InputImage2_Sizer );

//////////////////////// ProcessParameters_Sizer ///////////////////////////////

   //CenterInput1_NumericEdit.label.SetText( "" );     // Text updated in UpdateControls().
   CenterInput1_NumericEdit.label.SetMinWidth( labelWidth1 );
   CenterInput1_NumericEdit.SetReal();
   CenterInput1_NumericEdit.SetRange( TheB3EInputCenter1Parameter->MinimumValue(), TheB3EInputCenter1Parameter->MaximumValue() );
   CenterInput1_NumericEdit.SetPrecision( TheB3EInputCenter1Parameter->Precision() );
   CenterInput1_NumericEdit.SetToolTip( "<p>Effective filter wavelength or frequency for the first input image.</p>" );
   CenterInput1_NumericEdit.edit.SetFixedWidth( editWidth1 );
   CenterInput1_NumericEdit.sizer.AddStretch();
   CenterInput1_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   //CenterInput2_NumericEdit.label.SetText( "" );     // Text updated in UpdateControls().
   CenterInput2_NumericEdit.label.SetMinWidth( labelWidth1 );
   CenterInput2_NumericEdit.SetReal();
   CenterInput2_NumericEdit.SetRange( TheB3EInputCenter2Parameter->MinimumValue(), TheB3EInputCenter2Parameter->MaximumValue() );
   CenterInput2_NumericEdit.SetPrecision( TheB3EInputCenter2Parameter->Precision() );
   CenterInput2_NumericEdit.SetToolTip( "<p>Effective filter wavelength or frequency for the second input image.</p>" );
   CenterInput2_NumericEdit.edit.SetFixedWidth( editWidth1 );
   CenterInput2_NumericEdit.sizer.AddStretch();
   CenterInput2_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   //CenterInput1_NumericEdit.label.SetText( "" );     // Text updated in UpdateControls().
   CenterOutput_NumericEdit.label.SetMinWidth( labelWidth1 );
   CenterOutput_NumericEdit.SetReal();
   CenterOutput_NumericEdit.SetRange( TheB3EOutputCenterParameter->MinimumValue(), TheB3EOutputCenterParameter->MaximumValue() );
   CenterOutput_NumericEdit.SetPrecision( TheB3EOutputCenterParameter->Precision() );
   CenterOutput_NumericEdit.SetToolTip( "<p>Effective filter wavelength or frequency for the output synthetic image. "
      "This parameter is not used when only a thermal map is generated.</p>" );
   CenterOutput_NumericEdit.edit.SetFixedWidth( editWidth1 );
   CenterOutput_NumericEdit.sizer.AddStretch();
   CenterOutput_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   const char* intensityUnitsToolTip = "<p>Working flux units. Pixel values in the input and output images "
      "can represent either photons or energy per units of wavelength (nm) or frequency (THz). Energy can be "
      "expressed in any suitable units, with the condition that the same units are used for both input images. "
      "These will be also the units of the output synthetic image.</p>";

   IntensityUnits_Label.SetText( "Intensity units:" );
   IntensityUnits_Label.SetMinWidth( labelWidth1 );
   IntensityUnits_Label.SetToolTip( intensityUnitsToolTip );
   IntensityUnits_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   IntensityUnits_ComboBox.AddItem( "Photons / Frequency" );
   IntensityUnits_ComboBox.AddItem( "Energy / Frequency" );
   IntensityUnits_ComboBox.AddItem( "Photons / Wavelength" );
   IntensityUnits_ComboBox.AddItem( "Energy / Wavelength" );
   IntensityUnits_ComboBox.SetToolTip( intensityUnitsToolTip );
   IntensityUnits_ComboBox.OnItemSelected( (ComboBox::item_event_handler)&B3EInterface::__ItemSelected, w );

   IntensityUnits_Sizer.SetSpacing( 4 );
   IntensityUnits_Sizer.Add( IntensityUnits_Label );
   IntensityUnits_Sizer.Add( IntensityUnits_ComboBox );
   IntensityUnits_Sizer.AddStretch();

   ProcessParameters_Sizer.SetSpacing( 6 );
   ProcessParameters_Sizer.Add( CenterInput1_NumericEdit );
   ProcessParameters_Sizer.Add( CenterInput2_NumericEdit );
   ProcessParameters_Sizer.Add( CenterOutput_NumericEdit );
   ProcessParameters_Sizer.Add( IntensityUnits_Sizer );
   ProcessParameters_Sizer.AddStretch();

/////////////////////////// OutputData_Sizer ///////////////////////////////////

   const char* outputImagesToolTip = "<p>B3E uses the laws of blackbody radiation to generate a synthetic image, "
      "which is an estimate of flux at the specified effective output wavelength or frequency, and a thermal map "
      "as an estimate of temperature. Flux estimates are in the same units as input images, and thermal maps are "
      "unsigned 16-bit integer images whose pixels represent blackbody temperature in degrees Kelvin.</p>";

   OutputImages_Label.SetText( "Output image/s:" );
   OutputImages_Label.SetMinWidth( labelWidth1 );
   OutputImages_Label.SetToolTip( outputImagesToolTip );
   OutputImages_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   OutputImages_ComboBox.AddItem( "Synthetic Image" );
   OutputImages_ComboBox.AddItem( "Thermal Map" );
   OutputImages_ComboBox.AddItem( "Synthetic Image & Thermal Map" );
   OutputImages_ComboBox.SetToolTip( outputImagesToolTip );
   OutputImages_ComboBox.OnItemSelected( (ComboBox::item_event_handler)&B3EInterface::__ItemSelected, w );

   OutputImages_Sizer.SetSpacing( 4 );
   OutputImages_Sizer.Add( OutputImages_Label );
   OutputImages_Sizer.Add( OutputImages_ComboBox );
   OutputImages_Sizer.AddStretch();

   OutOfRangeMask_CheckBox.SetText( "Generate out-of-range mask" );
   OutOfRangeMask_CheckBox.SetToolTip( "<p>When this option is selected, B3E generates a binary mask where white "
      "pixels correspond to out-of-range flux values in the output synthetic image. Out-of-range flux values are "
      "those above the maximum flux estimated from the input images.</p>" );
   OutOfRangeMask_CheckBox.OnClick( (pcl::Button::click_event_handler)&B3EInterface::__Clicked, w );

   OutOfRangeMask_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   OutOfRangeMask_Sizer.Add( OutOfRangeMask_CheckBox );
   OutOfRangeMask_Sizer.AddStretch();

   OutputData_Sizer.SetSpacing( 4 );
   OutputData_Sizer.Add( OutputImages_Sizer );
   OutputData_Sizer.Add( OutOfRangeMask_Sizer );
   OutputData_Sizer.AddStretch();

/*
 * ////////////////////// Background Reference 1 ///////////////////////////////
 */

   BackgroundReference1_SectionBar.SetTitle( "Background Reference 1" );
   BackgroundReference1_SectionBar.SetSection( BackgroundReference1_Control );
   BackgroundReference1_SectionBar.EnableTitleCheckBox();
   BackgroundReference1_SectionBar.OnCheck( (SectionBar::check_event_handler)&B3EInterface::__BackgroundReference_Check, w );

   BackgroundReferenceView1_Label.SetText( "Reference image 1:" );
   BackgroundReferenceView1_Label.SetFixedWidth( labelWidth1 );
   BackgroundReferenceView1_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   BackgroundReferenceView1_Edit.SetToolTip( "<p>Background reference image.</p>"
      "<p>ColorCalibration will use pixels read from this image to compute an initial mean background level for "
      "each color channel. If you leave this field blank (or with its default &lt;target image&gt; value), the "
      "target image will be also the background reference image during the color calibration process.</p>"
      "<p>You should specify a view that represents the <i>true background</i> of the image. In most cases this "
      "means that you must select a view whose pixels are strongly dominated by the sky background, as it is "
      "being represented on the target image. A typical example involves defining a small preview over a free "
      "sky area of the target image, and selecting it here as the background reference image.</p>" );
   BackgroundReferenceView1_Edit.OnGetFocus( (Control::event_handler)&B3EInterface::__GetFocus, w );
   BackgroundReferenceView1_Edit.OnEditCompleted( (Edit::edit_event_handler)&B3EInterface::__EditCompleted_bkg, w );

   BackgroundReferenceView1_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   BackgroundReferenceView1_ToolButton.SetScaledFixedSize( 20, 20 );
   BackgroundReferenceView1_ToolButton.SetToolTip( "<p>Select the background reference image.</p>" );
   BackgroundReferenceView1_ToolButton.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   BackgroundReferenceView1_Sizer.SetSpacing( 4 );
   BackgroundReferenceView1_Sizer.Add( BackgroundReferenceView1_Label );
   BackgroundReferenceView1_Sizer.Add( BackgroundReferenceView1_Edit );
   BackgroundReferenceView1_Sizer.Add( BackgroundReferenceView1_ToolButton );

   BackgroundLow1_NumericControl.label.SetText( "Lower limit:" );
   BackgroundLow1_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundLow1_NumericControl.slider.SetRange( 0, 100 );
   BackgroundLow1_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundLow1_NumericControl.SetReal();
   BackgroundLow1_NumericControl.SetRange( TheB3EBackgroundLow1Parameter->MinimumValue(), TheB3EBackgroundLow1Parameter->MaximumValue() );
   BackgroundLow1_NumericControl.SetPrecision( TheB3EBackgroundLow1Parameter->Precision() );
   BackgroundLow1_NumericControl.SetToolTip( "<p>Lower bound of the set of background pixels. Background reference "
      "pixels below this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundLow1_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   BackgroundHigh1_NumericControl.label.SetText( "Upper limit:" );
   BackgroundHigh1_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundHigh1_NumericControl.slider.SetRange( 0, 100 );
   BackgroundHigh1_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundHigh1_NumericControl.SetReal();
   BackgroundHigh1_NumericControl.SetRange( TheB3EBackgroundHigh1Parameter->MinimumValue(), TheB3EBackgroundHigh1Parameter->MaximumValue() );
   BackgroundHigh1_NumericControl.SetPrecision( TheB3EBackgroundHigh1Parameter->Precision() );
   BackgroundHigh1_NumericControl.SetToolTip( "<p>Upper bound of the set of background pixels. Background reference "
      "pixels above this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundHigh1_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   //
   BackgroundROI1_GroupBox.SetTitle( "Region of Interest" );
   BackgroundROI1_GroupBox.EnableTitleCheckBox();
   BackgroundROI1_GroupBox.OnCheck( (GroupBox::check_event_handler)&B3EInterface::__GroupBoxCheck, w );

   const char* backgroundROIX01ToolTip = "<p>X pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIX01_Label.SetText( "Left:" );
   BackgroundROIX01_Label.SetFixedWidth( labelWidth2 - w.LogicalPixelsToPhysical( DELTA_FRAME ) );
   BackgroundROIX01_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIX01_Label.SetToolTip( backgroundROIX01ToolTip );

   BackgroundROIX01_SpinBox.SetRange( 0, int_max );
   BackgroundROIX01_SpinBox.SetToolTip( backgroundROIX01ToolTip );
   BackgroundROIX01_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   const char* backgroundROIY01ToolTip = "<p>Y pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIY01_Label.SetText( "Top:" );
   BackgroundROIY01_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIY01_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIY01_Label.SetToolTip( backgroundROIY01ToolTip );

   BackgroundROIY01_SpinBox.SetRange( 0, int_max );
   BackgroundROIY01_SpinBox.SetToolTip( backgroundROIY01ToolTip );
   BackgroundROIY01_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   BackgroundROIRow11_Sizer.SetSpacing( 4 );
   BackgroundROIRow11_Sizer.Add( BackgroundROIX01_Label );
   BackgroundROIRow11_Sizer.Add( BackgroundROIX01_SpinBox );
   BackgroundROIRow11_Sizer.Add( BackgroundROIY01_Label );
   BackgroundROIRow11_Sizer.Add( BackgroundROIY01_SpinBox );
   BackgroundROIRow11_Sizer.AddStretch();

   const char* backgroundROIWidth1ToolTip = "<p>Width of the ROI in pixels, background reference.</p>";

   BackgroundROIWidth1_Label.SetText( "Width:" );
   BackgroundROIWidth1_Label.SetFixedWidth( labelWidth2 - w.LogicalPixelsToPhysical( DELTA_FRAME ) );
   BackgroundROIWidth1_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIWidth1_Label.SetToolTip( backgroundROIWidth1ToolTip );

   BackgroundROIWidth1_SpinBox.SetRange( 0, int_max );
   BackgroundROIWidth1_SpinBox.SetToolTip( backgroundROIWidth1ToolTip );
   BackgroundROIWidth1_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   const char* backgroundROIHeight1ToolTip = "<p>Height of the ROI in pixels, background reference.</p>";

   BackgroundROIHeight1_Label.SetText( "Height:" );
   BackgroundROIHeight1_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIHeight1_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIHeight1_Label.SetToolTip( backgroundROIHeight1ToolTip );

   BackgroundROIHeight1_SpinBox.SetRange( 0, int_max );
   BackgroundROIHeight1_SpinBox.SetToolTip( backgroundROIHeight1ToolTip );
   BackgroundROIHeight1_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   BackgroundROISelectPreview1_Button.SetText( "From Preview" );
   BackgroundROISelectPreview1_Button.SetToolTip( "<p>Import ROI coordinates from an existing preview, background reference.</p>" );
   BackgroundROISelectPreview1_Button.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   BackgroundROIRow21_Sizer.SetSpacing( 4 );
   BackgroundROIRow21_Sizer.Add( BackgroundROIWidth1_Label );
   BackgroundROIRow21_Sizer.Add( BackgroundROIWidth1_SpinBox );
   BackgroundROIRow21_Sizer.Add( BackgroundROIHeight1_Label );
   BackgroundROIRow21_Sizer.Add( BackgroundROIHeight1_SpinBox );
   BackgroundROIRow21_Sizer.AddSpacing( 12 );
   BackgroundROIRow21_Sizer.Add( BackgroundROISelectPreview1_Button );
   BackgroundROIRow21_Sizer.AddStretch();

   BackgroundROI1_Sizer.SetMargin( 6 );
   BackgroundROI1_Sizer.SetSpacing( 4 );
   BackgroundROI1_Sizer.Add( BackgroundROIRow11_Sizer );
   BackgroundROI1_Sizer.Add( BackgroundROIRow21_Sizer );

   BackgroundROI1_GroupBox.SetSizer( BackgroundROI1_Sizer );

   //
   OutputBackgroundReferenceMask1_CheckBox.SetText( "Output background reference mask" );
   OutputBackgroundReferenceMask1_CheckBox.SetToolTip( "<p>If this option is selected, ColorCalibration will "
      "create a new image window with a <i>background reference mask</i>.</p>"
      "<p>A background reference mask is white for pixels in the background reference image that have been "
      "used to calculate mean background levels, black anywhere else. You can use this mask to check whether the "
      "<i>Lower limit</i> and <i>Upper limit</i> parameters define a suitable range of values to select the "
      "pixels that you intend to use as background reference.</p>" );
   OutputBackgroundReferenceMask1_CheckBox.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   OutputBackgroundReferenceMask1_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   OutputBackgroundReferenceMask1_Sizer.Add( OutputBackgroundReferenceMask1_CheckBox );
   OutputBackgroundReferenceMask1_Sizer.AddStretch();

   //
   BackgroundReference1_Sizer.SetSpacing( 4 );
   BackgroundReference1_Sizer.Add( BackgroundReferenceView1_Sizer );
   BackgroundReference1_Sizer.Add( BackgroundLow1_NumericControl );
   BackgroundReference1_Sizer.Add( BackgroundHigh1_NumericControl );
   BackgroundReference1_Sizer.Add( BackgroundROI1_GroupBox );
   BackgroundReference1_Sizer.Add( OutputBackgroundReferenceMask1_Sizer );

   BackgroundReference1_Control.SetSizer( BackgroundReference1_Sizer );

/*
 * ////////////////////// Background Reference 2////////////////////////////////
 */

   BackgroundReference2_SectionBar.SetTitle( "Background Reference 2" );
   BackgroundReference2_SectionBar.SetSection( BackgroundReference2_Control );
   BackgroundReference2_SectionBar.EnableTitleCheckBox();
   BackgroundReference2_SectionBar.OnCheck( (SectionBar::check_event_handler)&B3EInterface::__BackgroundReference_Check, w );

   BackgroundReferenceView2_Label.SetText( "Reference image 2:" );
   BackgroundReferenceView2_Label.SetFixedWidth( labelWidth1 );
   BackgroundReferenceView2_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   BackgroundReferenceView2_Edit.SetToolTip( "<p>Background reference image.</p>"
      "<p>ColorCalibration will use pixels read from this image to compute an initial mean background level for "
      "each color channel. If you leave this field blank (or with its default &lt;target image&gt; value), the "
      "target image will be also the background reference image during the color calibration process.</p>"
      "<p>You should specify a view that represents the <i>true background</i> of the image. In most cases this "
      "means that you must select a view whose pixels are strongly dominated by the sky background, as it is "
      "being represented on the target image. A typical example involves defining a small preview over a free "
      "sky area of the target image, and selecting it here as the background reference image.</p>" );
   BackgroundReferenceView2_Edit.OnGetFocus( (Control::event_handler)&B3EInterface::__GetFocus, w );
   BackgroundReferenceView2_Edit.OnEditCompleted( (Edit::edit_event_handler)&B3EInterface::__EditCompleted_bkg, w );

   BackgroundReferenceView2_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   BackgroundReferenceView2_ToolButton.SetScaledFixedSize( 20, 20 );
   BackgroundReferenceView2_ToolButton.SetToolTip( "<p>Select the background reference image.</p>" );
   BackgroundReferenceView2_ToolButton.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   BackgroundReferenceView2_Sizer.SetSpacing( 4 );
   BackgroundReferenceView2_Sizer.Add( BackgroundReferenceView2_Label );
   BackgroundReferenceView2_Sizer.Add( BackgroundReferenceView2_Edit );
   BackgroundReferenceView2_Sizer.Add( BackgroundReferenceView2_ToolButton );

   BackgroundLow2_NumericControl.label.SetText( "Lower limit:" );
   BackgroundLow2_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundLow2_NumericControl.slider.SetRange( 0, 100 );
   BackgroundLow2_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundLow2_NumericControl.SetReal();
   BackgroundLow2_NumericControl.SetRange( TheB3EBackgroundLow2Parameter->MinimumValue(), TheB3EBackgroundLow2Parameter->MaximumValue() );
   BackgroundLow2_NumericControl.SetPrecision( TheB3EBackgroundLow2Parameter->Precision() );
   BackgroundLow2_NumericControl.SetToolTip( "<p>Lower bound of the set of background pixels. Background reference "
      "pixels below this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundLow2_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   BackgroundHigh2_NumericControl.label.SetText( "Upper limit:" );
   BackgroundHigh2_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundHigh2_NumericControl.slider.SetRange( 0, 100 );
   BackgroundHigh2_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundHigh2_NumericControl.SetReal();
   BackgroundHigh2_NumericControl.SetRange( TheB3EBackgroundHigh2Parameter->MinimumValue(), TheB3EBackgroundHigh2Parameter->MaximumValue() );
   BackgroundHigh2_NumericControl.SetPrecision( TheB3EBackgroundHigh2Parameter->Precision() );
   BackgroundHigh2_NumericControl.SetToolTip( "<p>Upper bound of the set of background pixels. Background reference "
      "pixels above this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundHigh2_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&B3EInterface::__ValueUpdated, w );

   //
   BackgroundROI2_GroupBox.SetTitle( "Region of Interest" );
   BackgroundROI2_GroupBox.EnableTitleCheckBox();
   BackgroundROI2_GroupBox.OnCheck( (GroupBox::check_event_handler)&B3EInterface::__GroupBoxCheck, w );

   const char* backgroundROIX02ToolTip = "<p>X pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIX02_Label.SetText( "Left:" );
   BackgroundROIX02_Label.SetFixedWidth( labelWidth2 - w.LogicalPixelsToPhysical( DELTA_FRAME ) );
   BackgroundROIX02_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIX02_Label.SetToolTip( backgroundROIX02ToolTip );

   BackgroundROIX02_SpinBox.SetRange( 0, int_max );
   BackgroundROIX02_SpinBox.SetToolTip( backgroundROIX02ToolTip );
   BackgroundROIX02_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   const char* backgroundROIY02ToolTip = "<p>Y pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIY02_Label.SetText( "Top:" );
   BackgroundROIY02_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIY02_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIY02_Label.SetToolTip( backgroundROIY02ToolTip );

   BackgroundROIY02_SpinBox.SetRange( 0, int_max );
   BackgroundROIY02_SpinBox.SetToolTip( backgroundROIY02ToolTip );
   BackgroundROIY02_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   BackgroundROIRow12_Sizer.SetSpacing( 4 );
   BackgroundROIRow12_Sizer.Add( BackgroundROIX02_Label );
   BackgroundROIRow12_Sizer.Add( BackgroundROIX02_SpinBox );
   BackgroundROIRow12_Sizer.Add( BackgroundROIY02_Label );
   BackgroundROIRow12_Sizer.Add( BackgroundROIY02_SpinBox );
   BackgroundROIRow12_Sizer.AddStretch();

   const char* backgroundROIWidth2ToolTip = "<p>Width of the ROI in pixels, background reference.</p>";

   BackgroundROIWidth2_Label.SetText( "Width:" );
   BackgroundROIWidth2_Label.SetFixedWidth( labelWidth2 - w.LogicalPixelsToPhysical( DELTA_FRAME ) );
   BackgroundROIWidth2_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIWidth2_Label.SetToolTip( backgroundROIWidth2ToolTip );

   BackgroundROIWidth2_SpinBox.SetRange( 0, int_max );
   BackgroundROIWidth2_SpinBox.SetToolTip( backgroundROIWidth2ToolTip );
   BackgroundROIWidth2_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   const char* backgroundROIHeight2ToolTip = "<p>Height of the ROI in pixels, background reference.</p>";

   BackgroundROIHeight2_Label.SetText( "Height:" );
   BackgroundROIHeight2_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIHeight2_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIHeight2_Label.SetToolTip( backgroundROIHeight2ToolTip );

   BackgroundROIHeight2_SpinBox.SetRange( 0, int_max );
   BackgroundROIHeight2_SpinBox.SetToolTip( backgroundROIHeight2ToolTip );
   BackgroundROIHeight2_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&B3EInterface::__SpinValueUpdated, w );

   BackgroundROISelectPreview2_Button.SetText( "From Preview" );
   BackgroundROISelectPreview2_Button.SetToolTip( "<p>Import ROI coordinates from an existing preview, background reference.</p>" );
   BackgroundROISelectPreview2_Button.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   BackgroundROIRow22_Sizer.SetSpacing( 4 );
   BackgroundROIRow22_Sizer.Add( BackgroundROIWidth2_Label );
   BackgroundROIRow22_Sizer.Add( BackgroundROIWidth2_SpinBox );
   BackgroundROIRow22_Sizer.Add( BackgroundROIHeight2_Label );
   BackgroundROIRow22_Sizer.Add( BackgroundROIHeight2_SpinBox );
   BackgroundROIRow22_Sizer.AddSpacing( 12 );
   BackgroundROIRow22_Sizer.Add( BackgroundROISelectPreview2_Button );
   BackgroundROIRow22_Sizer.AddStretch();

   BackgroundROI2_Sizer.SetMargin( 6 );
   BackgroundROI2_Sizer.SetSpacing( 4 );
   BackgroundROI2_Sizer.Add( BackgroundROIRow12_Sizer );
   BackgroundROI2_Sizer.Add( BackgroundROIRow22_Sizer );

   BackgroundROI2_GroupBox.SetSizer( BackgroundROI2_Sizer );

   //
   OutputBackgroundReferenceMask2_CheckBox.SetText( "Output background reference mask" );
   OutputBackgroundReferenceMask2_CheckBox.SetToolTip( "<p>If this option is selected, ColorCalibration will "
      "create a new image window with a <i>background reference mask</i>.</p>"
      "<p>A background reference mask is white for pixels in the background reference image that have been "
      "used to calculate mean background levels, black anywhere else. You can use this mask to check whether the "
      "<i>Lower limit</i> and <i>Upper limit</i> parameters define a suitable range of values to select the "
      "pixels that you intend to use as background reference.</p>" );
   OutputBackgroundReferenceMask2_CheckBox.OnClick( (Button::click_event_handler)&B3EInterface::__Clicked, w );

   OutputBackgroundReferenceMask2_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   OutputBackgroundReferenceMask2_Sizer.Add( OutputBackgroundReferenceMask2_CheckBox );
   OutputBackgroundReferenceMask2_Sizer.AddStretch();

   //

   BackgroundReference2_Sizer.SetSpacing( 4 );
   BackgroundReference2_Sizer.Add( BackgroundReferenceView2_Sizer );
   BackgroundReference2_Sizer.Add( BackgroundLow2_NumericControl );
   BackgroundReference2_Sizer.Add( BackgroundHigh2_NumericControl );
   BackgroundReference2_Sizer.Add( BackgroundROI2_GroupBox );
   BackgroundReference2_Sizer.Add( OutputBackgroundReferenceMask2_Sizer );

   BackgroundReference2_Control.SetSizer( BackgroundReference2_Sizer );

/////////////////////////// Global_Sizer //////////////////////////////////

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( Input_Sizer );
   Global_Sizer.Add( ProcessParameters_Sizer );
   Global_Sizer.Add( OutputData_Sizer );
   Global_Sizer.Add( BackgroundReference1_SectionBar );
   Global_Sizer.Add( BackgroundReference1_Control );
   Global_Sizer.Add( BackgroundReference2_SectionBar );
   Global_Sizer.Add( BackgroundReference2_Control );

   BackgroundReference1_Control.Hide();
   BackgroundReference2_Control.Hide();

   w.SetSizer( Global_Sizer );
   w.AdjustToContents();
   w.SetFixedSize();
}
Exemplo n.º 21
0
HorizontalMirrorAction::HorizontalMirrorAction() :
Action( "Image > Geometry >> Horizontal Mirror", Bitmap( HorizontalMirrorActionIcon_XPM ), "Geometry" )
{
   SetToolTip( "Horizontal Mirror" );
}
Exemplo n.º 22
0
ChannelMatchInterface::GUIData::GUIData( ChannelMatchInterface& w )
{
   R_CheckBox.SetText( "R" );
   R_CheckBox.OnClick( (Button::click_event_handler)&ChannelMatchInterface::__Channel_Click, w );

   G_CheckBox.SetText( "G" );
   G_CheckBox.OnClick( (Button::click_event_handler)&ChannelMatchInterface::__Channel_Click, w );

   B_CheckBox.SetText( "B" );
   B_CheckBox.OnClick( (Button::click_event_handler)&ChannelMatchInterface::__Channel_Click, w );

   Channels_Sizer.SetMargin( 6 );
   Channels_Sizer.Add( R_CheckBox );
   Channels_Sizer.Add( G_CheckBox );
   Channels_Sizer.Add( B_CheckBox );

//    Channels_GroupBox.SetTitle( "RGB" );
   Channels_GroupBox.SetSizer( Channels_Sizer );
   Channels_GroupBox.AdjustToContents();
   Channels_GroupBox.SetFixedWidth();

   R_XOffset_NumericEdit.label.Hide();
   R_XOffset_NumericEdit.SetReal();
   R_XOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   R_XOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   R_XOffset_NumericEdit.SetToolTip( "X-offset, red channel" );
   R_XOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   R_Left_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-left.png" ) ) );
   R_Left_ToolButton.SetScaledFixedSize( 20, 20 );
   R_Left_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   R_Left_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   R_Right_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-right.png" ) ) );
   R_Right_ToolButton.SetScaledFixedSize( 20, 20 );
   R_Right_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   R_Right_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   R_XOffset_Sizer.Add( R_XOffset_NumericEdit );
   R_XOffset_Sizer.AddSpacing( 4 );
   R_XOffset_Sizer.Add( R_Left_ToolButton );
   R_XOffset_Sizer.Add( R_Right_ToolButton );

   G_XOffset_NumericEdit.label.Hide();
   G_XOffset_NumericEdit.SetReal();
   G_XOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   G_XOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   G_XOffset_NumericEdit.SetToolTip( "X-offset, green channel" );
   G_XOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   G_Left_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-left.png" ) ) );
   G_Left_ToolButton.SetScaledFixedSize( 20, 20 );
   G_Left_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   G_Left_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   G_Right_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-right.png" ) ) );
   G_Right_ToolButton.SetScaledFixedSize( 20, 20 );
   G_Right_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   G_Right_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   G_XOffset_Sizer.Add( G_XOffset_NumericEdit );
   G_XOffset_Sizer.AddSpacing( 4 );
   G_XOffset_Sizer.Add( G_Left_ToolButton );
   G_XOffset_Sizer.Add( G_Right_ToolButton );

   B_XOffset_NumericEdit.label.Hide();
   B_XOffset_NumericEdit.SetReal();
   B_XOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   B_XOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   B_XOffset_NumericEdit.SetToolTip( "X-offset, blue channel" );
   B_XOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   B_Left_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-left.png" ) ) );
   B_Left_ToolButton.SetScaledFixedSize( 20, 20 );
   B_Left_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   B_Left_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   B_Right_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-right.png" ) ) );
   B_Right_ToolButton.SetScaledFixedSize( 20, 20 );
   B_Right_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   B_Right_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   B_XOffset_Sizer.Add( B_XOffset_NumericEdit );
   B_XOffset_Sizer.AddSpacing( 4 );
   B_XOffset_Sizer.Add( B_Left_ToolButton );
   B_XOffset_Sizer.Add( B_Right_ToolButton );

   XOffset_Sizer.SetMargin( 6 );
   XOffset_Sizer.SetSpacing( 4 );
   XOffset_Sizer.Add( R_XOffset_Sizer );
   XOffset_Sizer.Add( G_XOffset_Sizer );
   XOffset_Sizer.Add( B_XOffset_Sizer );

   XOffset_GroupBox.SetTitle( "X-Offset" );
   XOffset_GroupBox.SetSizer( XOffset_Sizer );

   R_YOffset_NumericEdit.label.Hide();
   R_YOffset_NumericEdit.SetReal();
   R_YOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   R_YOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   R_YOffset_NumericEdit.SetToolTip( "Y-offset, red channel" );
   R_YOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   R_Up_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-up.png" ) ) );
   R_Up_ToolButton.SetScaledFixedSize( 20, 20 );
   R_Up_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   R_Up_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   R_Down_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-down.png" ) ) );
   R_Down_ToolButton.SetScaledFixedSize( 20, 20 );
   R_Down_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   R_Down_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   R_YOffset_Sizer.Add( R_YOffset_NumericEdit );
   R_YOffset_Sizer.AddSpacing( 4 );
   R_YOffset_Sizer.Add( R_Up_ToolButton );
   R_YOffset_Sizer.Add( R_Down_ToolButton );

   G_YOffset_NumericEdit.label.Hide();
   G_YOffset_NumericEdit.SetReal();
   G_YOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   G_YOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   G_YOffset_NumericEdit.SetToolTip( "Y-offset, green channel" );
   G_YOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   G_Up_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-up.png" ) ) );
   G_Up_ToolButton.SetScaledFixedSize( 20, 20 );
   G_Up_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   G_Up_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   G_Down_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-down.png" ) ) );
   G_Down_ToolButton.SetScaledFixedSize( 20, 20 );
   G_Down_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   G_Down_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   G_YOffset_Sizer.Add( G_YOffset_NumericEdit );
   G_YOffset_Sizer.AddSpacing( 4 );
   G_YOffset_Sizer.Add( G_Up_ToolButton );
   G_YOffset_Sizer.Add( G_Down_ToolButton );

   B_YOffset_NumericEdit.label.Hide();
   B_YOffset_NumericEdit.SetReal();
   B_YOffset_NumericEdit.SetRange( TheCMXOffsetParameter->MinimumValue(), TheCMXOffsetParameter->MaximumValue() );
   B_YOffset_NumericEdit.SetPrecision( TheCMXOffsetParameter->Precision() );
   B_YOffset_NumericEdit.SetToolTip( "Y-offset, blue channel" );
   B_YOffset_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Offset_ValueUpdated, w );

   B_Up_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-up.png" ) ) );
   B_Up_ToolButton.SetScaledFixedSize( 20, 20 );
   B_Up_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   B_Up_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   B_Down_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/move-down.png" ) ) );
   B_Down_ToolButton.SetScaledFixedSize( 20, 20 );
   B_Down_ToolButton.SetFocusStyle( FocusStyle::NoFocus );
   B_Down_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelMatchInterface::__Channel_Offset_Click, w );

   B_YOffset_Sizer.Add( B_YOffset_NumericEdit );
   B_YOffset_Sizer.AddSpacing( 4 );
   B_YOffset_Sizer.Add( B_Up_ToolButton );
   B_YOffset_Sizer.Add( B_Down_ToolButton );

   YOffset_Sizer.SetMargin( 6 );
   YOffset_Sizer.SetSpacing( 4 );
   YOffset_Sizer.Add( R_YOffset_Sizer );
   YOffset_Sizer.Add( G_YOffset_Sizer );
   YOffset_Sizer.Add( B_YOffset_Sizer );

   YOffset_GroupBox.SetTitle( "Y-Offset" );
   YOffset_GroupBox.SetSizer( YOffset_Sizer );

   // -------------------------------------------------------------------------

   R_Factor_NumericControl.label.Hide();
   R_Factor_NumericControl.slider.SetScaledMinWidth( 200 );
   R_Factor_NumericControl.slider.SetRange( 0, 100 );
   R_Factor_NumericControl.SetReal();
   R_Factor_NumericControl.SetRange( TheCMFactorParameter->MinimumValue(), TheCMFactorParameter->MaximumValue() );
   R_Factor_NumericControl.SetPrecision( TheCMFactorParameter->Precision() );
   R_Factor_NumericControl.SetToolTip( "Linear correction factor, red channel" );
   R_Factor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Factor_ValueUpdated, w );

   G_Factor_NumericControl.label.Hide();
   G_Factor_NumericControl.slider.SetScaledMinWidth( 200 );
   G_Factor_NumericControl.slider.SetRange( 0, 100 );
   G_Factor_NumericControl.SetReal();
   G_Factor_NumericControl.SetRange( TheCMFactorParameter->MinimumValue(), TheCMFactorParameter->MaximumValue() );
   G_Factor_NumericControl.SetPrecision( TheCMFactorParameter->Precision() );
   G_Factor_NumericControl.SetToolTip( "Linear correction factor, green channel" );
   G_Factor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Factor_ValueUpdated, w );

   B_Factor_NumericControl.label.Hide();
   B_Factor_NumericControl.slider.SetScaledMinWidth( 200 );
   B_Factor_NumericControl.slider.SetRange( 0, 100 );
   B_Factor_NumericControl.SetReal();
   B_Factor_NumericControl.SetRange( TheCMFactorParameter->MinimumValue(), TheCMFactorParameter->MaximumValue() );
   B_Factor_NumericControl.SetPrecision( TheCMFactorParameter->Precision() );
   B_Factor_NumericControl.SetToolTip( "Linear correction factor, blue channel" );
   B_Factor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ChannelMatchInterface::__Channel_Factor_ValueUpdated, w );

   Factors_Sizer.SetMargin( 6 );
   Factors_Sizer.SetSpacing( 4 );
   Factors_Sizer.Add( R_Factor_NumericControl );
   Factors_Sizer.Add( G_Factor_NumericControl );
   Factors_Sizer.Add( B_Factor_NumericControl );

   Factors_GroupBox.SetTitle( "Linear Correction Factors" );
   Factors_GroupBox.SetSizer( Factors_Sizer );

   // -------------------------------------------------------------------------

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( Channels_GroupBox );
   Global_Sizer.Add( XOffset_GroupBox );
   Global_Sizer.Add( YOffset_GroupBox );
   Global_Sizer.Add( Factors_GroupBox, 100 );

   w.SetSizer( Global_Sizer );
   w.AdjustToContents();
   w.SetFixedSize();
}
Exemplo n.º 23
0
Rotate180Action::Rotate180Action() :
Action( L"Image > Geometry > Rotate 180\xb0", Bitmap( Rotate180ActionIcon_XPM ), L"Geometry" )
{
   SetToolTip( "Rotate 180\xb0" );
}
Exemplo n.º 24
0
ColorCalibrationInterface::GUIData::GUIData( ColorCalibrationInterface& w )
{
#define DELTA_FRAME  1

   pcl::Font fnt = w.Font();
   int labelWidth1 = Max( fnt.Width( String( "Structure layers:" ) + 'T' ),
                          fnt.Width( String( "Reference image:" ) + 'T' ) );
   int labelWidth2 = fnt.Width( String( "Height:" ) + 'T' );
   int editWidth1 = fnt.Width( String( '0', 12 ) );
   int ui4 = w.LogicalPixelsToPhysical( 4 );

   //

   WhiteReference_SectionBar.SetTitle( "White Reference" );
   WhiteReference_SectionBar.SetSection( WhiteReference_Control );

   WhiteReferenceView_Label.SetText( "Reference image:" );
   WhiteReferenceView_Label.SetFixedWidth( labelWidth1 );
   WhiteReferenceView_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   WhiteReferenceView_Edit.SetToolTip( "<p>White reference image.</p>"
      "<p>ColorCalibration will use pixels read from this image to compute a set of three color calibration "
      "factors, one for each channel. If you leave this field blank (or with its default &lt;target image&gt; "
      "value), the target image will be also the white reference image during the calibration process.</p>" );
   WhiteReferenceView_Edit.OnGetFocus( (Control::event_handler)&ColorCalibrationInterface::__GetFocus, w );
   WhiteReferenceView_Edit.OnEditCompleted( (Edit::edit_event_handler)&ColorCalibrationInterface::__EditCompleted, w );

   WhiteReferenceView_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   WhiteReferenceView_ToolButton.SetScaledFixedSize( 20, 20 );
   WhiteReferenceView_ToolButton.SetToolTip( "<p>Select the white reference image</p>" );
   WhiteReferenceView_ToolButton.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   WhiteReferenceView_Sizer.SetSpacing( 4 );
   WhiteReferenceView_Sizer.Add( WhiteReferenceView_Label );
   WhiteReferenceView_Sizer.Add( WhiteReferenceView_Edit );
   WhiteReferenceView_Sizer.Add( WhiteReferenceView_ToolButton );

   WhiteLow_NumericControl.label.SetText( "Lower limit:" );
   WhiteLow_NumericControl.label.SetFixedWidth( labelWidth1 );
   WhiteLow_NumericControl.slider.SetRange( 0, 100 );
   WhiteLow_NumericControl.slider.SetScaledMinWidth( 200 );
   WhiteLow_NumericControl.SetReal();
   WhiteLow_NumericControl.SetRange( TheCCWhiteLowParameter->MinimumValue(), TheCCWhiteLowParameter->MaximumValue() );
   WhiteLow_NumericControl.SetPrecision( TheCCWhiteLowParameter->Precision() );
   WhiteLow_NumericControl.edit.SetFixedWidth( editWidth1 );
   WhiteLow_NumericControl.SetToolTip( "<p>Lower bound of the set of white reference pixels. White reference "
      "pixels less than or equal to this value will be rejected for calculation of color correction factors. "
      "Note that since the minimum allowed value for this parameter is 0, black pixels are always rejected.</p>" );
   WhiteLow_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   WhiteHigh_NumericControl.label.SetText( "Upper limit:" );
   WhiteHigh_NumericControl.label.SetFixedWidth( labelWidth1 );
   WhiteHigh_NumericControl.slider.SetRange( 0, 100 );
   WhiteHigh_NumericControl.slider.SetScaledMinWidth( 200 );
   WhiteHigh_NumericControl.SetReal();
   WhiteHigh_NumericControl.SetRange( TheCCWhiteHighParameter->MinimumValue(), TheCCWhiteHighParameter->MaximumValue() );
   WhiteHigh_NumericControl.SetPrecision( TheCCWhiteHighParameter->Precision() );
   WhiteHigh_NumericControl.edit.SetFixedWidth( editWidth1 );
   WhiteHigh_NumericControl.SetToolTip( "<p>Upper bound of the set of white reference pixels. White reference "
      "pixels greater than or equal to this value will be rejected for calculation of color correction factors. "
      "This parameter allows you to reject saturated pixels, or pixels with very high values pertaining to the "
      "nonlinear regions of most CCD response curves. Note that since the maximum allowed value for this parameter "
      "is 1, white pixels are always rejected.</p>" );
   WhiteHigh_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   //

   WhiteROI_GroupBox.SetTitle( "Region of Interest" );
   WhiteROI_GroupBox.EnableTitleCheckBox();
   WhiteROI_GroupBox.OnCheck( (GroupBox::check_event_handler)&ColorCalibrationInterface::__GroupBoxCheck, w );

   const char* whiteROIX0ToolTip = "<p>X pixel coordinate of the upper-left corner of the ROI, white reference.</p>";

   WhiteROIX0_Label.SetText( "Left:" );
   WhiteROIX0_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   WhiteROIX0_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   WhiteROIX0_Label.SetToolTip( whiteROIX0ToolTip );

   WhiteROIX0_SpinBox.SetRange( 0, int_max );
   WhiteROIX0_SpinBox.SetToolTip( whiteROIX0ToolTip );
   WhiteROIX0_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   const char* whiteROIY0ToolTip = "<p>Y pixel coordinate of the upper-left corner of the ROI, white reference.</p>";

   WhiteROIY0_Label.SetText( "Top:" );
   WhiteROIY0_Label.SetFixedWidth( labelWidth2 );
   WhiteROIY0_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   WhiteROIY0_Label.SetToolTip( whiteROIY0ToolTip );

   WhiteROIY0_SpinBox.SetRange( 0, int_max );
   WhiteROIY0_SpinBox.SetToolTip( whiteROIY0ToolTip );
   WhiteROIY0_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   WhiteROIRow1_Sizer.SetSpacing( 4 );
   WhiteROIRow1_Sizer.Add( WhiteROIX0_Label );
   WhiteROIRow1_Sizer.Add( WhiteROIX0_SpinBox );
   WhiteROIRow1_Sizer.Add( WhiteROIY0_Label );
   WhiteROIRow1_Sizer.Add( WhiteROIY0_SpinBox );
   WhiteROIRow1_Sizer.AddStretch();

   const char* whiteROIWidthToolTip = "<p>Width of the ROI in pixels, white reference.</p>";

   WhiteROIWidth_Label.SetText( "Width:" );
   WhiteROIWidth_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   WhiteROIWidth_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   WhiteROIWidth_Label.SetToolTip( whiteROIWidthToolTip );

   WhiteROIWidth_SpinBox.SetRange( 0, int_max );
   WhiteROIWidth_SpinBox.SetToolTip( whiteROIWidthToolTip );
   WhiteROIWidth_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   const char* whiteROIHeightToolTip = "<p>Height of the ROI in pixels, white reference.</p>";

   WhiteROIHeight_Label.SetText( "Height:" );
   WhiteROIHeight_Label.SetFixedWidth( labelWidth2 );
   WhiteROIHeight_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   WhiteROIHeight_Label.SetToolTip( whiteROIHeightToolTip );

   WhiteROIHeight_SpinBox.SetRange( 0, int_max );
   WhiteROIHeight_SpinBox.SetToolTip( whiteROIHeightToolTip );
   WhiteROIHeight_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   WhiteROISelectPreview_Button.SetText( "From Preview" );
   WhiteROISelectPreview_Button.SetToolTip( "<p>Import ROI coordinates from an existing preview, white reference.</p>" );
   WhiteROISelectPreview_Button.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   WhiteROIRow2_Sizer.SetSpacing( 4 );
   WhiteROIRow2_Sizer.Add( WhiteROIWidth_Label );
   WhiteROIRow2_Sizer.Add( WhiteROIWidth_SpinBox );
   WhiteROIRow2_Sizer.Add( WhiteROIHeight_Label );
   WhiteROIRow2_Sizer.Add( WhiteROIHeight_SpinBox );
   WhiteROIRow2_Sizer.AddSpacing( 12 );
   WhiteROIRow2_Sizer.Add( WhiteROISelectPreview_Button );
   WhiteROIRow2_Sizer.AddStretch();

   WhiteROI_Sizer.SetMargin( 6 );
   WhiteROI_Sizer.SetSpacing( 4 );
   WhiteROI_Sizer.Add( WhiteROIRow1_Sizer );
   WhiteROI_Sizer.Add( WhiteROIRow2_Sizer );

   WhiteROI_GroupBox.SetSizer( WhiteROI_Sizer );

   //

   StructureDetection_GroupBox.SetTitle( "Structure Detection" );
   StructureDetection_GroupBox.EnableTitleCheckBox();
   StructureDetection_GroupBox.OnCheck( (GroupBox::check_event_handler)&ColorCalibrationInterface::__GroupBoxCheck, w );
   StructureDetection_GroupBox.SetToolTip( "<p>Detect significant structures at small dimensional scales prior to "
      "evaluation of color calibration factors.</p>"
      "<p>When this option is selected, ColorCalibration uses a multiscale, wavelet-based structure detection "
      "routine to isolate bright image structures within a specified range of dimensional scales (see the next two "
      "parameters). This feature can be used to perform a color calibration based on the stars recorded in the white "
      "reference image.</p>" );

   const char* structureLayersTip =
      "<p>Number of small-scale wavelet layers used for structure detection.</p>"
      "<p>More layers will use larger image structures for calculation of color calibration factors.</p>";

   StructureLayers_Label.SetText( "Structure layers:" );
   StructureLayers_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   StructureLayers_Label.SetToolTip( structureLayersTip );
   StructureLayers_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   StructureLayers_SpinBox.SetRange( int( TheCCStructureLayersParameter->MinimumValue() ), int( TheCCStructureLayersParameter->MaximumValue() ) );
   StructureLayers_SpinBox.SetFixedWidth( editWidth1 );
   StructureLayers_SpinBox.SetToolTip( structureLayersTip );
   StructureLayers_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   StructureLayers_Sizer.SetSpacing( 4 );
   StructureLayers_Sizer.Add( StructureLayers_Label );
   StructureLayers_Sizer.Add( StructureLayers_SpinBox );
   StructureLayers_Sizer.AddStretch();

   const char* noiseLayersTip =
      "<p>Number of wavelet layers used for noise reduction.</p>"
      "<p>Noise reduction prevents detection of bright noise structures, including hot pixels and cosmic rays. "
      "This parameter can also be used to control the sizes of the smallest detected stars (increase "
      "to exclude more stars).</p>";

   NoiseLayers_Label.SetText( "Noise layers:" );
   NoiseLayers_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   NoiseLayers_Label.SetToolTip( noiseLayersTip );
   NoiseLayers_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   NoiseLayers_SpinBox.SetRange( int( TheCCNoiseLayersParameter->MinimumValue() ), int( TheCCNoiseLayersParameter->MaximumValue() ) );
   NoiseLayers_SpinBox.SetFixedWidth( editWidth1 );
   NoiseLayers_SpinBox.SetToolTip( noiseLayersTip );
   NoiseLayers_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   NoiseLayers_Sizer.SetSpacing( 4 );
   NoiseLayers_Sizer.Add( NoiseLayers_Label );
   NoiseLayers_Sizer.Add( NoiseLayers_SpinBox );
   NoiseLayers_Sizer.AddStretch();

   StructureDetection_Sizer.SetMargin( 6 );
   StructureDetection_Sizer.SetSpacing( 4 );
   StructureDetection_Sizer.Add( StructureLayers_Sizer );
   StructureDetection_Sizer.Add( NoiseLayers_Sizer );

   StructureDetection_GroupBox.SetSizer( StructureDetection_Sizer );

   //

   ManualWhiteBalance_GroupBox.SetTitle( "Manual White Balance" );
   ManualWhiteBalance_GroupBox.EnableTitleCheckBox();
   ManualWhiteBalance_GroupBox.OnCheck( (GroupBox::check_event_handler)&ColorCalibrationInterface::__GroupBoxCheck, w );
   ManualWhiteBalance_GroupBox.SetToolTip( "<p>Perform a manual white balance by specifying the three color "
      "correction factors literally.</p>"
      "<p>If you select this option, no automatic color calibration routine will be applied, and you'll "
      "be allowed to enter the correction factors for red, green and blue, as the next three parameters.</p>" );

   ManualRedFactor_NumericControl.label.SetText( "Red:" );
   ManualRedFactor_NumericControl.label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   ManualRedFactor_NumericControl.slider.SetRange( 0, 100 );
   ManualRedFactor_NumericControl.slider.SetScaledMinWidth( 200 );
   ManualRedFactor_NumericControl.SetReal();
   ManualRedFactor_NumericControl.SetRange( 0, 1 );
   ManualRedFactor_NumericControl.SetPrecision( TheCCManualRedFactorParameter->Precision() );
   ManualRedFactor_NumericControl.edit.SetFixedWidth( editWidth1 );
   ManualRedFactor_NumericControl.SetToolTip( "<p>Color correction factor, red channel.</p>" );
   ManualRedFactor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   ManualGreenFactor_NumericControl.label.SetText( "Green:" );
   ManualGreenFactor_NumericControl.label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   ManualGreenFactor_NumericControl.slider.SetRange( 0, 100 );
   ManualGreenFactor_NumericControl.slider.SetScaledMinWidth( 200 );
   ManualGreenFactor_NumericControl.SetReal();
   ManualGreenFactor_NumericControl.SetRange( 0, 1 );
   ManualGreenFactor_NumericControl.SetPrecision( TheCCManualGreenFactorParameter->Precision() );
   ManualGreenFactor_NumericControl.edit.SetFixedWidth( editWidth1 );
   ManualGreenFactor_NumericControl.SetToolTip( "<p>Color correction factor, green channel.</p>" );
   ManualGreenFactor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   ManualBlueFactor_NumericControl.label.SetText( "Blue:" );
   ManualBlueFactor_NumericControl.label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   ManualBlueFactor_NumericControl.slider.SetRange( 0, 100 );
   ManualBlueFactor_NumericControl.slider.SetScaledMinWidth( 200 );
   ManualBlueFactor_NumericControl.SetReal();
   ManualBlueFactor_NumericControl.SetRange( 0, 1 );
   ManualBlueFactor_NumericControl.SetPrecision( TheCCManualBlueFactorParameter->Precision() );
   ManualBlueFactor_NumericControl.edit.SetFixedWidth( editWidth1 );
   ManualBlueFactor_NumericControl.SetToolTip( "<p>Color correction factor, blue channel.</p>" );
   ManualBlueFactor_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   ManualWhiteBalance_Sizer.SetMargin( 6 );
   ManualWhiteBalance_Sizer.SetSpacing( 4 );
   ManualWhiteBalance_Sizer.Add( ManualRedFactor_NumericControl );
   ManualWhiteBalance_Sizer.Add( ManualGreenFactor_NumericControl );
   ManualWhiteBalance_Sizer.Add( ManualBlueFactor_NumericControl );

   ManualWhiteBalance_GroupBox.SetSizer( ManualWhiteBalance_Sizer );

   //

   OutputWhiteReferenceMask_CheckBox.SetText( "Output white reference mask" );
   OutputWhiteReferenceMask_CheckBox.SetToolTip( "<p>If this option is selected, ColorCalibration will "
      "create a new image window with a <i>white reference mask</i>.</p>"
      "<p>A white reference mask is white for pixels in the white reference image that have been used to "
      "calculate color correction factors, black anywhere else. You can use this mask to check whether the "
      "<i>White pixels</i> and <i>Saturation point</i> parameters are doing a good job selecting the "
      "pixels that you intend to use as a white reference.</p>" );
   OutputWhiteReferenceMask_CheckBox.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   OutputWhiteReferenceMask_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   OutputWhiteReferenceMask_Sizer.Add( OutputWhiteReferenceMask_CheckBox );
   OutputWhiteReferenceMask_Sizer.AddStretch();

   WhiteReference_Sizer.SetSpacing( 4 );
   WhiteReference_Sizer.Add( WhiteReferenceView_Sizer );
   WhiteReference_Sizer.Add( WhiteLow_NumericControl );
   WhiteReference_Sizer.Add( WhiteHigh_NumericControl );
   WhiteReference_Sizer.Add( WhiteROI_GroupBox );
   WhiteReference_Sizer.Add( StructureDetection_GroupBox );
   WhiteReference_Sizer.Add( ManualWhiteBalance_GroupBox );
   WhiteReference_Sizer.Add( OutputWhiteReferenceMask_Sizer );

   WhiteReference_Control.SetSizer( WhiteReference_Sizer );

   //

   BackgroundReference_SectionBar.SetTitle( "Background Reference" );
   BackgroundReference_SectionBar.SetSection( BackgroundReference_Control );

   BackgroundReferenceView_Label.SetText( "Reference image:" );
   BackgroundReferenceView_Label.SetFixedWidth( labelWidth1 );
   BackgroundReferenceView_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   BackgroundReferenceView_Edit.SetToolTip( "<p>Background reference image.</p>"
      "<p>ColorCalibration will use pixels read from this image to compute an initial mean background level for "
      "each color channel. If you leave this field blank (or with its default &lt;target image&gt; value), the "
      "target image will be also the background reference image during the color calibration process.</p>"
      "<p>You should specify a view that represents the <i>true background</i> of the image. In most cases this "
      "means that you must select a view whose pixels are strongly dominated by the sky background, as it is "
      "being represented on the target image. A typical example involves defining a small preview over a free "
      "sky area of the target image, and selecting it here as the background reference image.</p>" );
   BackgroundReferenceView_Edit.OnGetFocus( (Control::event_handler)&ColorCalibrationInterface::__GetFocus, w );
   BackgroundReferenceView_Edit.OnEditCompleted( (Edit::edit_event_handler)&ColorCalibrationInterface::__EditCompleted, w );

   BackgroundReferenceView_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   BackgroundReferenceView_ToolButton.SetScaledFixedSize( 20, 20 );
   BackgroundReferenceView_ToolButton.SetToolTip( "<p>Select the background reference image.</p>" );
   BackgroundReferenceView_ToolButton.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   BackgroundReferenceView_Sizer.SetSpacing( 4 );
   BackgroundReferenceView_Sizer.Add( BackgroundReferenceView_Label );
   BackgroundReferenceView_Sizer.Add( BackgroundReferenceView_Edit );
   BackgroundReferenceView_Sizer.Add( BackgroundReferenceView_ToolButton );

   BackgroundLow_NumericControl.label.SetText( "Lower limit:" );
   BackgroundLow_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundLow_NumericControl.slider.SetRange( 0, 100 );
   BackgroundLow_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundLow_NumericControl.SetReal();
   BackgroundLow_NumericControl.SetRange( TheCCBackgroundLowParameter->MinimumValue(), TheCCBackgroundLowParameter->MaximumValue() );
   BackgroundLow_NumericControl.SetPrecision( TheCCBackgroundLowParameter->Precision() );
   BackgroundLow_NumericControl.edit.SetFixedWidth( editWidth1 );
   BackgroundLow_NumericControl.SetToolTip( "<p>Lower bound of the set of background pixels. Background reference "
      "pixels below this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundLow_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   BackgroundHigh_NumericControl.label.SetText( "Upper limit:" );
   BackgroundHigh_NumericControl.label.SetFixedWidth( labelWidth1 );
   BackgroundHigh_NumericControl.slider.SetRange( 0, 100 );
   BackgroundHigh_NumericControl.slider.SetScaledMinWidth( 200 );
   BackgroundHigh_NumericControl.SetReal();
   BackgroundHigh_NumericControl.SetRange( TheCCBackgroundHighParameter->MinimumValue(), TheCCBackgroundHighParameter->MaximumValue() );
   BackgroundHigh_NumericControl.SetPrecision( TheCCBackgroundHighParameter->Precision() );
   BackgroundHigh_NumericControl.edit.SetFixedWidth( editWidth1 );
   BackgroundHigh_NumericControl.SetToolTip( "<p>Upper bound of the set of background pixels. Background reference "
      "pixels above this value will be rejected for calculation of mean background levels.</p>" );
   BackgroundHigh_NumericControl.OnValueUpdated( (NumericEdit::value_event_handler)&ColorCalibrationInterface::__EditValueUpdated, w );

   //

   BackgroundROI_GroupBox.SetTitle( "Region of Interest" );
   BackgroundROI_GroupBox.EnableTitleCheckBox();
   BackgroundROI_GroupBox.OnCheck( (GroupBox::check_event_handler)&ColorCalibrationInterface::__GroupBoxCheck, w );

   const char* backgroundROIX0ToolTip = "<p>X pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIX0_Label.SetText( "Left:" );
   BackgroundROIX0_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   BackgroundROIX0_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIX0_Label.SetToolTip( backgroundROIX0ToolTip );

   BackgroundROIX0_SpinBox.SetRange( 0, int_max );
   BackgroundROIX0_SpinBox.SetToolTip( backgroundROIX0ToolTip );
   BackgroundROIX0_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   const char* backgroundROIY0ToolTip = "<p>Y pixel coordinate of the upper-left corner of the ROI, background reference.</p>";

   BackgroundROIY0_Label.SetText( "Top:" );
   BackgroundROIY0_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIY0_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIY0_Label.SetToolTip( backgroundROIY0ToolTip );

   BackgroundROIY0_SpinBox.SetRange( 0, int_max );
   BackgroundROIY0_SpinBox.SetToolTip( backgroundROIY0ToolTip );
   BackgroundROIY0_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   BackgroundROIRow1_Sizer.SetSpacing( 4 );
   BackgroundROIRow1_Sizer.Add( BackgroundROIX0_Label );
   BackgroundROIRow1_Sizer.Add( BackgroundROIX0_SpinBox );
   BackgroundROIRow1_Sizer.Add( BackgroundROIY0_Label );
   BackgroundROIRow1_Sizer.Add( BackgroundROIY0_SpinBox );
   BackgroundROIRow1_Sizer.AddStretch();

   const char* backgroundROIWidthToolTip = "<p>Width of the ROI in pixels, background reference.</p>";

   BackgroundROIWidth_Label.SetText( "Width:" );
   BackgroundROIWidth_Label.SetFixedWidth( labelWidth1 - w.LogicalPixelsToPhysical( 6 + DELTA_FRAME ) );
   BackgroundROIWidth_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIWidth_Label.SetToolTip( backgroundROIWidthToolTip );

   BackgroundROIWidth_SpinBox.SetRange( 0, int_max );
   BackgroundROIWidth_SpinBox.SetToolTip( backgroundROIWidthToolTip );
   BackgroundROIWidth_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   const char* backgroundROIHeightToolTip = "<p>Height of the ROI in pixels, background reference.</p>";

   BackgroundROIHeight_Label.SetText( "Height:" );
   BackgroundROIHeight_Label.SetFixedWidth( labelWidth2 );
   BackgroundROIHeight_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
   BackgroundROIHeight_Label.SetToolTip( backgroundROIHeightToolTip );

   BackgroundROIHeight_SpinBox.SetRange( 0, int_max );
   BackgroundROIHeight_SpinBox.SetToolTip( backgroundROIHeightToolTip );
   BackgroundROIHeight_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&ColorCalibrationInterface::__SpinValueUpdated, w );

   BackgroundROISelectPreview_Button.SetText( "From Preview" );
   BackgroundROISelectPreview_Button.SetToolTip( "<p>Import ROI coordinates from an existing preview, background reference.</p>" );
   BackgroundROISelectPreview_Button.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   BackgroundROIRow2_Sizer.SetSpacing( 4 );
   BackgroundROIRow2_Sizer.Add( BackgroundROIWidth_Label );
   BackgroundROIRow2_Sizer.Add( BackgroundROIWidth_SpinBox );
   BackgroundROIRow2_Sizer.Add( BackgroundROIHeight_Label );
   BackgroundROIRow2_Sizer.Add( BackgroundROIHeight_SpinBox );
   BackgroundROIRow2_Sizer.AddSpacing( 12 );
   BackgroundROIRow2_Sizer.Add( BackgroundROISelectPreview_Button );
   BackgroundROIRow2_Sizer.AddStretch();

   BackgroundROI_Sizer.SetMargin( 6 );
   BackgroundROI_Sizer.SetSpacing( 4 );
   BackgroundROI_Sizer.Add( BackgroundROIRow1_Sizer );
   BackgroundROI_Sizer.Add( BackgroundROIRow2_Sizer );

   BackgroundROI_GroupBox.SetSizer( BackgroundROI_Sizer );

   //

   OutputBackgroundReferenceMask_CheckBox.SetText( "Output background reference mask" );
   OutputBackgroundReferenceMask_CheckBox.SetToolTip( "<p>If this option is selected, ColorCalibration will "
      "create a new image window with a <i>background reference mask</i>.</p>"
      "<p>A background reference mask is white for pixels in the background reference image that have been "
      "used to calculate mean background levels, black anywhere else. You can use this mask to check whether the "
      "<i>Lower limit</i> and <i>Upper limit</i> parameters define a suitable range of values to select the "
      "pixels that you intend to use as background reference.</p>" );
   OutputBackgroundReferenceMask_CheckBox.OnClick( (Button::click_event_handler)&ColorCalibrationInterface::__Click, w );

   OutputBackgroundReferenceMask_Sizer.AddUnscaledSpacing( labelWidth1 + ui4 );
   OutputBackgroundReferenceMask_Sizer.Add( OutputBackgroundReferenceMask_CheckBox );
   OutputBackgroundReferenceMask_Sizer.AddStretch();

   //

   BackgroundReference_Sizer.SetSpacing( 4 );
   BackgroundReference_Sizer.Add( BackgroundReferenceView_Sizer );
   BackgroundReference_Sizer.Add( BackgroundLow_NumericControl );
   BackgroundReference_Sizer.Add( BackgroundHigh_NumericControl );
   BackgroundReference_Sizer.Add( BackgroundROI_GroupBox );
   BackgroundReference_Sizer.Add( OutputBackgroundReferenceMask_Sizer );

   BackgroundReference_Control.SetSizer( BackgroundReference_Sizer );

   //

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( WhiteReference_SectionBar );
   Global_Sizer.Add( WhiteReference_Control );
   Global_Sizer.Add( BackgroundReference_SectionBar );
   Global_Sizer.Add( BackgroundReference_Control );

   //

   w.SetSizer( Global_Sizer );
   w.AdjustToContents();
   w.SetFixedSize();

   /*
   UpdateRealTime_Timer.SetSingleShot();
   UpdateRealTime_Timer.SetInterval( 0.040 );
   UpdateRealTime_Timer.OnTimer( (Timer::timer_event_handler)&ColorCalibrationInterface::__UpdateRealTime_Timer, w );
   */
}
Exemplo n.º 25
0
RescaleCIEYAction::RescaleCIEYAction() :
Action( "Image > Rescale > Rescale CIE Y Component", Bitmap( RescaleLumActionIcon_XPM ) )
{
}
void AdaptiveStretchCurveGraphInterface::GenerateGraphGrid()
{
   pcl::Font font( m_fontFace );
   font.SetPixelSize( m_fontSize );

   int labelHeight = font.TightBoundingRect( "123" ).Height();
   int labelSeparation = font.Width( '-' );
   int xLabelHeight = labelHeight + labelSeparation;
   int yLabelWidth = font.Width( "1.0" ) + labelSeparation;

   m_curveRect = Rect( m_margin + yLabelWidth + m_tickSize,
                       m_margin + m_tickSize,
                       m_width  - m_margin - m_tickSize,
                       m_height - m_margin - xLabelHeight - m_tickSize );

   if ( m_gridBitmap.IsNull() )
      m_gridBitmap = Bitmap( m_width, m_height );

   m_gridBitmap.Fill( m_backgroundColor );

   Graphics G( m_gridBitmap );

   G.SetPen( m_axisColor );
   G.StrokeRect( m_curveRect );

   G.SetFont( font );

   // Plot horizontal axes + vertical grid
   for ( int w = 0; w <= 100; w += 10 )
   {
      double f = w/100.0;
      int x = RoundI( m_curveRect.x0 + f*(m_curveRect.Width() - 1) );
      G.DrawLine( x, m_curveRect.y0-m_tickSize, x, m_curveRect.y0 );
      G.DrawLine( x, m_curveRect.y1, x, m_curveRect.y1+m_tickSize );
      G.DrawText( x - labelHeight/2, m_height-m_margin, String().Format( "%.1f", f ) );
      if ( w > 0 && w < 100 )
      {
         G.SetPen( m_gridColor );
         G.DrawLine( x, m_curveRect.y0+1, x, m_curveRect.y1-2 );
         G.SetPen( m_axisColor );
      }
   }

   // Plot vertical axes + horizontal grid
   for ( int h = 0; h <= 100; h += 10 )
   {
      double f = h/100.0;
      int y = RoundI( m_curveRect.y1 - 1 - f*(m_curveRect.Height() - 1) );
      G.DrawLine( m_curveRect.x0-m_tickSize, y, m_curveRect.x0, y );
      G.DrawLine( m_curveRect.x1, y, m_curveRect.x1+m_tickSize, y );
      G.DrawText( m_curveRect.x0-m_tickSize-yLabelWidth, y+labelHeight/2, String().Format( "%.1f", f ) );
      if ( h > 0 && h < 100 )
      {
         G.SetPen( m_gridColor );
         G.DrawLine( m_curveRect.x0+1, y, m_curveRect.x1-2, y );
         G.SetPen( m_axisColor );
      }
   }

   G.EndPaint();
}
Exemplo n.º 27
0
RescaleRGBIndividualAction::RescaleRGBIndividualAction() :
Action( "Image > Rescale > Rescale Individual RGB/K Channels", Bitmap( RescaleRGBActionIcon_XPM ) )
{
}
Exemplo n.º 28
0
StarGeneratorInterface::GUIData::GUIData( StarGeneratorInterface& w )
{
   pcl::Font fnt = w.Font();
   int labelWidth1 = fnt.Width( String( "Nonlinear target minimum:" ) + "M" );
   int editWidth1 = fnt.Width( String( '0',  8 ) );
   int editWidth2 = fnt.Width( String( '0', 12 ) );

   //

   const char* starDatabaseToolTip = "<p>Star database file in PixInsight binary format.</p>"
      "<p>Databases are not included with standard PixInsight distributions. For available star databases, please see:</p>"
      "<p>http://pixinsight.com/download/</p>";

   StarDatabase_Label.SetText( "Star database:" );

   StarDatabase_Edit.SetToolTip( starDatabaseToolTip );
   StarDatabase_Edit.OnEditCompleted( (Edit::edit_event_handler)&StarGeneratorInterface::__EditCompleted, w );

   StarDatabase_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-file.png" ) ) );
   StarDatabase_ToolButton.SetScaledFixedSize( 20, 20 );
   StarDatabase_ToolButton.SetToolTip( starDatabaseToolTip );
   StarDatabase_ToolButton.OnClick( (Button::click_event_handler)&StarGeneratorInterface::__Button_Clicked, w );

   StarDatabase_Sizer.SetSpacing( 4 );
   StarDatabase_Sizer.Add( StarDatabase_Edit, 100 );
   StarDatabase_Sizer.Add( StarDatabase_ToolButton );

   //

   RA_Label.SetText( "Right ascension (hms):" );
   RA_Label.SetMinWidth( labelWidth1 );
   RA_Label.SetToolTip( "<p>Projection center, right ascension.</p>" );
   RA_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   RAHours_SpinBox.SetRange( 0, 24 );
   RAHours_SpinBox.SetFixedWidth( editWidth1 );
   RAHours_SpinBox.SetToolTip( "<p>Projection center, right ascension hours [0,23].</p>" );
   RAHours_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   RAMins_SpinBox.SetRange( 0, 60 );
   RAMins_SpinBox.SetFixedWidth( editWidth1 );
   RAMins_SpinBox.SetToolTip( "<p>Projection center, right ascension minutes [0,59].</p>" );
   RAMins_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   RASecs_NumericEdit.label.Hide();
   RASecs_NumericEdit.SetReal();
   RASecs_NumericEdit.SetRange( 0, 60 );
   RASecs_NumericEdit.SetPrecision( 3 );
   RASecs_NumericEdit.edit.SetFixedWidth( editWidth1 );
   RASecs_NumericEdit.SetToolTip( "<p>Projection center, right ascension seconds [0,60[.</p>" );
   RASecs_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );

   RA_Sizer.SetSpacing( 4 );
   RA_Sizer.Add( RA_Label );
   RA_Sizer.Add( RAHours_SpinBox );
   RA_Sizer.Add( RAMins_SpinBox );
   RA_Sizer.Add( RASecs_NumericEdit );
   RA_Sizer.AddStretch();

   //

   Dec_Label.SetText( "Declination (dms):" );
   Dec_Label.SetMinWidth( labelWidth1 );
   Dec_Label.SetToolTip( "<p>Projection center, declination.</p>" );
   Dec_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   DecDegs_SpinBox.SetRange( -90, +90 );
   DecDegs_SpinBox.SetFixedWidth( editWidth1 );
   DecDegs_SpinBox.SetToolTip( "<p>Projection center, declination degrees [-90,+90].</p>" );
   DecDegs_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   DecMins_SpinBox.SetRange( 0, 60 );
   DecMins_SpinBox.SetFixedWidth( editWidth1 );
   DecMins_SpinBox.SetToolTip( "<p>Projection center, declination arcminutes [0,59].</p>" );
   DecMins_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   DecSecs_NumericEdit.label.Hide();
   DecSecs_NumericEdit.SetReal();
   DecSecs_NumericEdit.SetRange( 0, 60 );
   DecSecs_NumericEdit.SetPrecision( 2 );
   DecSecs_NumericEdit.edit.SetFixedWidth( editWidth1 );
   DecSecs_NumericEdit.SetToolTip( "<p>Projection center, declination arcseconds [0,60[.</p>" );
   DecSecs_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );

   DecSouth_CheckBox.SetText( "S" );
   DecSouth_CheckBox.SetToolTip( "<p>South declination.</p>");
   DecSouth_CheckBox.OnClick( (Button::click_event_handler)&StarGeneratorInterface::__Button_Clicked, w );

   Dec_Sizer.SetSpacing( 4 );
   Dec_Sizer.Add( Dec_Label );
   Dec_Sizer.Add( DecDegs_SpinBox );
   Dec_Sizer.Add( DecMins_SpinBox );
   Dec_Sizer.Add( DecSecs_NumericEdit );
   Dec_Sizer.Add( DecSouth_CheckBox );
   Dec_Sizer.AddStretch();

   //

   Epoch_Label.SetText( "Epoch (ymd):" );
   Epoch_Label.SetMinWidth( labelWidth1 );
   Epoch_Label.SetToolTip( "<p>Epoch of the rendition image. StarGenerator will apply star proper motions "
                           "to translate the positions of all projected stars according to the specified "
                           "epoch date.</p>" );
   Epoch_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   EpochYear_SpinBox.SetRange( 1000, 3000 );
   EpochYear_SpinBox.SetFixedWidth( editWidth1 );
   EpochYear_SpinBox.SetToolTip( "<p>Rendition epoch, year [1000,3000].</p>" );
   EpochYear_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   EpochMonth_SpinBox.SetRange( 1, 12 );
   EpochMonth_SpinBox.SetFixedWidth( editWidth1 );
   EpochMonth_SpinBox.SetToolTip( "<p>Rendition epoch, month [1,12].</p>" );
   EpochMonth_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   EpochDay_SpinBox.SetRange( 0, 31 );
   EpochDay_SpinBox.SetFixedWidth( editWidth1 );
   EpochDay_SpinBox.SetToolTip( "<p>Rendition epoch, day [0,31].</p>" );
   EpochDay_SpinBox.OnValueUpdated( (SpinBox::value_event_handler)&StarGeneratorInterface::__IntegerValueUpdated, w );

   Epoch_Sizer.SetSpacing( 4 );
   Epoch_Sizer.Add( Epoch_Label );
   Epoch_Sizer.Add( EpochYear_SpinBox );
   Epoch_Sizer.Add( EpochMonth_SpinBox );
   Epoch_Sizer.Add( EpochDay_SpinBox );
   Epoch_Sizer.AddStretch();

   //

   const char* projectionSystemToolTip = "<p>Projection System</p>"
      "<p><b>Conformal projections</b> are <i>angle preserving</i> projection systems. The existing angular "
      "distance between two objects on the sky is preserved on the projected representation. This allows for "
      "projection of large fields of view with minimal distortion. The conformal projections are selected "
      "automatically as a function of the central declination:</p>"
      "<ul>"
      "<li>Stereographic projection for |&delta;| &ge; 70&deg;</li>"
      "<li>Mercator cylindrical projection for |&delta;| &le; 20&deg;</li>"
      "<li>Lambert conformal conic projection for 20&deg; &lt; |&delta;| &lt; 70&deg;</li>"
      "</ul>"
      "<p><b>Gnomonic projection</b> is a <i>nonconformal</i> projection system with two main advantages: it "
      "is valid for all central declinations, and it represents the projection of the sky through a spherical "
      "lens over a flat focal plane. Thus, gnomonic projection reproduces the image formed on the <i>flat</i> "
      "focal plane of an ideal telescope (neglecting geometrical aberrations, field curvature, and distortions). "
      "This is the default projection system.</p>";

   ProjectionSystem_Label.SetText( "Projection:" );
   ProjectionSystem_Label.SetToolTip( projectionSystemToolTip );
   ProjectionSystem_Label.SetMinWidth( labelWidth1 );
   ProjectionSystem_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   ProjectionSystem_ComboBox.AddItem( "Conformal" );
   ProjectionSystem_ComboBox.AddItem( "Gnomonic" );
   ProjectionSystem_ComboBox.SetToolTip( projectionSystemToolTip );
   ProjectionSystem_ComboBox.OnItemSelected( (ComboBox::item_event_handler)&StarGeneratorInterface::__ItemSelected, w );

   ProjectionSystem_Sizer.SetSpacing( 4 );
   ProjectionSystem_Sizer.Add( ProjectionSystem_Label );
   ProjectionSystem_Sizer.Add( ProjectionSystem_ComboBox );
   ProjectionSystem_Sizer.AddStretch();

   //

   FocalLength_NumericEdit.label.SetText( "Focal length (mm):" );
   FocalLength_NumericEdit.label.SetFixedWidth( labelWidth1 );
   FocalLength_NumericEdit.SetReal();
   FocalLength_NumericEdit.SetRange( TheSGFocalLengthParameter->MinimumValue(), TheSGFocalLengthParameter->MaximumValue() );
   FocalLength_NumericEdit.SetPrecision( TheSGFocalLengthParameter->Precision() );
   FocalLength_NumericEdit.edit.SetFixedWidth( editWidth2 );
   FocalLength_NumericEdit.SetToolTip( "<p>Focal length in millimeters.</p>" );
   FocalLength_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   FocalLength_NumericEdit.sizer.AddStretch();

   PixelSize_NumericEdit.label.SetText( "Pixel size (um):" );
   PixelSize_NumericEdit.label.SetFixedWidth( labelWidth1 );
   PixelSize_NumericEdit.SetReal();
   PixelSize_NumericEdit.SetRange( TheSGPixelSizeParameter->MinimumValue(), TheSGPixelSizeParameter->MaximumValue() );
   PixelSize_NumericEdit.SetPrecision( TheSGPixelSizeParameter->Precision() );
   PixelSize_NumericEdit.edit.SetFixedWidth( editWidth2 );
   PixelSize_NumericEdit.SetToolTip( "<p>Pixel size in micrometers.</p>" );
   PixelSize_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   PixelSize_NumericEdit.sizer.AddStretch();

   SensorWidth_NumericEdit.label.SetText( "Sensor width (px):" );
   SensorWidth_NumericEdit.label.SetFixedWidth( labelWidth1 );
   SensorWidth_NumericEdit.SetInteger();
   SensorWidth_NumericEdit.SetRange( TheSGSensorWidthParameter->MinimumValue(), TheSGSensorWidthParameter->MaximumValue() );
   SensorWidth_NumericEdit.edit.SetFixedWidth( editWidth2 );
   SensorWidth_NumericEdit.SetToolTip( "<p>Sensor width in pixels.</p>" );
   SensorWidth_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   SensorWidth_NumericEdit.sizer.AddStretch();

   SensorHeight_NumericEdit.label.SetText( "Sensor height (px):" );
   SensorHeight_NumericEdit.label.SetFixedWidth( labelWidth1 );
   SensorHeight_NumericEdit.SetInteger();
   SensorHeight_NumericEdit.SetRange( TheSGSensorHeightParameter->MinimumValue(), TheSGSensorHeightParameter->MaximumValue() );
   SensorHeight_NumericEdit.edit.SetFixedWidth( editWidth2 );
   SensorHeight_NumericEdit.SetToolTip( "<p>Sensor height in pixels.</p>" );
   SensorHeight_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   SensorHeight_NumericEdit.sizer.AddStretch();

   LimitMagnitude_NumericEdit.label.SetText( "Limit magnitude:" );
   LimitMagnitude_NumericEdit.label.SetFixedWidth( labelWidth1 );
   LimitMagnitude_NumericEdit.SetReal();
   LimitMagnitude_NumericEdit.SetRange( TheSGLimitMagnitudeParameter->MinimumValue(), TheSGLimitMagnitudeParameter->MaximumValue() );
   LimitMagnitude_NumericEdit.SetPrecision( TheSGLimitMagnitudeParameter->Precision() );
   LimitMagnitude_NumericEdit.edit.SetFixedWidth( editWidth2 );
   LimitMagnitude_NumericEdit.SetToolTip( "<p>Highest magnitude of projected stars.</p>" );
   LimitMagnitude_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   LimitMagnitude_NumericEdit.sizer.AddStretch();

   const char* outputModeToolTip = "<p>Output Mode</p>"
      "<p>In <b>Render Image</b> mode, all stars found within the output coordinate range will be rendered as "
      "Gaussian profiles on a newly created image. The image rendition will be available as a new image window.</p>"
      "<p>In <b>Generate CSV File</b> mode, a comma-separated value (CSV) file will be generated encoded in 8-bit ASCII format. "
      "The first line in the output CSV file specifies the projection dimensions (width,height), and subsequent lines provide "
      "star data (xPos,yPos,brightness). Lines are separated by newline characters (0x0A).</p>";

   OutputMode_Label.SetText( "Output mode:" );
   OutputMode_Label.SetToolTip( outputModeToolTip );
   OutputMode_Label.SetMinWidth( labelWidth1 );
   OutputMode_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );

   OutputMode_ComboBox.AddItem( "Render Image" );
   OutputMode_ComboBox.AddItem( "Generate CSV File" );
   OutputMode_ComboBox.SetToolTip( outputModeToolTip );
   OutputMode_ComboBox.OnItemSelected( (ComboBox::item_event_handler)&StarGeneratorInterface::__ItemSelected, w );

   OutputMode_Sizer.SetSpacing( 4 );
   OutputMode_Sizer.Add( OutputMode_Label );
   OutputMode_Sizer.Add( OutputMode_ComboBox );
   OutputMode_Sizer.AddStretch();

   const char* outputFileToolTip = "<p>Select an output file in CSV format.</p>";

   OutputFile_Label.SetText( "Output file:" );

   OutputFile_Edit.SetToolTip( outputFileToolTip );
   OutputFile_Edit.OnEditCompleted( (Edit::edit_event_handler)&StarGeneratorInterface::__EditCompleted, w );

   OutputFile_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-file.png" ) ) );
   OutputFile_ToolButton.SetScaledFixedSize( 20, 20 );
   OutputFile_ToolButton.SetToolTip( outputFileToolTip );
   OutputFile_ToolButton.OnClick( (Button::click_event_handler)&StarGeneratorInterface::__Button_Clicked, w );

   OutputFile_Sizer.SetSpacing( 4 );
   OutputFile_Sizer.Add( OutputFile_Edit, 100 );
   OutputFile_Sizer.Add( OutputFile_ToolButton );

   StarFWHM_NumericEdit.label.SetText( "Star FWHM (\"):" );
   StarFWHM_NumericEdit.label.SetFixedWidth( labelWidth1 );
   StarFWHM_NumericEdit.SetReal();
   StarFWHM_NumericEdit.SetRange( TheSGStarFWHMParameter->MinimumValue(), TheSGStarFWHMParameter->MaximumValue() );
   StarFWHM_NumericEdit.SetPrecision( TheSGStarFWHMParameter->Precision() );
   StarFWHM_NumericEdit.edit.SetFixedWidth( editWidth2 );
   StarFWHM_NumericEdit.SetToolTip( "<p>Star FWHM in arcseconds.</p>" );
   StarFWHM_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   StarFWHM_NumericEdit.sizer.AddStretch();

   Nonlinear_CheckBox.SetText( "Nonlinear" );
   Nonlinear_CheckBox.SetToolTip( "<p>If this option is enabled, a nonlinear stretch will be applied to the "
      "output image to match the specified <i>minimum sample value</i> (see next parameter).</p>"
      "<p>If this option is disabled, a linear image will be generated: the output image will be strictly a "
      "linear function of star brightness. Note that linear renditions employ extremely large dynamic ranges "
      "(for example, more than 10<sup>8</sup> discrete pixel values are required to render a star of the 16th "
      "magnitude).</p>" );
   Nonlinear_CheckBox.OnClick( (Button::click_event_handler)&StarGeneratorInterface::__Button_Clicked, w );

   Nonlinear_Sizer.AddUnscaledSpacing( labelWidth1 + w.LogicalPixelsToPhysical( 4 ) );
   Nonlinear_Sizer.Add( Nonlinear_CheckBox );
   Nonlinear_Sizer.AddStretch();

   TargetMinimumValue_NumericEdit.label.SetText( "Nonlinear target minimum:" );
   TargetMinimumValue_NumericEdit.label.SetFixedWidth( labelWidth1 );
   TargetMinimumValue_NumericEdit.SetReal();
   TargetMinimumValue_NumericEdit.SetRange( TheSGTargetMinimumValueParameter->MinimumValue(), TheSGTargetMinimumValueParameter->MaximumValue() );
   TargetMinimumValue_NumericEdit.SetPrecision( TheSGTargetMinimumValueParameter->Precision() );
   TargetMinimumValue_NumericEdit.edit.SetFixedWidth( editWidth2 );
   TargetMinimumValue_NumericEdit.SetToolTip( "<p>Target minimum sample value when nonlinear output is selected.</p>" );
   TargetMinimumValue_NumericEdit.OnValueUpdated( (NumericEdit::value_event_handler)&StarGeneratorInterface::__RealValueUpdated, w );
   TargetMinimumValue_NumericEdit.sizer.AddStretch();

   //

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( StarDatabase_Label );
   Global_Sizer.Add( StarDatabase_Sizer );
   Global_Sizer.Add( RA_Sizer );
   Global_Sizer.Add( Dec_Sizer );
   Global_Sizer.Add( Epoch_Sizer );
   Global_Sizer.Add( ProjectionSystem_Sizer );
   Global_Sizer.Add( FocalLength_NumericEdit );
   Global_Sizer.Add( PixelSize_NumericEdit );
   Global_Sizer.Add( SensorWidth_NumericEdit );
   Global_Sizer.Add( SensorHeight_NumericEdit );
   Global_Sizer.Add( LimitMagnitude_NumericEdit );
   Global_Sizer.Add( OutputMode_Sizer );
   Global_Sizer.Add( OutputFile_Sizer );
   Global_Sizer.Add( StarFWHM_NumericEdit );
   Global_Sizer.Add( Nonlinear_Sizer );
   Global_Sizer.Add( TargetMinimumValue_NumericEdit );

   w.SetSizer( Global_Sizer );
   w.AdjustToContents();
   w.SetFixedSize();
}
Exemplo n.º 29
0
ChannelCombinationInterface::GUIData::GUIData( ChannelCombinationInterface& w )
{
   pcl::Font fnt = w.Font();
   int chEditWidth = fnt.Width( String( 'M', 35 ) );
   int tgtLabelWidth = fnt.Width( "Target:" ) + 4;

   //

   RGB_RadioButton.SetText( "RGB" );
   RGB_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   HSV_RadioButton.SetText( "HSV" );
   HSV_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   HSI_RadioButton.SetText( "HSI" );
   HSI_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   ColorSpaceLeft_Sizer.Add( RGB_RadioButton );
   ColorSpaceLeft_Sizer.Add( HSV_RadioButton );
   ColorSpaceLeft_Sizer.Add( HSI_RadioButton );

   //

   CIEXYZ_RadioButton.SetText( "CIE XYZ" );
   CIEXYZ_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   CIELab_RadioButton.SetText( "CIE L*a*b*" );
   CIELab_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   CIELch_RadioButton.SetText( "CIE L*c*h*" );
   CIELch_RadioButton.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__ColorSpace_Click, w );

   ColorSpaceRight_Sizer.Add( CIEXYZ_RadioButton );
   ColorSpaceRight_Sizer.Add( CIELab_RadioButton );
   ColorSpaceRight_Sizer.Add( CIELch_RadioButton );

   //

   ColorSpace_Sizer.SetMargin( 6 );
   ColorSpace_Sizer.SetSpacing( 10 );
   ColorSpace_Sizer.Add( ColorSpaceLeft_Sizer );
   ColorSpace_Sizer.Add( ColorSpaceRight_Sizer );

   ColorSpace_GroupBox.SetTitle( "Color Space" );
   ColorSpace_GroupBox.SetSizer( ColorSpace_Sizer );
   ColorSpace_GroupBox.AdjustToContents();

   //

   C0_CheckBox.SetFixedWidth( tgtLabelWidth );
   C0_CheckBox.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__Channel_Click, w );

   C0_Edit.SetMinWidth( chEditWidth );
   C0_Edit.OnGetFocus( (Control::event_handler)&ChannelCombinationInterface::__ChannelId_GetFocus, w );
   C0_Edit.OnEditCompleted( (Edit::edit_event_handler)&ChannelCombinationInterface::__ChannelId_EditCompleted, w );

   C0_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   C0_ToolButton.SetScaledFixedSize( 20, 20 );
   C0_ToolButton.SetToolTip( "Select channel #0 source image" );
   C0_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelCombinationInterface::__Channel_SelectSource_Click, w );

   C0_Sizer.Add( C0_CheckBox );
   C0_Sizer.Add( C0_Edit, 100 );
   C0_Sizer.AddSpacing( 4 );
   C0_Sizer.Add( C0_ToolButton );

   //

   C1_CheckBox.SetFixedWidth( tgtLabelWidth );
   C1_CheckBox.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__Channel_Click, w );

   C1_Edit.SetMinWidth( chEditWidth );
   C1_Edit.OnGetFocus( (Control::event_handler)&ChannelCombinationInterface::__ChannelId_GetFocus, w );
   C1_Edit.OnEditCompleted( (Edit::edit_event_handler)&ChannelCombinationInterface::__ChannelId_EditCompleted, w );

   C1_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   C1_ToolButton.SetScaledFixedSize( 20, 20 );
   C1_ToolButton.SetToolTip( "Select channel #1 source image" );
   C1_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelCombinationInterface::__Channel_SelectSource_Click, w );

   C1_Sizer.Add( C1_CheckBox );
   C1_Sizer.Add( C1_Edit, 100 );
   C1_Sizer.AddSpacing( 4 );
   C1_Sizer.Add( C1_ToolButton );

   //

   C2_CheckBox.SetFixedWidth( tgtLabelWidth );
   C2_CheckBox.OnClick( (pcl::Button::click_event_handler)&ChannelCombinationInterface::__Channel_Click, w );

   C2_Edit.SetMinWidth( chEditWidth );
   C2_Edit.OnGetFocus( (Control::event_handler)&ChannelCombinationInterface::__ChannelId_GetFocus, w );
   C2_Edit.OnEditCompleted( (Edit::edit_event_handler)&ChannelCombinationInterface::__ChannelId_EditCompleted, w );

   C2_ToolButton.SetIcon( Bitmap( w.ScaledResource( ":/icons/select-view.png" ) ) );
   C2_ToolButton.SetScaledFixedSize( 20, 20 );
   C2_ToolButton.SetToolTip( "Select channel #2 source image" );
   C2_ToolButton.OnClick( (ToolButton::click_event_handler)&ChannelCombinationInterface::__Channel_SelectSource_Click, w );

   C2_Sizer.Add( C2_CheckBox );
   C2_Sizer.Add( C2_Edit, 100 );
   C2_Sizer.AddSpacing( 4 );
   C2_Sizer.Add( C2_ToolButton );

   //

   TargetImage_Label.SetText( "Target:" );
   TargetImage_Label.SetFixedWidth( tgtLabelWidth );
   TargetImage_Label.SetTextAlignment( TextAlign::Left|TextAlign::VertCenter );
   TargetImage_Label.SetToolTip( "<p>Peek an existing view to automatically select source channel images with "
                                 "suffixes corresponding to the current color space (for example, _R, _G and _B "
                                 "suffixes for the RGB color space).</p>" );

   TargetImage_ViewList.OnViewSelected( (ViewList::view_event_handler)&ChannelCombinationInterface::__TargetImage_ViewSelected, w );

   //TargetImage_Sizer.SetSpacing( 4 );
   TargetImage_Sizer.Add( TargetImage_Label );
   TargetImage_Sizer.Add( TargetImage_ViewList, 100 );

   //

   Channels_Sizer.SetMargin( 6 );
   Channels_Sizer.SetSpacing( 4 );
   Channels_Sizer.Add( C0_Sizer );
   Channels_Sizer.Add( C1_Sizer );
   Channels_Sizer.Add( C2_Sizer );
   Channels_Sizer.Add( TargetImage_Sizer );

   Channels_GroupBox.SetTitle( "Channels / Source Images" );
   Channels_GroupBox.SetSizer( Channels_Sizer );
   Channels_GroupBox.AdjustToContents();

   //

   C0_CheckBox.SetFixedWidth();
   C1_CheckBox.SetFixedWidth();
   C2_CheckBox.SetFixedWidth();

   TargetImage_Label.SetFixedWidth( C0_CheckBox.Width() );

   //

   int minH = Min( ColorSpace_GroupBox.Height(), Channels_GroupBox.Height() );
   ColorSpace_GroupBox.SetMinHeight( minH );
   Channels_GroupBox.SetMinHeight( minH );

   //

   Global_Sizer.SetMargin( 8 );
   Global_Sizer.SetSpacing( 6 );
   Global_Sizer.Add( ColorSpace_GroupBox );
   Global_Sizer.Add( Channels_GroupBox );

   w.SetSizer( Global_Sizer );
   w.AdjustToContents();
   w.SetFixedSize();
}
Exemplo n.º 30
0
Bitmap ComboBox::ItemIcon( int idx ) const
{
   return Bitmap( (*API->ComboBox->GetComboBoxItemIcon)( handle, idx ) );
}