Mass++ ソースリポジトリ
Revision | 9104db045a3a262c416e472569ea0ea5cf2318de (tree) |
---|---|
Time | 2015-06-06 01:31:15 |
Author | Masaki Murase |
Commiter | Masaki Murase |
add MsbackadjBaselineDetection Plug-in
removed MATLAB related plugin from 32bit installer configuration
@@ -0,0 +1,170 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
3 | + <ItemGroup Label="ProjectConfigurations"> | |
4 | + <ProjectConfiguration Include="Debug|Win32"> | |
5 | + <Configuration>Debug</Configuration> | |
6 | + <Platform>Win32</Platform> | |
7 | + </ProjectConfiguration> | |
8 | + <ProjectConfiguration Include="Release|Win32"> | |
9 | + <Configuration>Release</Configuration> | |
10 | + <Platform>Win32</Platform> | |
11 | + </ProjectConfiguration> | |
12 | + <ProjectConfiguration Include="Debug|x64"> | |
13 | + <Configuration>Debug</Configuration> | |
14 | + <Platform>x64</Platform> | |
15 | + </ProjectConfiguration> | |
16 | + <ProjectConfiguration Include="Release|x64"> | |
17 | + <Configuration>Release</Configuration> | |
18 | + <Platform>x64</Platform> | |
19 | + </ProjectConfiguration> | |
20 | + </ItemGroup> | |
21 | + <PropertyGroup Label="Globals"> | |
22 | + <ProjectGuid>{CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}</ProjectGuid> | |
23 | + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
24 | + </PropertyGroup> | |
25 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
26 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
27 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
28 | + <CharacterSet>MultiByte</CharacterSet> | |
29 | + <TargetName>$(ProjectName)</TargetName> | |
30 | + <OutDir>$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
31 | + <IntDir>$(Platform)-$(Configuration)\</IntDir> | |
32 | + <LinkIncremental>true</LinkIncremental> | |
33 | + </PropertyGroup> | |
34 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
35 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
36 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
37 | + <CharacterSet>MultiByte</CharacterSet> | |
38 | + <TargetName>$(ProjectName)</TargetName> | |
39 | + <OutDir>$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
40 | + <IntDir>$(Platform)-$(Configuration)\</IntDir> | |
41 | + <LinkIncremental>false</LinkIncremental> | |
42 | + </PropertyGroup> | |
43 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | |
44 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
45 | + <CharacterSet>MultiByte</CharacterSet> | |
46 | + <TargetName>$(ProjectName)</TargetName> | |
47 | + <OutDir>$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
48 | + <IntDir>$(Platform)-$(Configuration)\</IntDir> | |
49 | + <LinkIncremental>true</LinkIncremental> | |
50 | + </PropertyGroup> | |
51 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | |
52 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
53 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
54 | + <CharacterSet>MultiByte</CharacterSet> | |
55 | + <TargetName>$(ProjectName)</TargetName> | |
56 | + <OutDir>$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
57 | + <IntDir>$(Platform)-$(Configuration)\</IntDir> | |
58 | + <LinkIncremental>false</LinkIncremental> | |
59 | + </PropertyGroup> | |
60 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
61 | + <ImportGroup Label="ExtensionSettings"> | |
62 | + </ImportGroup> | |
63 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
64 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
65 | + </ImportGroup> | |
66 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
67 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
68 | + </ImportGroup> | |
69 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | |
70 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
71 | + </ImportGroup> | |
72 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | |
73 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
74 | + </ImportGroup> | |
75 | + <PropertyGroup Label="UserMacros" /> | |
76 | + <PropertyGroup /> | |
77 | + <PropertyGroup> | |
78 | + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
79 | + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
80 | + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
81 | + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)-$(Configuration)\</OutDir> | |
82 | + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)-$(Configuration)\</IntDir> | |
83 | + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)-$(Configuration)\</IntDir> | |
84 | + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)-$(Configuration)\</IntDir> | |
85 | + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)-$(Configuration)\</IntDir> | |
86 | + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | |
87 | + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | |
88 | + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | |
89 | + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | |
90 | + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Parallel-Release|x64 '">false</LinkIncremental> | |
91 | + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName> | |
92 | + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)</TargetName> | |
93 | + <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName> | |
94 | + <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)</TargetName> | |
95 | + </PropertyGroup> | |
96 | + <ItemDefinitionGroup> | |
97 | + <ClCompile> | |
98 | + <AdditionalIncludeDirectories>$(SolutionDir)..\..\..\..\include;$(SolutionDir)..\..\contrib\common\$(Platform)\boost\include;$(SolutionDir)..\..\contrib\common\$(Platform)\cairo\include;$(SolutionDir)..\..\contrib\common\$(Platform)\wxWidgets\include;$(SolutionDir)..\..\contrib\common\$(Platform)\wxWidgets\lib\msw;$(SolutionDir)..\..\contrib\common\$(Platform)\xerces-c\include;$(SolutionDir)..\..\contrib\common\$(Platform)\zlib\include;$(SolutionDir)..\..\contrib\common\$(Platform)\Java\include;$(SolutionDir)..\..\contrib\common\$(Platform)\gtest\include;$(SolutionDir)..\..\contrib\forPlugins\Win32\Matlab\extern\include;$(SolutionDir)..\..\contrib\forPlugins\Win32\Matlab\BioinformaticsToolboxFuncDll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
99 | + <PrecompiledHeader>NotUsing</PrecompiledHeader> | |
100 | + </ClCompile> | |
101 | + <Link> | |
102 | + <AdditionalLibraryDirectories>$(SolutionDir)..\..\..\..\lib\msvs\$(Platform)-$(Configuration);$(SolutionDir)..\..\contrib\common\$(Platform)\boost\lib;$(SolutionDir)..\..\contrib\common\$(Platform)\cairo\lib;$(SolutionDir)..\..\contrib\common\$(Platform)\wxWidgets\lib;$(SolutionDir)..\..\contrib\common\$(Platform)\xerces-c\lib;$(SolutionDir)..\..\contrib\common\$(Platform)\zlib\lib;$(SolutionDir)..\..\contrib\common\$(Platform)\Java\include;$(SolutionDir)..\..\contrib\common\$(Platform)\gtest\lib;$(SolutionDir)..\..\contrib\forPlugins\Win32\Matlab\BioinformaticsToolboxFuncDll;$(SolutionDir)..\..\contrib\forPlugins\Win32\Matlab\extern\lib\win64\microsoft;$(SolutionDir)..\..\contrib\forPlugins\Win32\Matlab\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | |
103 | + <ModuleDefinitionFile>$(SolutionDir)..\..\..\..\src\$(SolutionName)\$(ProjectName)\$(ProjectName).def</ModuleDefinitionFile> | |
104 | + </Link> | |
105 | + <PostBuildEvent> | |
106 | + <Command>mkdir "$(SolutionDir)..\..\stage\$(Platform)-$(Configuration)\plugins\$(ProjectName)" | |
107 | +copy "$(TargetPath)" "$(SolutionDir)..\..\stage\$(Platform)-$(Configuration)\plugins\$(ProjectName)" | |
108 | +copy "$(SolutionDir)..\..\..\..\src\$(SolutionName)\$(ProjectName)\*.xml" "$(SolutionDir)..\..\stage\$(Platform)-$(Configuration)\plugins\$(ProjectName)" | |
109 | +copy "$(SolutionDir)..\..\contrib\forPlugins\$(Platform)\MATLAB\BioinformaticsToolboxFuncDll\*.dll" "$(SolutionDir)..\..\stage\$(Platform)-$(Configuration)\bin"</Command> | |
110 | + </PostBuildEvent> | |
111 | + </ItemDefinitionGroup> | |
112 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
113 | + <ClCompile> | |
114 | + <WarningLevel>Level3</WarningLevel> | |
115 | + <Optimization>Disabled</Optimization> | |
116 | + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USERDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
117 | + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | |
118 | + </ClCompile> | |
119 | + <Link> | |
120 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
121 | + </Link> | |
122 | + </ItemDefinitionGroup> | |
123 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
124 | + <ClCompile> | |
125 | + <WarningLevel>Level3</WarningLevel> | |
126 | + <Optimization>MaxSpeed</Optimization> | |
127 | + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USERDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
128 | + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | |
129 | + </ClCompile> | |
130 | + <Link> | |
131 | + </Link> | |
132 | + </ItemDefinitionGroup> | |
133 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | |
134 | + <ClCompile> | |
135 | + <WarningLevel>Level3</WarningLevel> | |
136 | + <Optimization>Disabled</Optimization> | |
137 | + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USERDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
138 | + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | |
139 | + </ClCompile> | |
140 | + <Link> | |
141 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
142 | + </Link> | |
143 | + </ItemDefinitionGroup> | |
144 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | |
145 | + <ClCompile> | |
146 | + <WarningLevel>Level3</WarningLevel> | |
147 | + <Optimization>MaxSpeed</Optimization> | |
148 | + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USERDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
149 | + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | |
150 | + </ClCompile> | |
151 | + </ItemDefinitionGroup> | |
152 | + <ItemGroup> | |
153 | + <None Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionPlugin.def" /> | |
154 | + <None Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\plugin.xml" /> | |
155 | + <None Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\ReadMe.txt" /> | |
156 | + <None Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\settings.xml" /> | |
157 | + </ItemGroup> | |
158 | + <ItemGroup> | |
159 | + <ClInclude Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionManager.h" /> | |
160 | + <ClInclude Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionPluginFunctions.h" /> | |
161 | + <ClInclude Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\stdafx.h" /> | |
162 | + </ItemGroup> | |
163 | + <ItemGroup> | |
164 | + <ClCompile Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionManager.cpp" /> | |
165 | + <ClCompile Include="..\..\..\..\..\src\common-plugin-analyze\MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionPluginFunctions.cpp" /> | |
166 | + </ItemGroup> | |
167 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
168 | + <ImportGroup Label="ExtensionTargets"> | |
169 | + </ImportGroup> | |
170 | +</Project> | |
\ No newline at end of file |
@@ -63,6 +63,8 @@ | ||
63 | 63 | EndProject |
64 | 64 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MascotSearchPlugin", "MascotSearchPlugin\MascotSearchPlugin.vcxproj", "{3884E680-4F5C-4D72-BD7F-CC133511FBE6}" |
65 | 65 | EndProject |
66 | +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MsbackadjBaselineDetectionPlugin", "MsbackadjBaselineDetectionPlugin\MsbackadjBaselineDetectionPlugin.vcxproj", "{CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}" | |
67 | +EndProject | |
66 | 68 | Global |
67 | 69 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
68 | 70 | Debug|Win32 = Debug|Win32 |
@@ -567,6 +569,20 @@ | ||
567 | 569 | {3884E680-4F5C-4D72-BD7F-CC133511FBE6}.Release|Win32.Build.0 = Release|Win32 |
568 | 570 | {3884E680-4F5C-4D72-BD7F-CC133511FBE6}.Release|x64.ActiveCfg = Release|x64 |
569 | 571 | {3884E680-4F5C-4D72-BD7F-CC133511FBE6}.Release|x64.Build.0 = Release|x64 |
572 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Debug|Win32.ActiveCfg = Debug|Win32 | |
573 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Debug|Win32.Build.0 = Debug|Win32 | |
574 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Debug|x64.ActiveCfg = Debug|x64 | |
575 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Debug|Win32.ActiveCfg = Debug|Win32 | |
576 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Debug|Win32.Build.0 = Debug|Win32 | |
577 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Debug|x64.ActiveCfg = Debug|x64 | |
578 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Debug|x64.Build.0 = Debug|x64 | |
579 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Release|Win32.ActiveCfg = Release|Win32 | |
580 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Release|Win32.Build.0 = Release|Win32 | |
581 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Release|x64.ActiveCfg = Release|x64 | |
582 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Parallel-Release|x64.Build.0 = Release|x64 | |
583 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Release|Win32.ActiveCfg = Release|Win32 | |
584 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Release|Win32.Build.0 = Release|Win32 | |
585 | + {CE31E679-A06C-4F42-9D45-1FC9CE38ADC8}.Release|x64.ActiveCfg = Release|x64 | |
570 | 586 | EndGlobalSection |
571 | 587 | GlobalSection(SolutionProperties) = preSolution |
572 | 588 | HideSolutionNode = FALSE |
@@ -0,0 +1,492 @@ | ||
1 | +/** | |
2 | + * @file MsbackadjBaselineDetectionManager.cpp | |
3 | + * @brief implements of MsbackadjBaselineDetectionManager class | |
4 | + * | |
5 | + * @author A.Ozaki | |
6 | + * @date 2013.08.01 | |
7 | + * | |
8 | + * Copyright(C) 2013-2013 Shimadzu Corporation. All rights reserved. | |
9 | + */ | |
10 | + | |
11 | +#include "stdafx.h" | |
12 | +#include "MsbackadjBaselineDetectionManager.h" | |
13 | + | |
14 | +#include <math.h> | |
15 | +#include <float.h> | |
16 | + | |
17 | + | |
18 | +using namespace kome::baseline::msbackadj; | |
19 | + | |
20 | + | |
21 | +#include <crtdbg.h> | |
22 | +#ifdef _DEBUG | |
23 | + #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ ) | |
24 | + #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ ) | |
25 | +#endif // _DEBUG | |
26 | + | |
27 | + | |
28 | + | |
29 | +// for use Matlab libraries | |
30 | +// | |
31 | +#include "BioinformaticsToolboxFunc.h" | |
32 | +#pragma comment( lib, "BioinformaticsToolboxFunc" ) | |
33 | +#pragma comment( lib, "mclmcrrt" ) | |
34 | +// | |
35 | +// | |
36 | + | |
37 | +// for Error Message on Dialog | |
38 | +#define ERROR_MESSAGE_APPL_INITIALIZE ( "BioinformaticsToolboxFunc library cannot be initialized.\nIf MATLAB Compiler Runtime Routine (MCR) ver.R2013a was not installed, please install it from flollwing web site:\nhttp://www.mathworks.com/products/compiler/mcr/index.html" ) | |
39 | +#define ERROR_MESSAGE_INITIALIZE ( "BioinformaticsToolboxFunc library cannot be initialized." ) | |
40 | +#define FUNCTION_NAME ( "Msbackadj" ) | |
41 | + | |
42 | + | |
43 | +// constructor | |
44 | +MsbackadjBaselineDetectionManager::MsbackadjBaselineDetectionManager( void ) | |
45 | +{ | |
46 | + // initialize application | |
47 | + // | |
48 | + m_pProgress = (kome::window::DialogProgress *)NULL; | |
49 | + | |
50 | + // set default value | |
51 | + m_dWindowSize = 200.0; | |
52 | + m_dStepSize = 50.0; | |
53 | + m_nRegressionMethod = 0; | |
54 | + m_nEstimationMethod = 0; | |
55 | + m_nSmoothingMethod = 0; | |
56 | + m_dQuantile = 0.1; | |
57 | + | |
58 | + return; | |
59 | +} | |
60 | + | |
61 | +// destructor | |
62 | +MsbackadjBaselineDetectionManager::~MsbackadjBaselineDetectionManager( void ) | |
63 | +{ | |
64 | + // release application | |
65 | + // | |
66 | + kome::core::MsppManager &insMsppMgr = kome::core::MsppManager::getInstance( ); | |
67 | + if ( true == insMsppMgr.isInitializedMATLAB( ) ) | |
68 | + { | |
69 | + // initialized MATLAB application | |
70 | + try | |
71 | + { | |
72 | + mclTerminateApplication( ); | |
73 | + | |
74 | + // reset flag | |
75 | + insMsppMgr.resetInitializedMATLAB( ); | |
76 | + } | |
77 | + catch (...) | |
78 | + { | |
79 | + } | |
80 | + } | |
81 | + | |
82 | + return; | |
83 | +} | |
84 | + | |
85 | +// set window size | |
86 | +void MsbackadjBaselineDetectionManager::setWindowSize( const double dSize ) | |
87 | +{ | |
88 | + m_dWindowSize = MAX( 0.0, dSize ); | |
89 | +} | |
90 | + | |
91 | +// get window size | |
92 | +double MsbackadjBaselineDetectionManager::getWindowSize( void ) | |
93 | +{ | |
94 | + return m_dWindowSize; | |
95 | +} | |
96 | + | |
97 | +// set step size | |
98 | +void MsbackadjBaselineDetectionManager::setStepSize( const double dSize ) | |
99 | +{ | |
100 | + m_dStepSize = MAX( 0.0, dSize ); | |
101 | +} | |
102 | + | |
103 | +// get step size | |
104 | +double MsbackadjBaselineDetectionManager::getStepSize( ) | |
105 | +{ | |
106 | + return m_dStepSize; | |
107 | +} | |
108 | + | |
109 | +// set regression method | |
110 | +void MsbackadjBaselineDetectionManager::setRegressionMethod( const int nMethodValue ) | |
111 | +{ | |
112 | + m_nRegressionMethod = MAX( 0, nMethodValue ); | |
113 | +} | |
114 | + | |
115 | +// get regression method | |
116 | +int MsbackadjBaselineDetectionManager::getRegressionMethod( void ) | |
117 | +{ | |
118 | + return m_nRegressionMethod; | |
119 | +} | |
120 | + | |
121 | +// set estimation method | |
122 | +void MsbackadjBaselineDetectionManager::setEstimationMethod( const int nMethodValue ) | |
123 | +{ | |
124 | + m_nEstimationMethod = MAX( 0, nMethodValue ); | |
125 | +} | |
126 | + | |
127 | +// get estimation method | |
128 | +int MsbackadjBaselineDetectionManager::getEstimationMethod( void ) | |
129 | +{ | |
130 | + return m_nEstimationMethod; | |
131 | +} | |
132 | + | |
133 | +// set smoothing method | |
134 | +void MsbackadjBaselineDetectionManager::setSmoothingMethod( const int nMethodValue ) | |
135 | +{ | |
136 | + m_nSmoothingMethod = MAX( 0, nMethodValue ); | |
137 | +} | |
138 | + | |
139 | +// get smoothing method | |
140 | +int MsbackadjBaselineDetectionManager::getSmoothingMethod( void ) | |
141 | +{ | |
142 | + return m_nSmoothingMethod; | |
143 | +} | |
144 | + | |
145 | +// set quantile | |
146 | +void MsbackadjBaselineDetectionManager::setQuantile( const double dQuantile ) | |
147 | +{ | |
148 | + m_dQuantile = MAX( 0.0, dQuantile ); | |
149 | +} | |
150 | + | |
151 | +// get quantile | |
152 | +double MsbackadjBaselineDetectionManager::getQuantile( void ) | |
153 | +{ | |
154 | + return m_dQuantile; | |
155 | +} | |
156 | + | |
157 | +// initialize MATLAB application | |
158 | +bool MsbackadjBaselineDetectionManager::initializeApplication( void ) | |
159 | +{ | |
160 | + kome::core::MsppManager &insMsppMgr = kome::core::MsppManager::getInstance( ); | |
161 | + | |
162 | + // check initialize | |
163 | + bool bRet = insMsppMgr.isInitializedMATLAB( ); | |
164 | + if ( false == bRet ) | |
165 | + { | |
166 | + // uninitialize | |
167 | + | |
168 | + // create progress dialog | |
169 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
170 | + { | |
171 | + delete m_pProgress; | |
172 | + } | |
173 | + if ( (wxWindow *)NULL != kome::window::WindowTool::getMainWindow( ) ) | |
174 | + { | |
175 | +// m_pProgress = new kome::window::DialogProgress( kome::window::WindowTool::getMainWindow( ), FUNCTION_NAME ); | |
176 | + } | |
177 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
178 | + { | |
179 | + m_pProgress->setStatus( "MATLAB application initialzing..." ); | |
180 | + m_pProgress->setRange( 1, 4 ); | |
181 | + m_pProgress->setPosition( 2 ); | |
182 | + } | |
183 | + | |
184 | + // initialize application | |
185 | + // | |
186 | + if ( true == mclInitializeApplication( NULL, 0 ) ) | |
187 | + { | |
188 | + // success | |
189 | + insMsppMgr.setInitializedMATLAB( ); | |
190 | + bRet = true; | |
191 | + } | |
192 | + else | |
193 | + { | |
194 | + // failure | |
195 | + LOG_ERROR( FMT( "mclInitializeApplication function failure." ) ); | |
196 | + | |
197 | + wxMessageBox( wxT( ERROR_MESSAGE_APPL_INITIALIZE ), wxT( FUNCTION_NAME ), wxOK ); | |
198 | + | |
199 | + if ( (kome::core::Progress *)NULL != m_pProgress ) | |
200 | + { | |
201 | + m_pProgress->fill( ); | |
202 | + delete m_pProgress; | |
203 | + m_pProgress = (kome::window::DialogProgress *)NULL; | |
204 | + } | |
205 | + } | |
206 | + | |
207 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
208 | + { | |
209 | + m_pProgress->setPosition( 3 ); | |
210 | + } | |
211 | + | |
212 | + } | |
213 | + | |
214 | + return bRet; | |
215 | +} | |
216 | +// get baseline | |
217 | +void MsbackadjBaselineDetectionManager::getMsbackadj | |
218 | +( | |
219 | + kome::core::XYData &src, | |
220 | + kome::core::XYData &baseline | |
221 | +) | |
222 | +{ | |
223 | + // initialize application for MATLAB | |
224 | + if ( false == initializeApplication( ) ) | |
225 | + { | |
226 | + LOG_ERROR( FMT( "initializeApplication function failure." ) ); | |
227 | + return; | |
228 | + } | |
229 | + | |
230 | + while ( 1 ) | |
231 | + { | |
232 | + int nIndex = 0; | |
233 | + | |
234 | + const int nRowTemp = src.getLength( ); | |
235 | + const int nColumn = 2; // 行列(m/zの1次元配列、intensityの1次元配列からなる2列) | |
236 | + const int nDataSizeTemp = nRowTemp * nColumn; | |
237 | + | |
238 | + double *pdDataArray = (double *)NULL; | |
239 | + | |
240 | + pdDataArray = new double[nDataSizeTemp]; | |
241 | + if ( (double *)NULL == pdDataArray ) | |
242 | + { | |
243 | + LOG_ERROR( FMT( "can not allocate data array.(size:%dx%d)", sizeof( double ), nDataSizeTemp ) ); | |
244 | + break; | |
245 | + } | |
246 | + | |
247 | + memset( (void *)pdDataArray, 0x00, sizeof( double ) * nDataSizeTemp ); | |
248 | + | |
249 | + // m/z、intensityを設定します | |
250 | + // ただし、intensityの値がゼロのものは、省いて設定する必要があります | |
251 | + // | |
252 | + int nRow = 0; | |
253 | + int nIndexTemp = 0; | |
254 | + | |
255 | + // 強度の値が0のところを省く | |
256 | + for ( nIndex = 0 ; nIndex < nRowTemp ; nIndex++ ) | |
257 | + { | |
258 | + if ( 0 < src.getY( nIndex ) ) | |
259 | + { | |
260 | + *(pdDataArray + nRow) = src.getX( nIndex ); | |
261 | + nRow++; | |
262 | + } | |
263 | + } | |
264 | + for ( nIndex = 0 ; nIndex < nRowTemp ; nIndex++ ) | |
265 | + { | |
266 | + if ( 0 < src.getY( nIndex ) ) | |
267 | + { | |
268 | + *(pdDataArray + nIndexTemp + nRow) = src.getY( nIndex ); | |
269 | + nIndexTemp++; | |
270 | + } | |
271 | + } | |
272 | + const int nDataSize = nRow * nColumn; | |
273 | + | |
274 | + // nRowTemp...raw dataのデータポイント数 | |
275 | + // nRow、nIndexTemp....強度が0のデータポイントを除いたデータポイント数 | |
276 | + | |
277 | + // データ数の確認 | |
278 | + if ( 0 >= nDataSize ) | |
279 | + { | |
280 | + LOG_ERROR( FMT( "illegal data size (%d)", nDataSize ) ); | |
281 | + break; | |
282 | + } | |
283 | + | |
284 | + mwArray insArrayData( nRow, nColumn, mxDOUBLE_CLASS, mxREAL ); | |
285 | + | |
286 | + // dDataArray -> insArrayData | |
287 | + insArrayData.SetData( pdDataArray, nDataSize ); | |
288 | + | |
289 | + // | |
290 | + delete[] pdDataArray; | |
291 | + | |
292 | + mwArray insWindowSize( m_dWindowSize ); | |
293 | + mwArray insStepSize( m_dStepSize ); | |
294 | + mwArray insRegressionMethod( m_nRegressionMethod ); | |
295 | + mwArray insEstimationMethod( m_nEstimationMethod ); | |
296 | + mwArray insSmoothingMethod( m_nSmoothingMethod ); | |
297 | + mwArray insQuantile( m_dQuantile); | |
298 | + | |
299 | + const int nArgOut = 1; // size of return values | |
300 | + | |
301 | + mwArray insBackadj; // return | |
302 | + | |
303 | + bool bSuccess = true; | |
304 | + | |
305 | + | |
306 | + // initialize MATLAB function libray | |
307 | + // | |
308 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
309 | + { | |
310 | + m_pProgress->setPosition( 3 ); | |
311 | + m_pProgress->setStatus( "MATLAB function initializing..." ); | |
312 | + } | |
313 | + if ( false == BioinformaticsToolboxFuncInitialize( ) ) | |
314 | + { | |
315 | + // initialize false | |
316 | + LOG_ERROR( FMT( "BioinformaticsToolboxFuncInitialize function failure." ) ); | |
317 | + | |
318 | + wxMessageBox( wxT( ERROR_MESSAGE_INITIALIZE ), wxT( FUNCTION_NAME ), wxOK ); | |
319 | + | |
320 | + break; | |
321 | + } | |
322 | + | |
323 | + // execute MATLAB function | |
324 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
325 | + { | |
326 | + m_pProgress->setPosition( 4 ); | |
327 | + m_pProgress->setStatus( "Processing..." ); | |
328 | + } | |
329 | + try | |
330 | + { | |
331 | + MatlabMsbackadj( nArgOut, insBackadj, insArrayData, | |
332 | + insWindowSize, insStepSize, insRegressionMethod, insEstimationMethod, | |
333 | + insSmoothingMethod, insQuantile ); | |
334 | + | |
335 | + std::string strTemp; | |
336 | + } | |
337 | + catch (...) | |
338 | + { | |
339 | + LOG_ERROR( FMT( "MatlabMsbackadj function failure." ) ); | |
340 | + bSuccess = false; | |
341 | + } | |
342 | + | |
343 | + // release MATLAB function libray | |
344 | + // | |
345 | + try | |
346 | + { | |
347 | + BioinformaticsToolboxFuncTerminate( ); | |
348 | + } | |
349 | + catch (...) | |
350 | + { | |
351 | + } | |
352 | + | |
353 | + // prot process | |
354 | + // | |
355 | + if ( true == bSuccess ) | |
356 | + { | |
357 | + mwArray insSize = insBackadj.GetDimensions( ); | |
358 | + | |
359 | + int nGetSize[1]; | |
360 | + | |
361 | + insSize.GetData( nGetSize, _countof( nGetSize ) ); | |
362 | + | |
363 | + int nCountOfBackadj= nGetSize[0]; | |
364 | + | |
365 | + // 入力したデータポイント数と、出力されてきたデータポイント数が異なればエラー | |
366 | + // check values | |
367 | + if ( nRow != nCountOfBackadj ) | |
368 | + { | |
369 | + // error | |
370 | + LOG_ERROR( FMT( "unmatch row size (%d:%d)", nRow, nDataSize ) ); | |
371 | + break; | |
372 | + } | |
373 | + | |
374 | + double *pdBackadj = new double[nCountOfBackadj]; | |
375 | + if ( (double *)NULL == pdBackadj ) | |
376 | + { | |
377 | + LOG_ERROR( FMT( "can not allocate data array.(size:%dx%d)", sizeof( double ), nCountOfBackadj ) ); | |
378 | + break; | |
379 | + } | |
380 | + | |
381 | + // メモリの確保 | |
382 | + memset( (void *)pdBackadj, 0x00, sizeof( double ) * nCountOfBackadj ); | |
383 | + | |
384 | + // store | |
385 | + insBackadj.GetData( pdBackadj, nCountOfBackadj ); // pdBackadjにベースラインサブトラクト後のピーク強度が入る。 | |
386 | + | |
387 | + baseline.reserve( nRowTemp ); | |
388 | + | |
389 | + // ベースラインの値を baseline に格納 | |
390 | + int nRow_index = 0; | |
391 | + for ( nIndex = 0 ; nIndex < nRowTemp ; nIndex++ ) | |
392 | + { | |
393 | + if ( 0 < src.getY( nIndex ) ) // 元の配列において、強度が0でなければ | |
394 | + { | |
395 | + baseline.addPoint( src.getX( nIndex ), src.getY( nIndex )- pdBackadj[nRow_index]); | |
396 | + nRow_index++; | |
397 | + } | |
398 | + else // 元の配列において、強度が0以下ならば | |
399 | + { | |
400 | + baseline.addPoint( src.getX( nIndex ), 0); | |
401 | + | |
402 | + } | |
403 | + } | |
404 | + | |
405 | + // 強度が0以外の点数を確認します | |
406 | + if ( nRow != nRow_index ) | |
407 | + { | |
408 | + // error | |
409 | + LOG_ERROR( FMT( "unmatch row size without zero value (%d:%d)", nRow, nRow_index ) ); | |
410 | + delete[] pdBackadj; // @Date:2014/02/21 <Add> A.Ozaki | |
411 | + break; | |
412 | + } | |
413 | + | |
414 | + /* baseline除去後のデータをbaselineに渡していたので、削除 <del> 2014-2-7 Fujita | |
415 | + baseline.reserve( nRow ); | |
416 | + | |
417 | + nRow | |
418 | + for ( nIndex = 0 ; nIndex < nRow ; nIndex++ ) | |
419 | + { | |
420 | + if ( 0 < src.getY( nIndex ){ // 元の配列において、強度が0でなければ | |
421 | + baseline.addPoint( src.getX( nIndex ), *( pdBackadj + nIndex ) ); | |
422 | + } | |
423 | + } | |
424 | + */ | |
425 | + | |
426 | + delete[] pdBackadj; | |
427 | + } | |
428 | + | |
429 | + break; | |
430 | + } | |
431 | + | |
432 | + // clean up progress | |
433 | + // | |
434 | + if ( (kome::window::DialogProgress *)NULL != m_pProgress ) | |
435 | + { | |
436 | + m_pProgress->fill( ); | |
437 | + | |
438 | + delete m_pProgress; | |
439 | + m_pProgress = (kome::window::DialogProgress *)NULL; | |
440 | + } | |
441 | + | |
442 | + return; | |
443 | +} | |
444 | + | |
445 | +// get noise threshold | |
446 | +double MsbackadjBaselineDetectionManager::getNoiseThreshold( kome::core::XYData& src ) | |
447 | +{ | |
448 | + // noise threshold | |
449 | + return 0.0; | |
450 | +} | |
451 | + | |
452 | +// get instance | |
453 | +MsbackadjBaselineDetectionManager &MsbackadjBaselineDetectionManager::getInstance( void ) | |
454 | +{ | |
455 | + // create object | |
456 | + static MsbackadjBaselineDetectionManager mgr; | |
457 | + | |
458 | + return mgr; | |
459 | +} | |
460 | + | |
461 | +// release MATLAB application | |
462 | +void MsbackadjBaselineDetectionManager::releaseMatlab( void ) | |
463 | +{ | |
464 | + kome::core::MsppManager &insMsppMgr = kome::core::MsppManager::getInstance( ); | |
465 | + | |
466 | + // check initialize | |
467 | + bool bRet = insMsppMgr.isInitializedMATLAB( ); | |
468 | + if ( true == bRet ) | |
469 | + { | |
470 | + // already initialized | |
471 | + try | |
472 | + { | |
473 | + // release application | |
474 | + // | |
475 | + mclTerminateApplication( ); | |
476 | + } | |
477 | + catch (...) | |
478 | + { | |
479 | + // failure | |
480 | + LOG_ERROR( FMT( "mclTerminateApplication function failure." ) ); | |
481 | + } | |
482 | + | |
483 | + // reset initialized flag | |
484 | + // | |
485 | + insMsppMgr.resetInitializedMATLAB( ); | |
486 | + } | |
487 | + | |
488 | + return; | |
489 | +} | |
490 | + | |
491 | + | |
492 | +// |
@@ -0,0 +1,186 @@ | ||
1 | +/** | |
2 | + * @file MsbackadjBaselineDetectionManager.h | |
3 | + * @brief interfaces of MsbackadjBaselineDetectionManager class | |
4 | + * | |
5 | + * @author A.Ozaki | |
6 | + * @date 2013.08.01 | |
7 | + * | |
8 | + * Copyright(C) 2013-2013 Shimadzu Corporation. All rights reserved. | |
9 | + */ | |
10 | + | |
11 | + | |
12 | +#ifndef __KOME_BASELINE_MSBACKADJ_MANAGER_H__ | |
13 | +#define __KOME_BASELINE_MSBACKADJ_MANAGER_H__ | |
14 | + | |
15 | + | |
16 | +namespace kome { | |
17 | + namespace baseline { | |
18 | + namespace msbackadj { | |
19 | + | |
20 | + /** | |
21 | + * @class AbcBaselineDetectionManager | |
22 | + * @brief weighted average baseline class | |
23 | + */ | |
24 | + class MsbackadjBaselineDetectionManager { | |
25 | + protected: | |
26 | + /** | |
27 | + * @fn MsbackadjBaselineDetectionManager( void ) | |
28 | + * @brief constructor | |
29 | + */ | |
30 | + MsbackadjBaselineDetectionManager( void ); | |
31 | + | |
32 | + /** | |
33 | + * @fn virtual ~MsbackadjBaselineDetectionManager( void ) | |
34 | + * @brief destructor | |
35 | + */ | |
36 | + virtual ~MsbackadjBaselineDetectionManager( void ); | |
37 | + | |
38 | + protected: | |
39 | + /** window size */ | |
40 | + double m_dWindowSize; | |
41 | + | |
42 | + /** step size */ | |
43 | + double m_dStepSize; | |
44 | + | |
45 | + /** regression method */ | |
46 | + int m_nRegressionMethod; | |
47 | + | |
48 | + /** estimation method */ | |
49 | + int m_nEstimationMethod; | |
50 | + | |
51 | + /** smoothing method */ | |
52 | + int m_nSmoothingMethod; | |
53 | + | |
54 | + /** quantile */ | |
55 | + double m_dQuantile; | |
56 | + | |
57 | + public: | |
58 | + /** | |
59 | + * @fn void setWindowSize( const double dSize ) | |
60 | + * @brief sets window size | |
61 | + * @param dSize window size | |
62 | + */ | |
63 | + void setWindowSize( const double dSize ); | |
64 | + | |
65 | + /** | |
66 | + * @fn double getWindowSize( void ) | |
67 | + * @brief gets window size | |
68 | + * @return window size | |
69 | + */ | |
70 | + double getWindowSize( void ); | |
71 | + | |
72 | + /** | |
73 | + * @fn void setStepSize( const double dSize ) | |
74 | + * @brief sets step size | |
75 | + * @param dSize step size | |
76 | + */ | |
77 | + void setStepSize( const double dSize ); | |
78 | + | |
79 | + /** | |
80 | + * @fn double getStepSize( void ) | |
81 | + * @brief gets step size | |
82 | + * @return step size | |
83 | + */ | |
84 | + double getStepSize( void ); | |
85 | + | |
86 | + /** | |
87 | + * @fn void setRegressionMethod( const ind nMethodValue ) | |
88 | + * @brief sets regression method | |
89 | + * @param nMethodValue number of regression method | |
90 | + */ | |
91 | + void setRegressionMethod( const int nMethodValue ); | |
92 | + | |
93 | + /** | |
94 | + * @fn double getRegressionMethod( void ) | |
95 | + * @brief gets regression method | |
96 | + * @return number of regresstion method | |
97 | + */ | |
98 | + int getRegressionMethod( void ); | |
99 | + | |
100 | + /** | |
101 | + * @fn void setEstimationMethod( const ind nMethodValue ) | |
102 | + * @brief sets estimation method | |
103 | + * @param nMethodValue number of estimation method | |
104 | + */ | |
105 | + void setEstimationMethod( const int nMethodValue ); | |
106 | + | |
107 | + /** | |
108 | + * @fn double getEstimationMethod( void ) | |
109 | + * @brief gets estimation method | |
110 | + * @return number of estimation method | |
111 | + */ | |
112 | + int getEstimationMethod( void ); | |
113 | + | |
114 | + /** | |
115 | + * @fn void setSmoothingMethod( const ind nMethodValue ) | |
116 | + * @brief sets smoothing method | |
117 | + * @param nMethodValue number of smoothing method | |
118 | + */ | |
119 | + void setSmoothingMethod( const int nMethodValue ); | |
120 | + | |
121 | + /** | |
122 | + * @fn double getSmoothingMethod( void ) | |
123 | + * @brief gets smoothing method | |
124 | + * @return number of smoothing method | |
125 | + */ | |
126 | + int getSmoothingMethod( void ); | |
127 | + | |
128 | + /** | |
129 | + * @fn void setSQuantile( const double dQuantile ) | |
130 | + * @brief sets quantile | |
131 | + * @param dQuantile quantile | |
132 | + */ | |
133 | + void setQuantile( const double dQuantile ); | |
134 | + | |
135 | + /** | |
136 | + * @fn int getQuantile( void ) | |
137 | + * @brief gets quantile | |
138 | + * @return quantile | |
139 | + */ | |
140 | + double getQuantile( void ); | |
141 | + | |
142 | + public: | |
143 | + /** | |
144 | + * @fn void getMsbackadj( kome::core::XYData& src, kome::core::XYData& baseline ) | |
145 | + * @brief gets baseline | |
146 | + * @param src source data points | |
147 | + * @param baseline the object to store baseline | |
148 | + */ | |
149 | + void getMsbackadj( kome::core::XYData& src, kome::core::XYData& baseline ); | |
150 | + | |
151 | + /** | |
152 | + * @fn void releaseMatlab( void ) | |
153 | + * @brief release MATLAB application | |
154 | + */ | |
155 | + void releaseMatlab( void ); | |
156 | + | |
157 | + protected: | |
158 | + /** | |
159 | + * @fn double getNoiseThreshold( kome::core::XYData& src ) | |
160 | + * @brief gets noise threshold | |
161 | + * @param src source data points | |
162 | + * @return noise threshold | |
163 | + */ | |
164 | + double getNoiseThreshold( kome::core::XYData& src ); | |
165 | + | |
166 | + private: | |
167 | + /** Progress */ | |
168 | + kome::window::DialogProgress *m_pProgress; | |
169 | + | |
170 | + private: | |
171 | + /** initialize application */ | |
172 | + bool initializeApplication( void ); | |
173 | + | |
174 | + public: | |
175 | + /** | |
176 | + * @fn static MsbackadjBaselineDetectionManager& getInstance( void ) | |
177 | + * @brief gets MsbackadjBaselineDetectionManager object | |
178 | + * @return AbcBaselineDetectionManager object (This is the only object.) | |
179 | + */ | |
180 | + static MsbackadjBaselineDetectionManager& getInstance( void ); | |
181 | + }; | |
182 | + } | |
183 | + } | |
184 | +} | |
185 | + | |
186 | +#endif // __KOME_BASELINE_MSBACKADJ_MANAGER_H__ |
@@ -0,0 +1,3 @@ | ||
1 | +EXPORTS | |
2 | + msbackadjBaselineDetection | |
3 | + exitPlugin |
@@ -0,0 +1,115 @@ | ||
1 | +/** | |
2 | + * @file MsbackadjBaselineDetectionPluginFunctions.cpp | |
3 | + * @brief implementation of plug-in functions | |
4 | + * | |
5 | + * @author ozaki | |
6 | + * @date 2013.07.31 | |
7 | + * | |
8 | + * Copyright(C) 2006-2014 Shimadzu Corporation All rights reserved. | |
9 | + */ | |
10 | + | |
11 | + | |
12 | +#include "stdafx.h" | |
13 | +#include "MsbackadjBaselineDetectionPluginFunctions.h" | |
14 | +#include "MsbackadjBaselineDetectionManager.h" | |
15 | + | |
16 | + | |
17 | +using namespace kome::baseline::msbackadj; | |
18 | + | |
19 | + | |
20 | +#include <crtdbg.h> | |
21 | +#ifdef _DEBUG | |
22 | + #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ ) | |
23 | + #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ ) | |
24 | +#endif // _DEBUG | |
25 | + | |
26 | + | |
27 | + | |
28 | +// Define parameter names | |
29 | +#define PARAM_NAME_WINDOW_SIZE ( "window_size" ) | |
30 | +#define PARAM_NAME_STEP_SIZE ( "step_size" ) | |
31 | +#define PARAM_NAME_REGRESSION_METHOD ( "regression_method" ) | |
32 | +#define PARAM_NAME_ESTIMATION_METHOD ( "estimation_method" ) | |
33 | +#define PARAM_NAME_SMOOTHING_METHOD ( "smoothing_method" ) | |
34 | +#define PARAM_NAME_QUANTILE ( "quantile" ) | |
35 | + | |
36 | +// Define parameter initial value | |
37 | +#define PARAM_INIT_WINDOW_SIZE ( 200.0 ) | |
38 | +#define PARAM_INIT_STEP_SIZE ( 50.0 ) | |
39 | +#define PARAM_INIT_REGRESSION_METHOD ( 0 ) | |
40 | +#define PARAM_INIT_ESTIMATION_METHOD ( 0 ) | |
41 | +#define PARAM_INIT_SMOOTHING_METHOD ( 0 ) | |
42 | +#define PARAM_INIT_QUANTILE ( 0.1 ) | |
43 | + | |
44 | +// detect baseline | |
45 | +kome::objects::Variant msbackadjBaselineDetection( kome::objects::Parameters* params ) | |
46 | +{ | |
47 | + // return value | |
48 | + kome::objects::Variant ret; | |
49 | + | |
50 | + // get object | |
51 | + kome::core::XYData* src = kome::plugin::PluginCallTool::getXYData( params ); | |
52 | + if( src == NULL ) { | |
53 | + return ret; | |
54 | + } | |
55 | + kome::core::XYData* baseline = kome::plugin::PluginCallTool::getBaseline( params ); | |
56 | + if( baseline == NULL ) { | |
57 | + return ret; | |
58 | + } | |
59 | + | |
60 | + kome::objects::SettingParameterValues* settings = kome::plugin::PluginCallTool::getSettingValues( params ); | |
61 | + | |
62 | + // manager | |
63 | + MsbackadjBaselineDetectionManager &insManager = MsbackadjBaselineDetectionManager::getInstance( ); | |
64 | + | |
65 | + wxBeginBusyCursor( ); | |
66 | + | |
67 | + // set parameters | |
68 | + double dWindowSize = PARAM_INIT_WINDOW_SIZE; | |
69 | + double dStepSize = PARAM_INIT_STEP_SIZE; | |
70 | + int nRegressionMethod = PARAM_INIT_REGRESSION_METHOD; | |
71 | + int nEstimationMethod = PARAM_INIT_ESTIMATION_METHOD; | |
72 | + int nSmoothingMethod = PARAM_INIT_SMOOTHING_METHOD; | |
73 | + double dQuantile = PARAM_INIT_QUANTILE; | |
74 | + | |
75 | + if ( (kome::objects::SettingParameterValues *)NULL != settings ) | |
76 | + { | |
77 | + dWindowSize = settings->getDoubleValue( PARAM_NAME_WINDOW_SIZE, dWindowSize ); | |
78 | + dStepSize = settings->getDoubleValue( PARAM_NAME_STEP_SIZE, dStepSize ); | |
79 | + nRegressionMethod = settings->getIntValue( PARAM_NAME_REGRESSION_METHOD, nRegressionMethod ); | |
80 | + nEstimationMethod = settings->getIntValue( PARAM_NAME_ESTIMATION_METHOD, nEstimationMethod ); | |
81 | + nSmoothingMethod = settings->getIntValue( PARAM_NAME_SMOOTHING_METHOD, nSmoothingMethod ); | |
82 | + dQuantile = settings->getDoubleValue( PARAM_NAME_QUANTILE, dQuantile ); | |
83 | + } | |
84 | + | |
85 | + insManager.setWindowSize( dWindowSize ); | |
86 | + insManager.setStepSize( dStepSize ); | |
87 | + insManager.setRegressionMethod( nRegressionMethod ); | |
88 | + insManager.setEstimationMethod( nEstimationMethod ); | |
89 | + insManager.setSmoothingMethod( nSmoothingMethod ); | |
90 | + insManager.setQuantile( dQuantile ); | |
91 | + | |
92 | + // get baseline | |
93 | + insManager.getMsbackadj( *src, *baseline ); | |
94 | + | |
95 | + wxEndBusyCursor( ); | |
96 | + | |
97 | + return ret; | |
98 | +} | |
99 | + | |
100 | +// exit plugin | |
101 | +kome::objects::Variant exitPlugin( kome::objects::Parameters* params ) | |
102 | +{ | |
103 | + // retrun value | |
104 | + kome::objects::Variant ret; | |
105 | + | |
106 | + // get manager | |
107 | + MsbackadjBaselineDetectionManager &insManager = MsbackadjBaselineDetectionManager::getInstance( ); | |
108 | + | |
109 | + // release MATLAB application | |
110 | + insManager.releaseMatlab( ); | |
111 | + | |
112 | + return ret; | |
113 | +} | |
114 | + | |
115 | +// |
@@ -0,0 +1,41 @@ | ||
1 | +/** | |
2 | + * @file MsbackadjBaselineDetectionPluginFunctions.h | |
3 | + * @brief interfaces of plug-in functions | |
4 | + * | |
5 | + * @author ozaki | |
6 | + * @date 2013.07.31 | |
7 | + * | |
8 | + * Copyright(C) 2013-2013 Shimadzu Corporation All rights reserved. | |
9 | + */ | |
10 | + | |
11 | + | |
12 | +#ifndef __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_FUNCTIONS_H__ | |
13 | +#define __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_FUNCTIONS_H__ | |
14 | + | |
15 | + | |
16 | +#ifdef __unix | |
17 | + extern "C" { | |
18 | +#endif // __unix | |
19 | + | |
20 | +/** | |
21 | + * @fn kome::objects::Variant msbackadjBaselineDetection( kome::objects::Parameters* params ) | |
22 | + * @brief detects baseline | |
23 | + * @param params parameters information | |
24 | + * @return return value (This value has no meanings.) | |
25 | + */ | |
26 | +kome::objects::Variant msbackadjBaselineDetection( kome::objects::Parameters* params ); | |
27 | + | |
28 | +/** | |
29 | + * @fn kome::objects::Variant exitPlugin( kome::objects::Parameters* params ) | |
30 | + * @brief detect peaks | |
31 | + * @param[in] params parameters | |
32 | + * @return This value has no meanings. | |
33 | + */ | |
34 | +kome::objects::Variant exitPlugin( kome::objects::Parameters* params ); | |
35 | + | |
36 | +#ifdef __unix | |
37 | + } | |
38 | +#endif // __unix | |
39 | + | |
40 | + | |
41 | +#endif // __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_FUNCTIONS_H__ |
@@ -0,0 +1,19 @@ | ||
1 | +======================================================================== | |
2 | + Mass++ plug-in for common Shimadzu [C/C++]: | |
3 | + MsbackadjBaselineDetectionPlugin Project | |
4 | +======================================================================== | |
5 | + | |
6 | +plugin.xml | |
7 | + plug-in definition file | |
8 | + | |
9 | +stdafx.h | |
10 | + common header file | |
11 | + | |
12 | +MsbackadjBaselineDetectionPlugin.def | |
13 | + the list of exported functions | |
14 | + | |
15 | +MsbackadjBaselineDetectionPluginFunctions.h | |
16 | + header file of plug-in functions | |
17 | + | |
18 | +MsbackadjBaselineDetectionPluginFunctions.cpp | |
19 | + implementation of plug-in functions |
@@ -0,0 +1,67 @@ | ||
1 | +<?xml version="1.0"?> | |
2 | + | |
3 | +<plugin | |
4 | + xmlns="http://xml.first-ms3d.jp/masspp/plugin" | |
5 | + xsi:schemaLocation="http://xml.first-ms3d.jp/masspp/plugin http://first-ms3d.jp/development/masspp-plugin110.xsd" | |
6 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
7 | + <name>MsbackadjBaselineDetectionPlugin</name> | |
8 | + <version>1.00</version> | |
9 | + <provider>Shimadzu Corporation</provider> | |
10 | + <link>MsbackadjBaselineDetectionPlugin</link> | |
11 | + <function> | |
12 | + <call type="xydata_baseline"> | |
13 | + <call-name>detectBaseline</call-name> | |
14 | + <call-function>msbackadjBaselineDetection</call-function> | |
15 | + <packages> | |
16 | + <package>Data Processing</package> | |
17 | + </packages> | |
18 | + <params> | |
19 | + <param> | |
20 | + <param-name>long name</param-name> | |
21 | + <param-value>Msbackadj</param-value> | |
22 | + </param> | |
23 | + <param> | |
24 | + <param-name>short name</param-name> | |
25 | + <param-value>msbackadj</param-value> | |
26 | + </param> | |
27 | + <param> | |
28 | + <param-name>page</param-name> | |
29 | + <param-value>Baseline</param-value> | |
30 | + </param> | |
31 | + </params> | |
32 | + <call-description>detect baseline</call-description> | |
33 | + </call> | |
34 | + <call type="exit" ifloaded="true"> | |
35 | + <call-name>exit plugin</call-name> | |
36 | + <call-function>exitPlugin</call-function> | |
37 | + <call-description>exit plugin</call-description> | |
38 | + </call> | |
39 | + </function> | |
40 | + <components> | |
41 | + <component> | |
42 | + <component-name>MATLAB Function</component-name> | |
43 | + <component-desc>Baseline detection using MATLAB function(msbackadj)</component-desc> | |
44 | + <component-calls> | |
45 | + <component-call>detectBaseline</component-call> | |
46 | + <component-call>exit plugin</component-call> | |
47 | + </component-calls> | |
48 | + </component> | |
49 | + </components> | |
50 | + <packages> | |
51 | + <package> | |
52 | + <package-name>Quantitation</package-name> | |
53 | + <package-components> | |
54 | + <package-component>MATLAB Function</package-component> | |
55 | + </package-components> | |
56 | + </package> | |
57 | + <package> | |
58 | + <package-name>Data Processing</package-name> | |
59 | + <package-components> | |
60 | + <package-component>MATLAB Function</package-component> | |
61 | + </package-components> | |
62 | + </package> | |
63 | + </packages> | |
64 | + <parameters> | |
65 | + <parameters-file>settings.xml</parameters-file> | |
66 | + </parameters> | |
67 | +</plugin> |
@@ -0,0 +1,138 @@ | ||
1 | +<?xml version="1.0"?> | |
2 | + | |
3 | +<settings | |
4 | + xmlns="http://xml.first-ms3d.jp/masspp/settings" | |
5 | + xsi:schemaLocation="http://xml.first-ms3d.jp/masspp/settings http://first-ms3d.jp/development/masspp-settings110.xsd" | |
6 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
7 | + <values> | |
8 | + <value id="0" type="double" default="200.0" minInclusive="0" required="true" /> | |
9 | + <value id="1" type="double" default="200.0" minInclusive="0" required="true" /> | |
10 | + <value id="2" type="string" default="0" required="true"> | |
11 | + <enum> | |
12 | + <enum-name>pchip</enum-name> | |
13 | + <enum-value>0</enum-value> | |
14 | + </enum> | |
15 | + <enum> | |
16 | + <enum-name>liner</enum-name> | |
17 | + <enum-value>1</enum-value> | |
18 | + </enum> | |
19 | + <enum> | |
20 | + <enum-name>spline</enum-name> | |
21 | + <enum-value>2</enum-value> | |
22 | + </enum> | |
23 | + </value> | |
24 | + <value id="3" type="string" default="0" required="true"> | |
25 | + <enum> | |
26 | + <enum-name>quantile</enum-name> | |
27 | + <enum-value>0</enum-value> | |
28 | + </enum> | |
29 | + <enum> | |
30 | + <enum-name>em</enum-name> | |
31 | + <enum-value>1</enum-value> | |
32 | + </enum> | |
33 | + </value> | |
34 | + <value id="4" type="string" default="0" required="true"> | |
35 | + <enum> | |
36 | + <enum-name>none</enum-name> | |
37 | + <enum-value>0</enum-value> | |
38 | + </enum> | |
39 | + <enum> | |
40 | + <enum-name>lowess</enum-name> | |
41 | + <enum-value>1</enum-value> | |
42 | + </enum> | |
43 | + <enum> | |
44 | + <enum-name>loess</enum-name> | |
45 | + <enum-value>2</enum-value> | |
46 | + </enum> | |
47 | + <enum> | |
48 | + <enum-name>rlowess</enum-name> | |
49 | + <enum-value>3</enum-value> | |
50 | + </enum> | |
51 | + <enum> | |
52 | + <enum-name>rloess</enum-name> | |
53 | + <enum-value>4</enum-value> | |
54 | + </enum> | |
55 | + </value> | |
56 | + <value id="5" type="double" default="0.1" minInclusive="0" required="true" /> | |
57 | + </values> | |
58 | + <params> | |
59 | + <param id="0" value="0"> | |
60 | + <param-name>window_size</param-name> | |
61 | + <param-section>Msbackadj Baseline Detection</param-section> | |
62 | + <param-key>WINDOW_SIZE</param-key> | |
63 | + </param> | |
64 | + <param id="1" value="1"> | |
65 | + <param-name>step_size</param-name> | |
66 | + <param-section>Msbackadj Baseline Detection</param-section> | |
67 | + <param-key>STEP_SIZE</param-key> | |
68 | + </param> | |
69 | + <param id="2" value="2"> | |
70 | + <param-name>regression_method</param-name> | |
71 | + <param-section>Msbackadj Baseline Detection</param-section> | |
72 | + <param-key>REGRESSION_METHOD</param-key> | |
73 | + </param> | |
74 | + <param id="3" value="3"> | |
75 | + <param-name>estimation_method</param-name> | |
76 | + <param-section>Msbackadj Baseline Detection</param-section> | |
77 | + <param-key>ESTIMATION_METHOD</param-key> | |
78 | + </param> | |
79 | + <param id="4" value="4"> | |
80 | + <param-name>smoothing_method</param-name> | |
81 | + <param-section>Msbackadj Baseline Detection</param-section> | |
82 | + <param-key>SMOOTHING_METHOD</param-key> | |
83 | + </param> | |
84 | + <param id="5" value="5"> | |
85 | + <param-name>quantile</param-name> | |
86 | + <param-section>Msbackadj Baseline Detection</param-section> | |
87 | + <param-key>QUANTILE</param-key> | |
88 | + </param> | |
89 | + </params> | |
90 | + <pages> | |
91 | + <page common="false"> | |
92 | + <page-name>Baseline</page-name> | |
93 | + <page-title>Msbackadj Baseline</page-title> | |
94 | + <forms> | |
95 | + <form id="6" param="0"> | |
96 | + <form-title>Window Size (separation unit)</form-title> | |
97 | + <form-desc>Specify the width for the shifting window. | |
98 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail. </form-desc> | |
99 | + </form> | |
100 | + <form id="7" param="1"> | |
101 | + <form-title>Step Size (separation unit)</form-title> | |
102 | + <form-desc>Specify the steps for the shifting window. | |
103 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail.</form-desc> | |
104 | + </form> | |
105 | + <form id="8" param="2"> | |
106 | + <form-title>Regression Method</form-title> | |
107 | + <form-desc>Specifiy the method for regression line from following: | |
108 | +・pchip | |
109 | +・liner | |
110 | +・spline | |
111 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail.</form-desc> | |
112 | + </form> | |
113 | + <form id="9" param="3"> | |
114 | + <form-title>Estimation Method</form-title> | |
115 | + <form-desc>Specify the method for finding the likely baseline value in every window. | |
116 | + | |
117 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail.</form-desc> | |
118 | + </form> | |
119 | + <form id="10" param="4"> | |
120 | + <form-title>Smoothing Method</form-title> | |
121 | + <form-desc>Specify the smoothing method from following: | |
122 | +・none | |
123 | +・lowess | |
124 | +・loess | |
125 | +・rlowess | |
126 | +・rloess | |
127 | + | |
128 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail.</form-desc> | |
129 | + </form> | |
130 | + <form id="11" param="5"> | |
131 | + <form-title>Quantile Value</form-title> | |
132 | + <form-desc>Specify the quantile value. | |
133 | +Refer "msbackadj" function of Matlab Bioinfomatics Toolbox for more detail.</form-desc> | |
134 | + </form> | |
135 | + </forms> | |
136 | + </page> | |
137 | + </pages> | |
138 | +</settings> |
@@ -0,0 +1,136 @@ | ||
1 | +/** | |
2 | + * @file stdafx.h | |
3 | + * @brief common header file | |
4 | + * | |
5 | + * @author ozaki | |
6 | + * @date 2013.07.31 | |
7 | + * | |
8 | + * Copyright(C) 2006-2014 Shimadzu Corporation All rights reserved. | |
9 | + */ | |
10 | + | |
11 | + | |
12 | + | |
13 | +#ifndef __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_STD_AFX_H__ | |
14 | +#define __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_STD_AFX_H__ | |
15 | + | |
16 | + | |
17 | + | |
18 | +// | |
19 | +// namespace | |
20 | +// | |
21 | + | |
22 | +/// kome project namespace | |
23 | +namespace kome { | |
24 | +} | |
25 | + | |
26 | + | |
27 | +// | |
28 | +// macros | |
29 | +// | |
30 | + | |
31 | +#define WXUSINGDLL | |
32 | + | |
33 | + | |
34 | +// | |
35 | +// message | |
36 | +// | |
37 | + | |
38 | +#ifdef _MSC_VER | |
39 | + #pragma warning( disable:4190 ) | |
40 | + #pragma warning( disable:4244 ) | |
41 | + #pragma warning( disable:4251 ) | |
42 | + #pragma warning( disable:4267 ) | |
43 | + #pragma warning( disable:4561 ) | |
44 | + #pragma warning( disable:4793 ) | |
45 | + #pragma warning( disable:4819 ) | |
46 | + #pragma warning( disable:4996 ) | |
47 | +#endif // _MSC_VER | |
48 | + | |
49 | + | |
50 | +// | |
51 | +// libraries | |
52 | +// | |
53 | + | |
54 | +#ifdef _MSC_VER | |
55 | + #pragma comment( lib, "CoreFunctions" ) | |
56 | + #pragma comment( lib, "CoreToolkits" ) | |
57 | + #pragma comment( lib, "DataObjects" ) | |
58 | + #pragma comment( lib, "ImageManager" ) | |
59 | + #pragma comment( lib, "PluginTools" ) | |
60 | + #pragma comment( lib, "DbTools" ) | |
61 | + #pragma comment( lib, "DataOperation" ) | |
62 | + #pragma comment( lib, "EventManager" ) | |
63 | + #pragma comment( lib, "WindowManager" ) | |
64 | + #pragma comment( lib, "XMLTools" ) | |
65 | + #pragma comment( lib, "NetworkTools" ) | |
66 | + #pragma comment( lib, "GLTools" ) | |
67 | + #pragma comment( lib, "JavaTools" ) | |
68 | + #pragma comment( lib, "IdentificationTools" ) | |
69 | + | |
70 | + #ifdef _DEBUG | |
71 | + #pragma comment( lib, "wxbase28d" ) | |
72 | + #pragma comment( lib, "wxbase28d_net" ) | |
73 | + #pragma comment( lib, "wxbase28d_xml" ) | |
74 | + #pragma comment( lib, "wxexpatd" ) | |
75 | + #pragma comment( lib, "wxjpegd" ) | |
76 | + #pragma comment( lib, "wxmsw28d_adv" ) | |
77 | + #pragma comment( lib, "wxmsw28d_aui" ) | |
78 | + #pragma comment( lib, "wxmsw28d_core" ) | |
79 | + #pragma comment( lib, "wxmsw28d_gl" ) | |
80 | + #pragma comment( lib, "wxmsw28d_html" ) | |
81 | + #pragma comment( lib, "wxmsw28d_media" ) | |
82 | + #pragma comment( lib, "wxmsw28d_qa" ) | |
83 | + #pragma comment( lib, "wxmsw28d_richtext" ) | |
84 | + #pragma comment( lib, "wxmsw28d_xrc" ) | |
85 | + #pragma comment( lib, "wxpngd" ) | |
86 | + #pragma comment( lib, "wxregexd" ) | |
87 | + #pragma comment( lib, "wxtiffd" ) | |
88 | + #pragma comment( lib, "wxzlibd" ) | |
89 | + | |
90 | + #pragma comment( lib, "xerces-c_3D" ) | |
91 | + #else | |
92 | + #pragma comment( lib, "wxbase28" ) | |
93 | + #pragma comment( lib, "wxbase28_net" ) | |
94 | + #pragma comment( lib, "wxbase28_xml" ) | |
95 | + #pragma comment( lib, "wxexpat" ) | |
96 | + #pragma comment( lib, "wxjpeg" ) | |
97 | + #pragma comment( lib, "wxmsw28_adv" ) | |
98 | + #pragma comment( lib, "wxmsw28_aui" ) | |
99 | + #pragma comment( lib, "wxmsw28_core" ) | |
100 | + #pragma comment( lib, "wxmsw28_gl" ) | |
101 | + #pragma comment( lib, "wxmsw28_html" ) | |
102 | + #pragma comment( lib, "wxmsw28_media" ) | |
103 | + #pragma comment( lib, "wxmsw28_qa" ) | |
104 | + #pragma comment( lib, "wxmsw28_richtext" ) | |
105 | + #pragma comment( lib, "wxmsw28_xrc" ) | |
106 | + #pragma comment( lib, "wxpng" ) | |
107 | + #pragma comment( lib, "wxregex" ) | |
108 | + #pragma comment( lib, "wxtiff" ) | |
109 | + #pragma comment( lib, "wxzlib" ) | |
110 | + | |
111 | + #pragma comment( lib, "xerces-c_3" ) | |
112 | + #endif // _DEBUG | |
113 | +#endif // _MSC_VER | |
114 | + | |
115 | + | |
116 | +// | |
117 | +// includes | |
118 | +// | |
119 | + | |
120 | +#include "kome/CoreFunctions.h" | |
121 | +#include "kome/CoreToolkits.h" | |
122 | +#include "kome/DataObjects.h" | |
123 | +#include "kome/ImageManager.h" | |
124 | +#include "kome/PluginTools.h" | |
125 | +#include "kome/DbTools.h" | |
126 | +#include "kome/DataOperation.h" | |
127 | +#include "kome/EventManager.h" | |
128 | +#include "kome/WindowManager.h" | |
129 | +#include "kome/XMLTools.h" | |
130 | +#include "kome/NetworkTools.h" | |
131 | +#include "kome/GLTools.h" | |
132 | +#include "kome/JavaTools.h" | |
133 | +#include "kome/IdentificationTools.h" | |
134 | + | |
135 | + | |
136 | +#endif // __KOME_MSBACKADJ_BASELINE_DETECTION_PLUGIN_STD_AFX_H__ |