1
|
|
|
# Copyright 2014 Diamond Light Source Ltd. |
2
|
|
|
# |
3
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
# |
7
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
# |
9
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
# limitations under the License. |
14
|
|
|
|
15
|
|
|
""" |
16
|
|
|
.. module:: plugin_template8 |
17
|
|
|
:platform: Unix |
18
|
|
|
:synopsis: A template to create a simple plugin that takes one dataset as\ |
19
|
|
|
input and returns a similar dataset as output. |
20
|
|
|
|
21
|
|
|
.. moduleauthor:: Developer Name <[email protected]> |
22
|
|
|
|
23
|
|
|
""" |
24
|
|
|
|
25
|
|
|
from savu.plugins.plugin import Plugin |
26
|
|
|
from savu.plugins.driver.cpu_plugin import CpuPlugin |
27
|
|
|
from savu.plugins.utils import register_plugin |
28
|
|
|
|
29
|
|
|
|
30
|
|
View Code Duplication |
@register_plugin |
|
|
|
|
31
|
|
|
class PluginTemplate8(Plugin, CpuPlugin): |
32
|
|
|
|
33
|
|
|
def __init__(self, name="PluginTemplate8"): |
34
|
|
|
super(PluginTemplate8, self).__init__(name) |
35
|
|
|
self.nOut = None |
36
|
|
|
|
37
|
|
|
def nInput_datasets(self): |
38
|
|
|
return 1 |
39
|
|
|
|
40
|
|
|
def nOutput_datasets(self): |
41
|
|
|
return len(self.parameters['out_datasets']) |
42
|
|
|
|
43
|
|
|
def setup(self): |
44
|
|
|
in_dataset, out_dataset = self.get_datasets() |
45
|
|
|
in_pData, out_pData = self.get_plugin_datasets() |
46
|
|
|
in_pData[0].plugin_data_setup('SINOGRAM', 'single') |
47
|
|
|
|
48
|
|
|
for i in range(len(out_dataset)): |
49
|
|
|
out_dataset[i].create_dataset(in_dataset[0]) |
50
|
|
|
out_pData[i].plugin_data_setup('SINOGRAM', 'single') |
51
|
|
|
|
52
|
|
|
def pre_process(self): |
53
|
|
|
pass |
54
|
|
|
|
55
|
|
|
def process_frames(self, data): |
56
|
|
|
# do some processing here |
57
|
|
|
return [data[0], data[0]] |
58
|
|
|
|
59
|
|
|
def post_process(self): |
60
|
|
|
pass |