#include <volume_data.h>
Collaboration diagram for wustl_mm::SkeletonMaker::VolumeData:

Public Member Functions | |
| VolumeData (EMData *em) | |
| VolumeData (int sizeX, int sizeY, int sizeZ) | |
| VolumeData (int sizeX, int sizeY, int sizeZ, float val) | |
| VolumeData (int sizeX, int sizeY, int sizeZ, int offsetX, int offsetY, int offsetZ, VolumeData *data) | |
| VolumeData (VolumeData &obj) | |
| ~VolumeData () | |
| int | GetSize (int dimension) |
| int | GetSizeX () |
| int | GetSizeY () |
| int | GetSizeZ () |
| float | GetSpacing (int dimension) |
| float | GetSpacingX () |
| float | GetSpacingY () |
| float | GetSpacingZ () |
| float | GetOrigin (int dimension) |
| float | GetOriginX () |
| float | GetOriginY () |
| float | GetOriginZ () |
| float | GetDataAt (int x, int y, int z) |
| float | GetDataAt (int index) |
| int | GetIndex (int x, int y, int z) |
| int | GetMaxIndex () |
| void | SetSpacing (float spacingX, float spacingY, float spacingZ) |
| void | SetOrigin (float originX, float originY, float originZ) |
| void | SetDataAt (int x, int y, int z, float value) |
| void | SetDataAt (int index, float value) |
| void | Pad (int padBy, double padValue) |
| EMData * | get_emdata () |
Public Attributes | |
| bool | owns_emdata |
Private Member Functions | |
| void | InitializeVolumeData (int sizeX, int sizeY, int sizeZ, float spacingX, float spacingY, float spacingZ, float originX, float originY, float originZ, bool initializeData, float val) |
| void | SetSize (int sizeX, int sizeY, int sizeZ) |
Private Attributes | |
| EMData * | emdata |
|
|
Definition at line 9 of file volume_data.cpp. References emdata, and owns_emdata. 00010 {
00011 this->emdata = em;
00012 owns_emdata = false;
00013 }
|
|
||||||||||||||||
|
Definition at line 15 of file volume_data.cpp. References InitializeVolumeData(). 00015 {
00016 InitializeVolumeData(sizeX, sizeY, sizeZ, 1, 1, 1, 0, 0, 0, true, 0);
00017 }
|
|
||||||||||||||||||||
|
Definition at line 19 of file volume_data.cpp. References InitializeVolumeData(). 00019 {
00020 InitializeVolumeData(sizeX, sizeY, sizeZ, 1, 1, 1, 0, 0, 0, true, val);
00021 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 23 of file volume_data.cpp. References data, GetDataAt(), GetOriginX(), GetOriginY(), GetOriginZ(), GetSpacingX(), GetSpacingY(), GetSpacingZ(), InitializeVolumeData(), and SetDataAt(). 00023 {
00024 InitializeVolumeData(sizeX, sizeY, sizeZ, data->GetSpacingX(), data->GetSpacingY(), data->GetSpacingZ(), data->GetOriginX(), data->GetOriginY(), data->GetOriginZ(), false, 0);
00025 float value;
00026 for ( int k = offsetZ; k < sizeZ + offsetZ; k++) {
00027 for (int j = offsetY; j < sizeY + offsetY; j++ ) {
00028 for (int i = offsetX; i < sizeX + offsetX; i++) {
00029 value = data->GetDataAt(i,j,k);
00030 SetDataAt(i-offsetX,j-offsetY,k-offsetZ, value);
00031 }
00032 }
00033 }
00034 }
|
|
|
Definition at line 36 of file volume_data.cpp. References emdata, get_emdata(), and owns_emdata. 00037 {
00038 emdata = new EMData( *obj.get_emdata() );
00039 owns_emdata = true;
00040 //SetSize( obj.GetSizeX(), obj.GetSizeY(), obj.GetSizeZ() );
00041 //SetSpacing( obj.GetSpacingX(), obj.GetSpacingY(), obj.GetSpacingZ() );
00042 //SetOrigin( obj.GetOriginX(), GetOriginY(), obj.GetOriginZ() );
00043 }
|
|
|
Definition at line 44 of file volume_data.cpp. 00044 {
00045 if (owns_emdata)
00046 delete emdata;
00047 }
|
|
|
Definition at line 166 of file volume_data.cpp. Referenced by wustl_mm::SkeletonMaker::Volume::get_emdata(), and VolumeData(). 00167 {
00168 return emdata;
00169 }
|
|
|
Definition at line 153 of file volume_data.cpp. References emdata, and EMAN::EMData::get_value_at(). 00153 {
00154 //TODO: This may be a problem because EMAN2 and Gorgon do indexing differently --> see if this causes problems
00155 return emdata->get_value_at(index);
00156 }
|
|
||||||||||||||||
|
Definition at line 149 of file volume_data.cpp. References emdata, EMAN::EMData::get_value_at(), x, and y. Referenced by wustl_mm::SkeletonMaker::Volume::getDataAt(), Pad(), and VolumeData(). 00149 {
00150 return this->emdata->get_value_at(x, y, z);
00151 }
|
|
||||||||||||||||
|
Definition at line 158 of file volume_data.cpp. References GetSizeX(), GetSizeY(), x, and y. Referenced by wustl_mm::SkeletonMaker::Volume::getIndex().
|
|
|
Definition at line 162 of file volume_data.cpp. References GetSizeX(), GetSizeY(), and GetSizeZ().
|
|
|
Definition at line 119 of file volume_data.cpp. References GetOriginX(), GetOriginY(), GetOriginZ(), and InvalidParameterException. 00119 {
00120 float ret = 0;
00121 switch (dimension)
00122 {
00123 case 0: ret = GetOriginX();
00124 break;
00125 case 1: ret = GetOriginY();
00126 break;
00127 case 2: ret = GetOriginZ();
00128 break;
00129 default:
00130 throw InvalidParameterException("VolumeData::GetOrigin requires an argument of 0, 1, or 2");
00131 }
00132
00133 return ret;
00134 }
|
|
|
Definition at line 136 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetOrigin(), wustl_mm::SkeletonMaker::Volume::getOriginX(), and VolumeData().
|
|
|
Definition at line 140 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetOrigin(), wustl_mm::SkeletonMaker::Volume::getOriginY(), and VolumeData().
|
|
|
Definition at line 144 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetOrigin(), wustl_mm::SkeletonMaker::Volume::getOriginZ(), and VolumeData().
|
|
|
Definition at line 60 of file volume_data.cpp. References GetSizeX(), GetSizeY(), GetSizeZ(), and InvalidParameterException. 00060 {
00061 int ret = 0;
00062 switch (dimension)
00063 {
00064 case 0: ret = GetSizeX();
00065 break;
00066 case 1: ret = GetSizeY();
00067 break;
00068 case 2: ret = GetSizeZ();
00069 break;
00070 default:
00071 throw InvalidParameterException("VolumeData::GetSize requires an argument of 0, 1, or 2");
00072 }
00073
00074 return ret;
00075
00076 }
|
|
|
Definition at line 78 of file volume_data.cpp. References emdata, and EMAN::EMData::get_xsize(). Referenced by GetIndex(), GetMaxIndex(), GetSize(), wustl_mm::SkeletonMaker::Volume::getSizeX(), and Pad().
|
|
|
Definition at line 82 of file volume_data.cpp. References emdata, and EMAN::EMData::get_ysize(). Referenced by GetIndex(), GetMaxIndex(), GetSize(), wustl_mm::SkeletonMaker::Volume::getSizeY(), and Pad().
|
|
|
Definition at line 86 of file volume_data.cpp. References emdata, and EMAN::EMData::get_zsize(). Referenced by GetMaxIndex(), GetSize(), wustl_mm::SkeletonMaker::Volume::getSizeZ(), and Pad().
|
|
|
Definition at line 90 of file volume_data.cpp. References GetSpacingX(), GetSpacingY(), GetSpacingZ(), and InvalidParameterException. 00090 {
00091 float ret = 0;
00092 switch (dimension)
00093 {
00094 case 0: ret = GetSpacingX();
00095 break;
00096 case 1: ret = GetSpacingY();
00097 break;
00098 case 2: ret = GetSpacingZ();
00099 break;
00100 default:
00101 throw InvalidParameterException("VolumeData::GetSpacing requires an argument of 0, 1, or 2");
00102 }
00103
00104 return ret;
00105 }
|
|
|
Definition at line 107 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetSpacing(), wustl_mm::SkeletonMaker::Volume::getSpacingX(), and VolumeData().
|
|
|
Definition at line 111 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetSpacing(), wustl_mm::SkeletonMaker::Volume::getSpacingY(), and VolumeData().
|
|
|
Definition at line 115 of file volume_data.cpp. References emdata, and EMAN::EMData::get_attr(). Referenced by GetSpacing(), wustl_mm::SkeletonMaker::Volume::getSpacingZ(), and VolumeData().
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 49 of file volume_data.cpp. References emdata, owns_emdata, SetOrigin(), SetSpacing(), and EMAN::EMData::to_value(). Referenced by VolumeData(). 00049 {
00050 emdata = new EMData(sizeX, sizeY, sizeZ);
00051 owns_emdata = true;
00052 //SetSize(sizeX, sizeY, sizeZ);
00053 SetSpacing(spacingX, spacingY, spacingZ);
00054 SetOrigin(originX, originY, originZ);
00055 if(initializeData) {
00056 emdata->to_value(val);
00057 }
00058 }
|
|
||||||||||||
|
Definition at line 196 of file volume_data.cpp. References emdata, GetDataAt(), GetSizeX(), GetSizeY(), GetSizeZ(), EMAN::EMData::set_data(), SetSize(), x, and y. Referenced by wustl_mm::SkeletonMaker::Volume::pad(). 00196 {
00197
00198 int sizex = GetSizeX();
00199 int sizey = GetSizeY();
00200 int sizez = GetSizeZ();
00201 int newSizeX = sizex + 2*padBy;
00202 int newSizeY = sizey + 2*padBy;
00203 int newSizeZ = sizez + 2*padBy;
00204
00205 // Method 1: Using get_clip ===========================================================
00206 // Region reg(0, 0, 0, newSizeX, newSizeY, newSizeZ);
00207 // EMData * new_emdata = emdata->get_clip(reg); //Extends the area x > sizex, y > sizey, z > sizez but does not translate (0,0,0)
00208 // new_emdata->translate(padBy,padBy,padBy); //We want equal padding on each side
00209 //
00210 // for(int z = 0; z < newSizeZ; z++)
00211 // for(int y = 0; y < newSizeY; y++)
00212 // for(int x = 0; x < newSizeX; x++)
00213 // if ((x < padBy) || (y < padBy) || (z < padBy) || (x >= padBy + sizex) || (y >= padBy + sizey) || (z >= padBy + sizez))
00214 // new_emdata->set_value_at(x, y, z, padValue);
00215 //
00216 // if (this->owns_emdata)
00217 // this->emdata->free_memory();
00218 // this->emdata = new_emdata;
00219
00220 // Method 2: making a copy =============================================================
00221 float * newData = (float*) malloc ( newSizeX * newSizeY * newSizeZ * sizeof(float) );
00222 double value;
00223
00224 for(int z = 0; z < newSizeZ; z++) {
00225 for(int y = 0; y < newSizeY; y++) {
00226 for(int x = 0; x < newSizeX; x++) {
00227 if ((x < padBy) || (y < padBy) || (z < padBy) || (x >= padBy + sizex) || (y >= padBy + sizey) || (z >= padBy + sizez)) {
00228 value = padValue;
00229 } else {
00230 value = GetDataAt(x-padBy, y-padBy, z-padBy);
00231 }
00232
00233 newData[x + y * newSizeX + z * newSizeX * newSizeY] = static_cast<float>(value); //eman2
00234 }
00235 }
00236 }
00237
00238 SetSize(newSizeX, newSizeY, newSizeZ);
00239 emdata->set_data(newData, newSizeX, newSizeY, newSizeZ);
00240 //free(data); //I think this is handled by set_data
00241
00242 // Method 3: doing in-place resize =====================================================
00243 // emdata->set_size(newSizeX, newSizeY, newSizeZ);
00244 // double val;
00245 // for (int k = newSizeZ - 1; k >= 0; k--)
00246 // for (int j = newSizeY - 1; k >= 0; j--)
00247 // for (int i = newSizeX - 1; k >=0; k--)
00248 // {
00249 // if ( i < padBy || i >= sizex+padBy || j < padBy || j >= sizey+padBy || k < padBy || k >= sizez+padBy)
00250 // emdata->set_value_at(i,j,k, padValue);
00251 // else
00252 // {
00253 // val = emdata->get_value_at(i-padBy, j-padBy, k-padBy);
00254 // emdata->set_value_at(i,j,k, float(val));
00255 // }
00256 // }
00257 }
|
|
||||||||||||
|
Definition at line 192 of file volume_data.cpp. References emdata, and EMAN::EMData::get_data(). 00192 {
00193 //TODO: This may be a problem because EMAN2 and Gorgon do indexing differently --> see if this causes problems
00194 emdata->get_data()[index] = value;
00195 }
|
|
||||||||||||||||||||
|
Definition at line 188 of file volume_data.cpp. References emdata, EMAN::EMData::set_value_at(), x, and y. Referenced by wustl_mm::SkeletonMaker::Volume::setDataAt(), and VolumeData(). 00188 {
00189 emdata->set_value_at(x, y, z, value);
00190 }
|
|
||||||||||||||||
|
Definition at line 177 of file volume_data.cpp. References emdata, and EMAN::EMData::set_attr(). Referenced by InitializeVolumeData(), and wustl_mm::SkeletonMaker::Volume::setOrigin(). 00177 {
00178 emdata->set_attr("origin_x", originX);
00179 emdata->set_attr("origin_y", originY);
00180 emdata->set_attr("origin_z", originZ);
00181 }
|
|
||||||||||||||||
|
Definition at line 184 of file volume_data.cpp. References emdata, and EMAN::EMData::set_size(). Referenced by Pad().
|
|
||||||||||||||||
|
Definition at line 171 of file volume_data.cpp. References emdata, and EMAN::EMData::set_attr(). Referenced by InitializeVolumeData(), and wustl_mm::SkeletonMaker::Volume::setSpacing(). 00171 {
00172 emdata->set_attr("apix_x", spacingX);
00173 emdata->set_attr("apix_y", spacingY);
00174 emdata->set_attr("apix_z", spacingZ);
00175 }
|
|
|
Definition at line 54 of file volume_data.h. Referenced by GetDataAt(), GetOriginX(), GetOriginY(), GetOriginZ(), GetSizeX(), GetSizeY(), GetSizeZ(), GetSpacingX(), GetSpacingY(), GetSpacingZ(), InitializeVolumeData(), Pad(), SetDataAt(), SetOrigin(), SetSize(), SetSpacing(), and VolumeData(). |
|
|
Definition at line 52 of file volume_data.h. Referenced by InitializeVolumeData(), EMAN::BinarySkeletonizerProcessor::process(), and VolumeData(). |
1.3.9.1