| @@ 30-63 (lines=34) @@ | ||
| 27 | from savu.plugins.utils import register_plugin |
|
| 28 | ||
| 29 | ||
| 30 | @register_plugin |
|
| 31 | class PluginTemplate10(Plugin, CpuPlugin): |
|
| 32 | ||
| 33 | def __init__(self, name="PluginTemplate10"): |
|
| 34 | super(PluginTemplate10, self).__init__(name) |
|
| 35 | self.nOut = None |
|
| 36 | ||
| 37 | def nInput_datasets(self): |
|
| 38 | return max(len(self.parameters['in_datasets']), 1) |
|
| 39 | ||
| 40 | def nOutput_datasets(self): |
|
| 41 | return 1 |
|
| 42 | ||
| 43 | def setup(self): |
|
| 44 | in_dataset, out_dataset = self.get_datasets() |
|
| 45 | in_pData, out_pData = self.get_plugin_datasets() |
|
| 46 | ||
| 47 | for i in range(len(in_dataset)): |
|
| 48 | in_pData[i].plugin_data_setup('SINOGRAM', 'single') |
|
| 49 | ||
| 50 | out_dataset[0].create_dataset(in_dataset[0]) |
|
| 51 | out_pData[0].plugin_data_setup('SINOGRAM', 'single') |
|
| 52 | ||
| 53 | ||
| 54 | def pre_process(self): |
|
| 55 | pass |
|
| 56 | ||
| 57 | def process_frames(self, data): |
|
| 58 | # data will be a list of numpy arrays of the specified length |
|
| 59 | # do some processing here |
|
| 60 | return data[0] |
|
| 61 | ||
| 62 | def post_process(self): |
|
| 63 | pass |
|
| @@ 30-60 (lines=31) @@ | ||
| 27 | from savu.plugins.utils import register_plugin |
|
| 28 | ||
| 29 | ||
| 30 | @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 |
|