Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
malleor committed Feb 23, 2012
0 parents commit 7488dcc
Show file tree
Hide file tree
Showing 70 changed files with 17,660 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
relre:.*\.(idb|pdb|user|ilk|rar|old)
relre:.*\.(obj|exe|dll)
relre:.*\.(suo|ncb)
relre:.*\.(pch|dep|exp)
relre:.*\.(tlh|tli|log)
relre:.*\.(res|aps)

syntax: regexp
.*\.(tlog)
44 changes: 44 additions & 0 deletions Calculation2D.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{414A41D2-9FF0-4282-98E6-72B308485C32}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "calc2d", "proj\calc2d\calc2d.vcxproj", "{51B17ACA-BAC0-408E-8145-B366393F0734}"
ProjectSection(ProjectDependencies) = postProject
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE} = {81764A51-4B0F-4310-ACD1-059BFC9BEDDE}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcalc2d", "proj\libcalc2d\Calculation2D.vcxproj", "{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{51B17ACA-BAC0-408E-8145-B366393F0734}.Debug|Win32.ActiveCfg = Debug|Win32
{51B17ACA-BAC0-408E-8145-B366393F0734}.Debug|Win32.Build.0 = Debug|Win32
{51B17ACA-BAC0-408E-8145-B366393F0734}.Debug|x64.ActiveCfg = Debug|x64
{51B17ACA-BAC0-408E-8145-B366393F0734}.Debug|x64.Build.0 = Debug|x64
{51B17ACA-BAC0-408E-8145-B366393F0734}.Release|Win32.ActiveCfg = Release|Win32
{51B17ACA-BAC0-408E-8145-B366393F0734}.Release|Win32.Build.0 = Release|Win32
{51B17ACA-BAC0-408E-8145-B366393F0734}.Release|x64.ActiveCfg = Release|x64
{51B17ACA-BAC0-408E-8145-B366393F0734}.Release|x64.Build.0 = Release|x64
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Debug|Win32.ActiveCfg = Debug|Win32
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Debug|Win32.Build.0 = Debug|Win32
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Debug|x64.ActiveCfg = Debug|x64
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Debug|x64.Build.0 = Debug|x64
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Release|Win32.ActiveCfg = Release|Win32
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Release|Win32.Build.0 = Release|Win32
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Release|x64.ActiveCfg = Release|x64
{81764A51-4B0F-4310-ACD1-059BFC9BEDDE}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Calculation2D
**Extensible image processing framework for C++**
***

## Installation

## Quick start

## Features


***
###The MIT License (MIT)

Copyright (c) 2012 OGX|OPTOGRAPHX

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
74 changes: 74 additions & 0 deletions include/interfaces/mmGlobalInterfacesStorage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//******************************************************************************
//******************************************************************************
//
// Global Interfaces Storage class
//
//
// Description: Class with pointers to global interfaces initialized objects.
// It is used for exchange of main interface objects between
// core of the system and other components.
//
//******************************************************************************
//******************************************************************************
#ifndef mmGlobalInterfacesStorageH
#define mmGlobalInterfacesStorageH

#include <log\mmLogSender.h>


////////////////////////////////////////////////////////////////////////////////
/// Namespace for interface initializers.
////////////////////////////////////////////////////////////////////////////////
namespace mmInterfacesStorage
{
//////////////////////////////////////////////////////////////////////////////////
///// Class for storage of pointers into main interfaces classes.
//////////////////////////////////////////////////////////////////////////////////
//class mmGlobalInterfacesStorage: public mmLog::mmLogSender
//{
// private: // members
// ////////////////////////////////////////////////////////////////////////////////
// /// Pointer for private storage of memory manager object.
// ////////////////////////////////////////////////////////////////////////////////
// mmMemory::mmMemoryManagerI* m_psMemoryManager;

// public: // methods
// ////////////////////////////////////////////////////////////////////////////////
// /// This constructor initializes all private members.
// ///
// /// @param[in] p_psMemoryManager pointer to memory manager object.
// /// @param[in] p_psLogReceiver pointer to log object.
// /// @param[in] p_psMainWindow pointer to main window object.
// ////////////////////////////////////////////////////////////////////////////////
// mmGlobalInterfacesStorage( mmMemory::mmMemoryManagerI* p_psMemoryManager, mmLog::mmLogReceiverI* p_psLogReceiver );

// ////////////////////////////////////////////////////////////////////////////////
// /// Desctructor.
// ////////////////////////////////////////////////////////////////////////////////
// ~mmGlobalInterfacesStorage();

// ////////////////////////////////////////////////////////////////////////////////
// /// Method returns pointer to memory manager object.
// ///
// /// @return pointer to memory manager object
// ////////////////////////////////////////////////////////////////////////////////
// mmMemory::mmMemoryManagerI* GetMemoryManager(void);

// ////////////////////////////////////////////////////////////////////////////////
// /// Method returns pointer to log object.
// ///
// /// @return pointer to log object
// ////////////////////////////////////////////////////////////////////////////////
// mmLog::mmLogReceiverI* GetLogManager(void);

//};
struct mmGlobalInterfacesStorage {
mmGlobalInterfacesStorage( mmLog::mmLogReceiverI* p_psLogReceiver );
mmLog::mmLogReceiverI* GetLogManager(void);
mmLog::mmLogReceiverI* GetLogReceiver(void);
private:
mmLog::mmLogReceiverI* m_psLogReceiver;
};
};

#endif
100 changes: 100 additions & 0 deletions include/interfaces/mmICalcMethod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#pragma once

#include <mmCalcMethod.h>

//******************************************************************************
//******************************************************************************
//
// Simple interface for calculation method
//
// Description: This header defines class mmCalcKernelI for function objects
// which implement operation on a single data block within the image and class
// mmCalcMethodI which offers simple interface to calculation method. It is a
// wrapper for mmImagesCalculationMethodI interface and is meant to be overloaded
// by developer
//
//******************************************************************************
//******************************************************************************

namespace mmImages {
////////////////////////////////////////////////////////////////////////////////
/// Interface representing function object for operation on single data block
////////////////////////////////////////////////////////////////////////////////
class mmCalcKernelI
{
public:
////////////////////////////////////////////////////////////////////////////////
/// Virtual destructor
////////////////////////////////////////////////////////////////////////////////
virtual ~mmCalcKernelI() { }

////////////////////////////////////////////////////////////////////////////////
/// Method executes for every data block in the structure. Internal loop over
/// pixels should be placed here.
///
/// @param[in] p_psImageStructure pointer to images structure,
/// @param[in] p_iCurrentImageID ID number of the current processed image
/// @param[in] p_iFirstRow index of the first row of pixels scheduled for calculation
/// @param[in] p_iRowsCount number of rows scheduled for calculation
////////////////////////////////////////////////////////////////////////////////
virtual void operator()(mmImageI* p_psCurrentImage,
mmInt p_iFirstRow,
mmInt p_iRowsCount) = 0;
};

////////////////////////////////////////////////////////////////////////////////
/// Interface representing calculation method
////////////////////////////////////////////////////////////////////////////////
class mmCalcMethodI: public mmCalcMethod
{
public:
////////////////////////////////////////////////////////////////////////////////
/// Constructor. It invokes the mmCalcMethod class constructor which hides
/// implementation details
////////////////////////////////////////////////////////////////////////////////
mmCalcMethodI(mmLog::mmLogReceiverI *p_psLogReceiver = NULL,
mmString p_sClassName = L"")
:mmCalcMethod(p_psLogReceiver,
p_sClassName) { }

////////////////////////////////////////////////////////////////////////////////
/// Virtual destructor
////////////////////////////////////////////////////////////////////////////////
virtual ~mmCalcMethodI() { }

protected:
////////////////////////////////////////////////////////////////////////////////
/// Method executes for every working thread. Put pixels manipulations code here
////////////////////////////////////////////////////////////////////////////////
virtual bool Calculate() = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method executes once for every image in the structure before the main loop
/// iterating blocks of pixels when using ForEachImage function. Do not use
/// m_psThreadSynchEL for accessing class members in multithread configuration
/// because this function runs always in a single thread.
/// (check mmICalcMethodExt.h for documentation)
///
/// @param[in] p_iCurrentImageID ID number of the current processed image
////////////////////////////////////////////////////////////////////////////////
virtual void ExecBeforeSingleImageCalc(mmInt p_iCurrentImageID) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method executes once for every image in the structure after the main loop
/// iterating blocks of pixels when using ForEachImage function. Do not use
/// m_psThreadSynchEL for accessing class members in multithread configuration
/// because this function runs always in a single thread.
/// (check mmICalcMethodExt.h for documentation)
///
/// @param[in] p_iCurrentImageID ID number of the current processed image
////////////////////////////////////////////////////////////////////////////////
virtual void ExecAfterSingleImageCalc(mmInt p_iCurrentImageID) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method executes once before the Calculate method which allows for setting
/// new parameters values after their modification by the user. Place initialization
/// code here.
////////////////////////////////////////////////////////////////////////////////
virtual void RetrieveParameters() = 0;
};
};
127 changes: 127 additions & 0 deletions include/interfaces/mmICalcMethodExt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#pragma once

#include <interfaces/mmGlobalInterfacesStorage.h>
#include <interfaces/mmIImages.h>
#include <mmXMLIOUtilities.h>

//******************************************************************************
//******************************************************************************
//
// Extension for calculation method interface
//
// Description: This header defines class mmCalcMethodExtI which extends
// calculation method interface in order to simplify usage. It contains a set
// of tool functions for parameters manipulation and iteration through data
// structure in multithread environment. These functions are meant to be used
// by developer rather than overload.
//
//******************************************************************************
//******************************************************************************

namespace mmImages {
////////////////////////////////////////////////////////////////////////////////
/// Forward declaration of mmCalcKernel class
////////////////////////////////////////////////////////////////////////////////
class mmCalcKernelI;

////////////////////////////////////////////////////////////////////////////////
/// Interface representing interface extension for calculation method
////////////////////////////////////////////////////////////////////////////////
class mmCalcMethodExtI
{
public:
////////////////////////////////////////////////////////////////////////////////
/// Virtual destructor
////////////////////////////////////////////////////////////////////////////////
~mmCalcMethodExtI() { }

protected: // methods
////////////////////////////////////////////////////////////////////////////////
/// Method iterates through data structure in order to perform specified operation
/// on every data block. It works in multithread environment and may be executed
/// by multiple threads to manipulate on the same images structure. It should be
/// used inside Calculate function (see mmICalcMethod.h for documentation)
///
/// @param[in] p_psKernel pointer to function object which implements operation
/// executed for every data block in every image
////////////////////////////////////////////////////////////////////////////////
virtual void ForEachImage(mmCalcKernelI* p_psKernel) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method adds new user interface parameter for calculation method
///
/// @param[in] p_sName parameter name which appears as a label in the parameters
/// dialog box
/// @param[in] p_eType parameter type (see mmXMLIOUtilities.h for documentation)
/// @param[in] p_psValue pointer to variable containing default parameter value
/// @param[in] p_bIsOutput flag indicating if the new parameter is input or
/// output for the calculation method
////////////////////////////////////////////////////////////////////////////////
virtual void SetParam(mmString p_sName, mmXML::mmXMLDataType p_eType, void* p_psValue, bool p_bIsOutput = false) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method retrieves information about parameter value.
///
/// @param[in] p_sName parameter name which appears as a label in the parameters
/// dialog box
/// @return pointer to parameter value. It should be assigned to a pointer of
/// the specific type
////////////////////////////////////////////////////////////////////////////////
virtual const void* GetParam(mmString p_sName) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method retrieves information about parameter value.
///
/// @param[in] p_sName parameter name which appears as a label in the parameters
/// dialog box
/// @param[out] p_pValue pointer to a variable where new parameter value should
/// be stored. It should have proper type.
////////////////////////////////////////////////////////////////////////////////
virtual void GetParam(mmString p_sName, void* p_pValue) = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method creates internal parameters structure. It should be called after all
/// SetParam invocations
////////////////////////////////////////////////////////////////////////////////
virtual void UpdateParameters() = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method returns names of all images in the images structure
///
/// @return vector of image names
////////////////////////////////////////////////////////////////////////////////
virtual std::vector<mmString> GetImageNames() = 0;

////////////////////////////////////////////////////////////////////////////////
/// Method returns names of all data layers in the images structure
///
/// @return vector of data layers names
////////////////////////////////////////////////////////////////////////////////
virtual std::vector<mmString> GetDLNames() = 0;

protected: // fields
////////////////////////////////////////////////////////////////////////////////
/// Calculation method parameters. Developer should assign the method name, ID as
/// a GUID and indicate if the method should be executed by multiple threads (default)
////////////////////////////////////////////////////////////////////////////////
mmImages::mmImagesCalculationMethodI::sCalculationMethodParams m_sCMParams;

////////////////////////////////////////////////////////////////////////////////
/// Pointer to images structure. Use to access all loaded data.
////////////////////////////////////////////////////////////////////////////////
mmImages::mmImageStructureI* m_psImageStructure;

////////////////////////////////////////////////////////////////////////////////
/// Pointer exclusive lock object. Use to control access to class members in
/// multithread implementation.
////////////////////////////////////////////////////////////////////////////////
std::tr1::shared_ptr<mmSynchronize::mmExclusiveLockI> m_psThreadSynchEL;

////////////////////////////////////////////////////////////////////////////////
/// Number of rows in single data block. Modify to control amount of data processed
/// by a single thread. The last block may be smaller, depending on image size,
/// because it is a reminder of integer division of image height.
////////////////////////////////////////////////////////////////////////////////
mmInt m_iRowsCountInBlock;
};
};
Loading

0 comments on commit 7488dcc

Please sign in to comment.