EMAN2
processor_template.cpp
Go to the documentation of this file.
1/*
2 * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31
32#include "processor_template.h"
33
34using namespace EMAN;
35
36
37const string XYZProcessor::NAME = "xyz";
38
42{
43 if (!image) {
44 return;
45 }
46
47
48 // The following are the sample code to get your parameters. Then
49 // go through the image data pixel.
50#if 0
51 int value1 = params["value1"];
52 float value2 = params["value2"];
53
54 float *data = image->get_data();
55 int size = image->get_xsize() * image->get_ysize() * image->get_zsize();
56 for (int i = 0; i < size; i++) {
57 if (data[i] <= value1 && data[i] >= value2) {
58 data[i] = 0;
59 }
60 }
61#endif
62
63}
64
65
66// void SubstituteZeroPixelsProcessor::process_inplace(EMData* image)
67// {
68// EMData* null = 0;
69// EMData* other_image = params.set_default("image", null);
70//
71// if (other_image == 0 ) throw NullPointerException("Error, the EMData pointer set in the params was null");
72//
73// int nx = image->get_xsize();
74// int ny = image->get_ysize();
75// int nz = image->get_zsize();
76//
77// if ( nx != other_image->get_xsize() ) throw ImageDimensionException("Error, the parameter image's x dimension did not match the argument image's x dimension");
78// if ( ny != other_image->get_ysize() ) throw ImageDimensionException("Error, the parameter image's y dimension did not match the argument image's y dimension");
79// if ( nz != other_image->get_zsize() ) throw ImageDimensionException("Error, the parameter image's z dimension did not match the argument image's z dimension");
80//
81// if ( image->is_complex() != other_image->is_complex() ) throw ImageFormatException("Error, the image formats did not match - only one of the images is complex");
82//
83// int size = nx*ny*nz;
84// float* image_data = image->get_data();
85// float* other_image_data = other_image->get_data();
86//
87//
88// if ( image->is_complex() ) {
89// for(int i = 0; i < size/2; ++i ) {
90// if ( fabs(image_data[2*i]) < 0.00001 && fabs(image_data[2*i+1]) < 0.00001 ) {
91// image_data[2*i] = other_image_data[2*i];
92// image_data[2*i+1] = other_image_data[2*i+1];
93// }
94// }
95// }
96// else {
97//
98// for(int i = 0; i < size; ++i ) {
99// if ( image_data[i] == 0 ) {
100// image_data[i] = other_image_data[i];
101// }
102// }
103// }
104// }
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
void process_inplace(const string &processorname, const Dict &params=Dict())
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....
E2Exception class.
Definition: aligner.h:40