diff --git a/CMake/Whitelists/ClassificationCmdApps.cmake b/CMake/Whitelists/ClassificationCmdApps.cmake index a8b1d36b671..19011af6132 100644 --- a/CMake/Whitelists/ClassificationCmdApps.cmake +++ b/CMake/Whitelists/ClassificationCmdApps.cmake @@ -9,8 +9,6 @@ list(APPEND enabled_modules CLImportanceWeighting Segmentation DataCollection - IpSegmentation - IpFunc SurfaceInterpolation GraphAlgorithms ImageStatistics diff --git a/CMake/Whitelists/FlowBenchSegmentation.cmake b/CMake/Whitelists/FlowBenchSegmentation.cmake index 1f2ac2ac733..da16f6fad7a 100644 --- a/CMake/Whitelists/FlowBenchSegmentation.cmake +++ b/CMake/Whitelists/FlowBenchSegmentation.cmake @@ -25,8 +25,6 @@ set(enabled_modules SegmentationUI PlanarFigure Annotation - IpSegmentation - IpFunc SurfaceInterpolation GraphAlgorithms ImageExtraction diff --git a/Documentation/doxygen.conf.in b/Documentation/doxygen.conf.in index 8a46babe1b7..79bb026e21a 100644 --- a/Documentation/doxygen.conf.in +++ b/Documentation/doxygen.conf.in @@ -800,9 +800,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = "@MITK_SOURCE_DIR@/Utilities/IpFunc/" \ - "@MITK_SOURCE_DIR@/Utilities/IpSegmentation/" \ - "@MITK_SOURCE_DIR@/Utilities/qtsingleapplication/" \ +EXCLUDE = "@MITK_SOURCE_DIR@/Utilities/qtsingleapplication/" \ "@MITK_SOURCE_DIR@/Applications/PluginGenerator/" \ "@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/doc/snippets/" \ "@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/doc/doxygen/standalone/" \ diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 1b090440c7d..c1f812e7209 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -1,18 +1,5 @@ SUPPRESS_ALL_WARNINGS() -# most stuff of these uses itk_zlib.h (via mitkIpPic.h) -find_package(ITK) -set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) -include(${ITK_USE_FILE}) - -# some legacy util files include in the old style with prefixed directory, -# like #include -include_directories(.) - -add_subdirectory(IpPic) -add_subdirectory(IpFunc) -add_subdirectory(IpSegmentation) - set(MITK_MODULE_NAME_REGEX_MATCH ) set(MITK_MODULE_NAME_REGEX_NOT_MATCH ) set(MITK_MODULE_NAME_PREFIX ) diff --git a/Utilities/IpFunc/AddC.c b/Utilities/IpFunc/AddC.c deleted file mode 100644 index a86c56448dc..00000000000 --- a/Utilities/IpFunc/AddC.c +++ /dev/null @@ -1,250 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function adds a constant to an image - */ - -/** @brief adds a constant to an image - * @param pic_old pointer to the first image - * @param value constant which is added to image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures - * is kept (if there will be an - * over-/underflow the max. or min. - * possible greyvalue is taken) - * @param pic_return - memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * @author Antje Schroeder - * @date 01.08.95 - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncAddC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define ADDC( type_1, pic_1, pic_new, value ) \ -{ \ - mitkIpPicFORALL_3 ( ADDC2, pic_new, pic_1, type_1, value ); \ -} \ - - -#define ADDC2( type_n, pic_new, pic_1, type_1, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = ( type_n ) \ - ( value + (( type_1 * ) pic_1->data ) [i] ); \ - } \ -} - -#define ADDC3( type_n, pic_1, pic_new, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_n help; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help + value ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help + value ) ? \ - ( (type_n)help + (type_n)value ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncAddC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check value */ - - if ( value == 0. ) return ( pic_old ); - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_old, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 + value; - smin = min1 + value; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_old->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( ADDC, pic_old, pic_new, value ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( ADDC3, pic_old, pic_new, value ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/AddI.c b/Utilities/IpFunc/AddI.c deleted file mode 100644 index bc082023eda..00000000000 --- a/Utilities/IpFunc/AddI.c +++ /dev/null @@ -1,279 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file -* this function adds two images -*/ - -/** @brief adds two images - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncAddI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncAddI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define ADDI( type_1, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpPicFORALL_3 ( ADDI2, pic_new, pic_1, pic_2, type_1 ); \ -} \ - - -#define ADDI2( type_n, pic_new, pic_1, pic_2, type_1 ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = ( type_n ) \ - ( (( type_1 * ) pic_1->data ) [i] + \ - (( type_1 * ) pic_2->data ) [i] ); \ - } \ -} - -#define ADDI3( type_n, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no_elem; \ - type_n help; \ - type_n help2; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - help2 = (( type_n * ) pic_2->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help + ( mitkIpFloat8_t ) help2 ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help + ( mitkIpFloat8_t ) help2 ) ? \ - ( (type_n)help + (type_n)help2 ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncAddI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t min2, max2; /* extreme greyvalues of 2. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* ckeck whether data are correct */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check whether images have the same size */ - - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_1->type, pic_1->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mitkIpFuncExtr ( pic_2, &min2, &max2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 + max2; - smin = min1 + min2; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_1->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( ADDI, pic_1, pic_2, pic_new ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( ADDI3, pic_1, pic_2, pic_new ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/AddSl.c b/Utilities/IpFunc/AddSl.c deleted file mode 100644 index 2c8ca6a6cdd..00000000000 --- a/Utilities/IpFunc/AddSl.c +++ /dev/null @@ -1,251 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file -* this function adds all slices of an image -*/ - -/**this function adds all slices of an image - * @param pic pointer to the 3D image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep: image data type of original pictures - * is kept (if there will be an - * over-/underflow the max. or min. - * possible greyvalue is taken) - * - * @RETURN pointer to the new 2D image - * - * @AUTHOR Antje Schroeder - * @DATE 01.08.95 - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncAddSl( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t keep ); - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define ADDSL( type_old, pic_old, pic_new ) \ -{ \ - mitkIpPicFORALL_2 ( ADDSL2, pic_new, pic_old, type_old ); \ -} - -#define ADDSL2( type_new, pic_new, pic_old, type_old ) \ -{ \ - mitkIpUInt4_t i, j; /* loop counter */ \ - mitkIpUInt4_t off_old; /* offset in 3D image */ \ - mitkIpUInt4_t slice_size; /* size of one image slice */ \ - \ - slice_size = _mitkIpPicElements ( pic_new ); \ - for ( i = 0; i < pic_old->n[2]; i++ ) \ - { \ - off_old = i * slice_size; \ - for ( j = 0; j < slice_size; j++ ) \ - (( type_new *)pic_new->data)[j] = \ - (( type_new *)pic_new->data)[j] + \ - ( type_new )(( type_old *)pic_old->data)[j+off_old]; \ - } \ -} - -#define ADDSL3( type, pic_old, pic_new ) \ -{ \ - mitkIpUInt4_t i, j; /* loop counter */ \ - mitkIpUInt4_t off_old; /* offset in 3D image */ \ - mitkIpUInt4_t slice_size; /* size of one image slice */ \ - type help, help2; \ - \ - slice_size = _mitkIpPicElements ( pic_new ); \ - for ( i = 0; i < pic_old->n[2]; i++ ) \ - { \ - off_old = i * slice_size; \ - for ( j = 0; j < slice_size; j++ ) \ - { \ - help = (( type *)pic_old->data)[j+off_old]; \ - help2 = (( type *)pic_new->data)[j]; \ - (( type *)pic_new->data)[j] = \ - ( max_gv > ( mitkIpFloat8_t ) help + help2 ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help + help2 ) ? \ - ( (type)help + (type)help2 ) : (type) min_gv ) : \ - (type) max_gv; \ - } \ - } \ -} - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncAddSl( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t keep ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_old, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = pic_old->n[2] * max1; - smin = pic_old->n[2] * min1; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_old->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_new->dim = 2; - pic_new->n[2] = 0; - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_1 ( ADDSL, pic_old, pic_new ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_1 ( ADDSL3, pic_old, pic_new ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/And.c b/Utilities/IpFunc/And.c deleted file mode 100644 index 32a380eed2b..00000000000 --- a/Utilities/IpFunc/And.c +++ /dev/null @@ -1,145 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file -* this function connects two images using AND -*/ - -/** @brief connects two images using AND - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * @author Antje Schroeder - * @date 08.06.95 - * - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - - mitkIpPicDescriptor *mitkIpFuncAnd ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncAnd\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of invert-macro */ - -#define AND( type, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i; \ - \ - \ - for ( i = 0; i < _mitkIpPicElements ( pic_1 ); i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - ( (( type * ) pic_1->data ) [i] && \ - (( type * ) pic_2->data ) [i] ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - - - mitkIpPicDescriptor *mitkIpFuncAnd ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ) - { - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - - /* check whether images have the same size */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - /* allocate new iumage */ - - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to connect two images using AND */ - - mitkIpPicFORALL_2 ( AND, pic_1, pic_2, pic_new ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Border.c b/Utilities/IpFunc/Border.c deleted file mode 100644 index c8667782c26..00000000000 --- a/Utilities/IpFunc/Border.c +++ /dev/null @@ -1,235 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * This function sets all border pixels to zero. - */ - -/** @brief sets all border pixels to zero. - * - * The size of the border is calculated using the size of the single - * dimensions of the mask (dim/2). - * - * @param pic_old input image - * @param mask mask which is used to calculate the border size - * @param pic_rtn memory used for result image (if pic_rtn == NULL new - * memory is allocated. - * - * @return pic_new result image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncBorder ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_rtn ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - /* definition of macros */ - - -#define BORDER( type, pic, size ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t anf[_mitkIpPicNDIM]; /* */ \ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = pic->n[i]; \ - } \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = 1; \ - pic->n[i] = 1; \ - } \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = pic->n[i] - mask->n[i]/2; \ - end[i] = mask->n[i]/2; \ - for ( ind[7] = 0; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = 0; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = 0; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = 0; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = 0; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = 0; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = 0; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - for ( ind[0] = 0; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[1]] = 0; \ - off[1]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - for ( ind[7] = anf[7]; ind[7] < pic->n[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = anf[6]; ind[6] < pic->n[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = anf[5]; ind[5] < pic->n[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = anf[4]; ind[4] < pic->n[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = anf[3]; ind[3] < pic->n[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = anf[2]; ind[2] < pic->n[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = anf[1]; ind[1] < pic->n[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + anf[0]; \ - for ( ind[0] = anf[0]; ind[0] < pic->n[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[0]] = 0; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - end[i] = pic->n[i]; \ - anf[i] = 0; \ - } \ -} - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncBorder ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_rtn ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whEther data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim != mask->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - if ( pic_old->n[i] <= mask->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - - /* create a new picture, copy the header, allocate memory */ - -/* pic_new = _mitkIpFuncMalloc ( pic_old, pic_rtn, mitkIpOVERWRITE );*/ - if ( pic_rtn == NULL ) - pic_new = mitkIpPicClone ( pic_old ); - else - pic_new = pic_old; - - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - mitkIpPicFORALL_1 ( BORDER, pic_old, size ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/BorderX.c b/Utilities/IpFunc/BorderX.c deleted file mode 100644 index 2fbe4d386d2..00000000000 --- a/Utilities/IpFunc/BorderX.c +++ /dev/null @@ -1,251 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * This function sets all border pixels to a spezified value. - */ - -/** @brief sets all border pixels to a spezified value. - * - * The size of the border is calculated using the size of the single - * dimensions of the mask (dim/2) - * - * - * @param pic_old input image - * @param mask mask which is used to calculate the border size - * @param value border value - * @param pic_rtn memory used for result image (if pic_rtn == NULL new - * memory is allocated. - * - * @return pic_new result image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpFloat8_t value, - mitkIpPicDescriptor *pic_rtn ); - - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define BORDER( type, pic, size, value ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t anf[_mitkIpPicNDIM]; /* */ \ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = pic->n[i]; \ - } \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = 1; \ - pic->n[i] = 1; \ - } \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = pic->n[i] - mask->n[i]/2; \ - end[i] = mask->n[i]/2; \ - for ( ind[7] = 0; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = 0; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = 0; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = 0; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = 0; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = 0; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = 0; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - for ( ind[0] = 0; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[1]] = ( type ) value; \ - off[1]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - for ( ind[7] = anf[7]; ind[7] < pic->n[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = anf[6]; ind[6] < pic->n[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = anf[5]; ind[5] < pic->n[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = anf[4]; ind[4] < pic->n[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = anf[3]; ind[3] < pic->n[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = anf[2]; ind[2] < pic->n[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = anf[1]; ind[1] < pic->n[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + anf[0]; \ - for ( ind[0] = anf[0]; ind[0] < pic->n[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[0]] = ( type ) value; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - end[i] = pic->n[i]; \ - anf[i] = 0; \ - }\ -} - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpFloat8_t value, - mitkIpPicDescriptor *pic_rtn ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpFloat8_t max_gv, min_gv; - - /* check whEther data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( ( pic_old->dim != mask->dim ) || ( mask->dim > 3 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - if ( pic_old->n[i] <= mask->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( ( value > max_gv ) || ( value < min_gv ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* create a new picture, copy the header, allocate memory */ - - /* pic_new = _mitkIpFuncMalloc ( pic_old, pic_rtn, mitkIpOVERWRITE );*/ - if ( pic_rtn == NULL ) - pic_new = mitkIpPicClone ( pic_old ); - else - pic_new = pic_old; - - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - mitkIpPicFORALL_2 ( BORDER, pic_old, size, value ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Box.c b/Utilities/IpFunc/Box.c deleted file mode 100644 index 465d8b810e7..00000000000 --- a/Utilities/IpFunc/Box.c +++ /dev/null @@ -1,98 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * This Function calulates the bounding box - */ - - -/** This Function calulates the bounding box - * - * @param pic_old binary image: contains the region of interest - * @param beg pointer to left upper corner - * @param end pointer to right lower corner - * - * @return @arg @c mitkIpFuncOK no error occured - * @arg @c mitkIpFuncERROR error occured (description of error in mitkIpFuncErrno) - * - * @warning this version could only be used for 2D and 3D images, in - * later version it should be possible to use it for every dimension - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" - -mitkIpUInt4_t mitkIpFuncBox ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ) ; - -#ifndef DOXYGEN_IGNORE - -mitkIpUInt4_t mitkIpFuncBox ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ) -{ - - /* check data */ - - if ( pic_old->dim == 2 ) - { - _mitkIpFuncBox2d ( pic_old, beg, end ); - if ( mitkIpFuncErrno > mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - } - else if ( pic_old->dim == 3 ) - { - _mitkIpFuncBox3d ( pic_old, beg, end ); - if ( mitkIpFuncErrno > mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - return ( mitkIpFuncOK ); -} - -#endif - diff --git a/Utilities/IpFunc/Box2d.c b/Utilities/IpFunc/Box2d.c deleted file mode 100644 index 3ea0276657d..00000000000 --- a/Utilities/IpFunc/Box2d.c +++ /dev/null @@ -1,169 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * _mitkIpFuncBox2d - *--------------------------------------------------------------------- - * DESCRIPTION - * This Function calulates the bounding box - * - * FUNCTION DECLARATION - * - * PARAMETERS - * pic_old - binary image: contains the region of interest - * beg - pointer to left upper corner - * end - pointer to right lower corner - * - * RETURN VALUES - * mitkIpFuncOK - no error occured - * mitkIpFuncERROR - error occured (description of error in mitkIpFuncErrno) - * - * UPDATES - * this version could only be used for 3D images, in later version - * it should be possible to use it for every dimension - * - * AUTHOR & DATE - * Antje Schroeder 08.01.97 - * - *--------------------------------------------------------------------- - */ -/* include Files */ - -#include "mitkIpFuncP.h" - -/* definition of Box-macro */ - -#define BOX( type, pic, help_beg, help_end ) \ -{ \ - mitkIpInt4_t i, j, l; \ - mitkIpUInt4_t offset; \ - mitkIpInt4_t end_x, end_y; \ - mitkIpBool_t found; \ - \ - for ( l = 0; l < (mitkIpInt4_t) pic->dim; l++ ) \ - { \ - i = 0; \ - found = mitkIpFalse; \ - end_y = pic->n[order[l*pic->dim+1]]; \ - while (( i < end_y ) && ( !found ) ) \ - { \ - j = 0; \ - end_x = pic->n[order[l*pic->dim]]; \ - while (( j < end_x ) && ( !found ) ) \ - { \ - offset = j * size[order[l * pic->dim]] + \ - i * size[order[l * pic->dim + 1]]; \ - if ( (( type * )pic->data )[ offset ] ) \ - { \ - found = mitkIpTrue; \ - help_beg[1-l] = i; \ - } \ - j++; \ - } \ - i++; \ - } \ - \ - i = pic->n[order[l*pic->dim+1]] -1; \ - found = mitkIpFalse; \ - while (( i >= 0 ) && ( !found ) ) \ - { \ - j = pic->n[order[l*pic->dim]] -1; \ - while (( j >= 0 ) && ( !found ) ) \ - { \ - offset = j * size[order[l * pic->dim]] + \ - i * size[order[l * pic->dim + 1]]; \ - if ( (( type * )pic->data )[ offset ] ) \ - { \ - found = mitkIpTrue; \ - help_end[1-l] = i; \ - } \ - j--; \ - } \ - i--; \ - } \ - } \ - \ - \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpUInt4_t _mitkIpFuncBox2d ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ) -{ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* size of each direction */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t *help_beg, *help_end; - mitkIpUInt4_t order[] = { 0, 1, - 1, 0 }; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( pic_old->dim > 2 ) /* just in for the first version */ - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialization of vectors */ - - size[0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - /* allocation of result vectors */ - - *beg = ( mitkIpUInt4_t * ) malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - help_beg = *beg; - *end = ( mitkIpUInt4_t * ) malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - help_end = *end; - - mitkIpPicFORALL_2 ( BOX, pic_old, help_beg, help_end ); - - return ( mitkIpFuncOK ); -} diff --git a/Utilities/IpFunc/Box3d.c b/Utilities/IpFunc/Box3d.c deleted file mode 100644 index 30eb31558f2..00000000000 --- a/Utilities/IpFunc/Box3d.c +++ /dev/null @@ -1,186 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * _mitkIpFuncBox3d - *--------------------------------------------------------------------- - * DESCRIPTION - * This Function calulates the bounding box - * - * FUNCTION DECLARATION - * - * PARAMETERS - * pic_old - binary image: contains the region of interest - * beg - pointer to left upper corner - * end - pointer to right lower corner - * - * RETURN VALUES - * mitkIpFuncOK - no error occured - * mitkIpFuncERROR - error occured (description of error in mitkIpFuncErrno) - * - * UPDATES - * this version could only be used for 3D images, in later version - * it should be possible to use it for every dimension - * - * AUTHOR & DATE - * Antje Schroeder 08.01.97 - * - *--------------------------------------------------------------------- - */ -/* include Files */ - -#include "mitkIpFuncP.h" - -/* definition of Box-macro */ - -#define BOX3( type, pic, help_beg, help_end, n, size ) \ -{ \ - mitkIpUInt4_t offset1, offset2; \ - \ - for ( l = 0; l < pic->dim; l++ ) \ - { \ - n[l] = pic->n[l]; \ - } \ - \ - for ( l = 0; l < pic->dim; l++ ) \ - { \ - stop = mitkIpFalse; \ - stop_beg = mitkIpFalse; \ - stop_end = mitkIpFalse; \ - k = 0; \ - while ( k < n[order[2+pic_old->dim*l]] && ( !stop ) ) \ - { \ - j = 0; \ - while ( j < n[order[1+pic_old->dim*l]] && ( !stop ) ) \ - { \ - i = 0; \ - while ( i < n[order[pic_old->dim*l]] && ( !stop ) ) \ - { \ - offset1 = i * size[order[0+pic_old->dim*l]] + \ - j * size[order[1+pic_old->dim*l]] + \ - k * size[order[2+pic_old->dim*l]]; \ - \ - offset2 = ( n[order[0+pic_old->dim*l]] - i - 1 ) * \ - size[order[0+pic_old->dim*l]] + \ - ( n[order[1+pic_old->dim*l]] - j - 1 ) * \ - size[order[1+pic_old->dim*l]] + \ - ( n[order[2+pic_old->dim*l]] - k - 1 ) * \ - size[order[2+pic_old->dim*l]]; \ - \ - if ( ( stop_beg == mitkIpFalse ) && \ - ( ( type * )pic->data )[offset1] ) \ - { \ - help_beg[order[2+pic->dim*l]] = k; \ - stop_beg = mitkIpTrue; \ - } \ - if ( ( stop_end == mitkIpFalse ) && \ - ( ( type * )pic->data )[offset2] ) \ - { \ - help_end[order[2+pic->dim*l]] = \ - n[order[2+pic->dim*l]] - k; \ - stop_end = mitkIpTrue; \ - } \ - if ( stop_beg && stop_end ) stop = mitkIpTrue; \ - i++; \ - } \ - j++; \ - } \ - k++; \ - } \ - } \ - \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpUInt4_t _mitkIpFuncBox3d ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ) -{ - - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* number of pixels in each */ - /* dimension */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* size of each direction */ - mitkIpUInt4_t i, j, k, l; /* loop index */ - mitkIpUInt4_t order[] = { 0, 1, 2, /* order of indizes for each */ - 2, 1, 0, /* direction */ - 0, 2, 1 }; - mitkIpBool_t stop, stop_beg, stop_end;/* finish calculation? */ - mitkIpUInt4_t *help_beg, *help_end; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( pic_old->dim > 3 ) /* just in for the first version */ - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - size[0] = 1; - n[0] = pic_old->n[0]; - for ( i = 1; i < pic_old->dim; i++ ) - { - n[i] = pic_old->n[i]; - size[i] = size[i-1] * pic_old->n[i-1]; - } - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - /* allocation of result vectors */ - - *beg = ( mitkIpUInt4_t * ) malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - help_beg = *beg; - *end = ( mitkIpUInt4_t * ) malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - help_end = *end; - - mitkIpPicFORALL_4 ( BOX3, pic_old, help_beg, help_end, n, size ); - - return ( mitkIpFuncOK ); -} diff --git a/Utilities/IpFunc/CMakeLists.txt b/Utilities/IpFunc/CMakeLists.txt deleted file mode 100644 index ba6d8901005..00000000000 --- a/Utilities/IpFunc/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(_options NO_INIT GCC_DEFAULT_VISIBILITY) -if(MITK_WIN32_FORCE_STATIC) - list(APPEND _options FORCE_STATIC) -endif() - -mitk_create_module( - DEPENDS PUBLIC MitkIpPic - ${_options} - C_MODULE - WARNINGS_NO_ERRORS -) - -if(UNIX) - target_link_libraries(${MODULE_TARGET} PRIVATE m) -endif(UNIX) diff --git a/Utilities/IpFunc/Canny.c b/Utilities/IpFunc/Canny.c deleted file mode 100644 index 8f33cf1c429..00000000000 --- a/Utilities/IpFunc/Canny.c +++ /dev/null @@ -1,525 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function performs an edge detection using the Canny operator - */ - -/** @brief performs an edge detection using the Canny operator. - * - * The Canny-operator needs quite a lot memory. This can cause problems - * with large images. - * - * @param pic_old pointer to original image - * @param dim_mask dimension of mask - * @param len_mask length of filtering mask - * @param threshold threshold to decide whether an edge belongs to - * the image or not - * @param border tells how the edge is transformed - * - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to minimal greyvalue - * - * @return pointer to transformed iamge ( of type mitkIpFloat8_t ) - * - * AUTHOR & DATE - - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncCanny( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFloat8_t threshold, - mitkIpFuncFlagI_t border ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncCanny\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define CANNY0( type_o, pic_old, pic_help1, pic_help2, pic_help3, m ) \ -{ \ - mitkIpPicFORALL_5( CANNY1, pic_help1, pic_old, pic_help2, pic_help3, m, type_o );\ -} - -#define CANNY1( type_h, pic_help1, pic_old, pic_help2, pic_help3, m, type_o )\ -{ \ - mitkIpUInt4_t i, j; /* loop index */ \ - mitkIpUInt4_t len_m; \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - mitkIpUInt4_t off_m; /* offset in mask */ \ - mitkIpFloat8_t help[_mitkIpPicNDIM]; \ - mitkIpFloat8_t help2; \ - \ - \ - /* transformation of image */ \ - \ - len_m = m->length / dim_mask; \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - for ( i = 0; i < dim_mask; i++ ) help[i] = 0; \ - off_m = 0; \ - for ( i = 0; i < dim_mask; i++ ) \ - for ( j = 0; j < len_m; j++ ) \ - { \ - help[i] = ( mitkIpFloat8_t )m->mask_vekt[off_m] * \ - (( type_o * ) pic_old->data ) \ - [off[0]+m->off_vekt[off_m]] + help[i];\ - off_m++; \ - } \ - help2 = 0; \ - for ( i = 0; i < dim_mask; i++ ) \ - { \ - (( type_h * )pic_help1->data )[off[0]+off_p[i]] = \ - ( type_h ) help[i];\ - help2 = help2 + help[i] * help[i]; \ - } \ - (( type_h * ) pic_help2->data )[off[0]] = \ - ( type_h ) help2; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -#define CANNY2( type_h, pic_help2, pic_help3, pic_help1, m ) \ -{ \ - mitkIpUInt4_t i, j; /* loop index */ \ - mitkIpUInt4_t len_m; \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - mitkIpUInt4_t off_m; /* offset in mask */ \ - mitkIpFloat8_t help[_mitkIpPicNDIM]; \ - mitkIpFloat8_t help2; \ - \ - \ - /* transformation of image */ \ - \ - len_m = m->length / dim_mask; \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - for ( i = 0; i < dim_mask; i++ ) help[i] = 0; \ - off_m = 0; \ - for ( i = 0; i < dim_mask; i++ ) \ - for ( j = 0; j < len_m; j++ ) \ - { \ - help[i] = help[i] + ( mitkIpFloat8_t )m->mask_vekt[off_m] *\ - (( type_h * ) pic_help2->data ) \ - [off[0]+m->off_vekt[off_m]];\ - off_m++; \ - } \ - help2 = 0; \ - for ( i = 0; i < dim_mask; i++ ) \ - { \ - help2 = help[i] * (( type_h * )pic_help1->data ) \ - [off[0]+ off_p[i]] + help2;\ - } \ - (( type_h * ) pic_help3->data )[off[0]] = ( type_h )help2;\ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -#define CANNY3( type_h, pic_help2, pic_help3, threshold ) \ -{ \ - mitkIpUInt4_t i; /* loop variable */ \ - mitkIpUInt4_t no_elem; /* number of pixels */ \ - \ - no_elem = _mitkIpPicElements ( pic_help2 ); \ - for ( i = 0; i < no_elem; i++ ) \ - (( type_h * )pic_help3->data )[i] = \ - ( ( (( type_h * ) pic_help3->data )[i] != 0 ) && \ - ( (( type_h * ) pic_help2->data )[i] > threshold ) ) ? \ - 1 : 0; \ -} - -/* ----------------------------------------------------------------- */ -/* -** mitkIpFuncCanny -*/ -/* ----------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncCanny( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFloat8_t threshold, - mitkIpFuncFlagI_t border ) -{ - #include "gradient.h" - - mitkIpPicDescriptor *pic_help1; /* pointer to image */ - mitkIpPicDescriptor *pic_help2; /* pointer to image */ - mitkIpPicDescriptor *pic_help3; /* pointer to image */ - mitkIpPicDescriptor *pic_help4; /* pointer to image */ - mitkIpPicDescriptor *pic_new; /* pointer to image */ - mitkIpPicDescriptor *pic_mask; /* sobel mask */ - mitkIpUInt4_t pos; /* position in m->off_vekt */ - mitkIpUInt4_t i, j; /* loopindex */ - mitkIpUInt4_t off_mask; /* loopindex */ - mitkIpFuncMasc_t *m; /* compressed mask */ - mitkIpInt4_t offset; - mitkIpInt4_t beg[_mitkIpPicNDIM]; - mitkIpInt4_t end[_mitkIpPicNDIM]; - mitkIpInt4_t ind[_mitkIpPicNDIM]; - mitkIpUInt4_t size[_mitkIpPicNDIM]; - mitkIpInt4_t n[_mitkIpPicNDIM]; - mitkIpUInt4_t off_p[_mitkIpPicNDIM]; /* offsets to calculate help1 */ - mitkIpUInt4_t offset_h; /* offset in pic_help1 */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( ( dim_mask < 1 ) || ( dim_mask > 4 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_old->dim < dim_mask ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of pic_mask */ - - pic_mask = mitkIpPicNew (); - if ( pic_mask == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicInt; - pic_mask->bpe = 16; - pic_mask->dim = dim_mask+1; - for ( i = 0; i < dim_mask; i++ ) - pic_mask->n[i] = 3; - pic_mask->n[dim_mask] = dim_mask; - - if ( dim_mask == 4 ) - pic_mask->data = mask4; - else if ( dim_mask == 3 ) - pic_mask->data = mask3; - else if ( dim_mask == 2 ) - pic_mask->data = mask2; - - /* initialisation of vectors */ - - size [0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - size[i] = 0; - - offset_h = size[pic_old->dim-1] * pic_old->n[pic_old->dim-1]; - - for ( i = 0; i < dim_mask; i++ ) - n[i] = pic_mask->n[i] / 2 + 1; - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - n[i] = 0; - - for ( i = 0; i < dim_mask; i++ ) - { - end[i] = pic_old->n[i] - pic_mask->n[i] / 2; - beg[i] = ( ( pic_mask->n[i] % 2 ) == 1 ) ? - ( pic_mask->n[i] / 2 ) : ( pic_mask->n[i] / 2 - 1 ); - off_p[i] = i * offset_h; - } - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - beg[i] = 0; - - for ( i = dim_mask; i < pic_old->dim; i++ ) - end[i] = pic_old->n[i]; - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - end[i] = beg[i] + 1; - - /* create a new picture, copy the header, allocate memory */ - - pic_help2 = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_help2 == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( pic_old->type == mitkIpPicUInt || pic_old->type == mitkIpPicInt ) - { - pic_help2->type = mitkIpPicFloat; - pic_help2->bpe = 64; - } - pic_help2->data = calloc ( _mitkIpPicElements ( pic_help2 ), pic_help2->bpe / 8 ); - if ( pic_help2->data == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_help1 = mitkIpPicCopyHeader ( pic_help2, NULL ); - if ( pic_help1 == NULL ) - { - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_help1->dim = pic_help2->dim + 1; - pic_help1->n[pic_help1->dim-1] = dim_mask; - pic_help1->data = calloc ( _mitkIpPicElements ( pic_help1 ), pic_help1->bpe / 8 ); - if ( pic_help1->data == NULL ) - { - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_help3 = mitkIpPicCopyHeader ( pic_help2, NULL ); - if ( pic_help3 == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - pic_help1->data = NULL; - mitkIpPicFree ( pic_help1 ); - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2 ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_help3->data = calloc ( _mitkIpPicElements ( pic_help3 ), pic_help3->bpe / 8 ); - if ( pic_help3->data == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - pic_help1->data = NULL; - mitkIpPicFree ( pic_help1 ); - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate mask-structure */ - - m = malloc ( sizeof ( mitkIpFuncMasc_t ) ); - if ( m == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - pic_help1->data = NULL; - mitkIpPicFree ( pic_help1 ); - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->off_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpInt4_t ) ); - if ( m->off_vekt == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - pic_help1->data = NULL; - mitkIpPicFree ( pic_help1 ); - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2 ); - pic_help3->data = NULL; - mitkIpPicFree ( pic_help3 ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->mask_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpFloat8_t ) ); - if ( m->mask_vekt == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - pic_help1->data = NULL; - mitkIpPicFree ( pic_help1 ); - pic_help2->data = NULL; - mitkIpPicFree ( pic_help2 ); - pic_help3->data = NULL; - mitkIpPicFree ( pic_help3 ); - free ( m->off_vekt ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate offset vector for the compressed mask */ - - m->length = 0; - - off_mask = 0; - for ( i = 0; i < pic_mask->n[dim_mask] ; i++ ) - for ( ind[3] = -1; ind[3] < n[3]; ind[3]++ ) - for ( ind[2] = -1; ind[2] < n[2]; ind[2]++ ) - for ( ind[1] = -1; ind[1] < n[1]; ind[1]++ ) - for ( ind[0] = -1; ind[0] < n[0]; ind[0]++ ) - { - if ( (( mitkIpInt2_t * )pic_mask->data)[off_mask] != 0 ) - { - offset = 0; - for ( j = 0; j < dim_mask; j++ ) - offset = offset + ind[j] * size[j]; - m->off_vekt[m->length] = offset; - m->length++; - } - off_mask++; - } - - /* remove elements that are zero from mask */ - - pos = 0; - for ( i = 0; i < m->length; i++ ) - { - while ( (( mitkIpInt2_t * )pic_mask->data)[pos] == 0 ) pos++; - m->mask_vekt[i] = ( mitkIpFloat8_t )(( mitkIpInt2_t * )pic_mask->data)[pos]; - pos++; - } - - /* smooth image using a binomial filter */ - - pic_new = mitkIpFuncGausF ( pic_old, len_mask, dim_mask, border ); - - /* calculate second derivation */ - - mitkIpPicFORALL_4 ( CANNY0, pic_new, pic_help1, pic_help2, pic_help3, m ); - /* project second derivation to gradient */ - - mitkIpPicFORALL_3 ( CANNY2, pic_help2, pic_help3, pic_help1, m ); - - /* zero crossing */ - - pic_help4 = mitkIpFuncZeroCr ( pic_help3 ); - - mitkIpPicFORALL_2 ( CANNY3, pic_help2, pic_help4, threshold ); - - /* free memory */ - - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - mitkIpPicFree ( pic_new ); - mitkIpPicFree ( pic_help1 ); - mitkIpPicFree ( pic_help2 ); - mitkIpPicFree ( pic_help3 ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_help4, pic_old); - - return ( pic_help4 ); -} - -#endif diff --git a/Utilities/IpFunc/Close.c b/Utilities/IpFunc/Close.c deleted file mode 100644 index db15b68a358..00000000000 --- a/Utilities/IpFunc/Close.c +++ /dev/null @@ -1,95 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function performs the morphological closing operation - */ - -/** @brief performs the morphological closing operation - * - * Closing is a dilation followed by an erosion. - * - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param border tells how the edge is transformed - * - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to transformed iamge - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncClose ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -mitkIpPicDescriptor *mitkIpFuncClose ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; - - pic_new = _mitkIpFuncOpCl ( pic_old, pic_mask, mitkIpFuncCloseF, border ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return ( pic_new ); -} - -#endif - diff --git a/Utilities/IpFunc/CompressM.c b/Utilities/IpFunc/CompressM.c deleted file mode 100644 index d2d0db95327..00000000000 --- a/Utilities/IpFunc/CompressM.c +++ /dev/null @@ -1,231 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - /**@file - * this function removes all elements which are zero and - * calculates the offsets of the non-zero elements - * which are nonzero - */ -/** @brief removes all elements which are zero from the mask and - * calculates the offsets (relative to the actual pixel) for all elements - * which are nonzero - * - * @param mask pointer to mask structure - * @param pic_old pointer to original image - * @param kind tells whether mask should be reflected - * @arg @c mitkIpNOREFLECT : original mask is used - * @arg @c mitkIpREFLECT : reflected mask is used - * @param beg pixel number where convolution begins ( return value ) - * @param end pixel number where convolution ends ( return value ) - * - * @return m pointer to compressed mask structure - * - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" - -mitkIpFuncMasc_t *_mitkIpFuncCompressM ( mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpInt4_t beg[_mitkIpPicNDIM], - mitkIpInt4_t end[_mitkIpPicNDIM] ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncCompressM\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -#define OFF_M( type, pic_mask, pic, beg, size, m, kind ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t pos; /* */ \ - mitkIpInt4_t off_mask; /* offset for mask elements */ \ - mitkIpInt4_t offset; /* offset for picture elements */ \ - mitkIpInt4_t incr; \ - mitkIpUInt4_t size_m[_mitkIpPicNDIM]; \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpInt4_t ind_m[_mitkIpPicNDIM]; /* loop index vector */ \ - \ - /* initialization of vectors */ \ - \ - size_m[0] = 1; \ - size[0] = 1; \ - for ( i = 1; i < _mitkIpPicNDIM; i++ ) \ - { \ - size_m[i] = size_m[i-1] * pic_mask->n[i-1]; \ - size[i] = size[i-1] * pic->n[i-1]; \ - } \ - \ - /* calculate offsets from actual pixel for each mask element */ \ - \ - if ( kind == mitkIpFuncNoReflect ) \ - { \ - off_mask = 0; \ - incr = 1; \ - } \ - else if ( kind == mitkIpFuncReflect ) \ - { \ - off_mask = size_m[pic_mask->dim] -1; \ - incr = -1; \ - } \ - else return ( mitkIpFuncERROR ); \ - \ - m->length = 0; \ - \ - for ( ind[7] = 0, ind_m[7] = -beg[7]; ind[7] < pic_mask->n[7]; \ - ind[7]++, ind_m[7]++ ) \ - for ( ind[6] = 0, ind_m[6] = -beg[6]; ind[6] < pic_mask->n[6]; \ - ind[6]++, ind_m[6]++ ) \ - for ( ind[5] = 0, ind_m[5] = -beg[5]; ind[5] < pic_mask->n[5]; \ - ind[5]++, ind_m[5]++ ) \ - for ( ind[4] = 0, ind_m[4] = -beg[4]; ind[4] < pic_mask->n[4]; \ - ind[4]++, ind_m[4]++ ) \ - for ( ind[3] = 0, ind_m[3] = -beg[3]; ind[3] < pic_mask->n[3]; \ - ind[3]++, ind_m[3]++ ) \ - for ( ind[2] = 0, ind_m[2] = -beg[2]; \ - ind[2] < pic_mask->n[2]; ind[2]++, ind_m[2]++ ) \ - for ( ind[1] = 0, ind_m[1] = -beg[1]; \ - ind[1] < pic_mask->n[1]; ind[1]++, ind_m[1]++ ) \ - for ( ind[0] = 0, ind_m[0] = -beg[0]; \ - ind[0] < pic_mask->n[0]; ind[0]++, ind_m[0]++ ) \ - { \ - if ( (( type * )pic_mask->data )[off_mask] != 0 ) \ - { \ - offset = 0; \ - for ( i = 0; i < pic_mask->dim; i++ ) \ - offset = offset + ind_m[i] * size[i]; \ - \ - m->off_vekt[m->length] = offset; \ - m->length++; \ - } \ - off_mask = off_mask + incr; \ - } \ - \ - /* remove elements that are zero from mask */ \ - \ - pos = 0; \ - for ( i = 0; i < m->length; i++ ) \ - { \ - while ( (( type * )pic_mask->data )[pos] == 0 ) pos++; \ - m->mask_vekt[i] = ( mitkIpFloat8_t ) (( type * )pic_mask->data )[pos]; \ - pos++; \ - } \ - \ -} - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpFuncMasc_t *_mitkIpFuncCompressM ( mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpInt4_t beg[_mitkIpPicNDIM], - mitkIpInt4_t end[_mitkIpPicNDIM] ) -{ - mitkIpUInt4_t i; /* loop index */ - mitkIpFuncMasc_t *m; /* length of mask and offsets */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; - - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* initialization of vectors */ - - for ( i = 0; i < mask->dim; i++ ) - { - end[i] = pic_old->n[i] - mask->n[i] / 2; - beg[i] = ( ( mask->n[i] % 2 ) == 1 ) ? - ( mask->n[i] / 2 ) : ( mask->n[i] / 2 - 1 ); - } - - for ( i = mask->dim; i < _mitkIpPicNDIM; i++ ) - { - beg[i] = 0; - mask->n[i] = 1; - } - - for ( i = mask->dim; i < pic_old->dim; i++ ) - end[i] = pic_old->n[i]; - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - end[i] = beg[i] + 1; - - /* allocate mask structure */ - - m = malloc ( sizeof ( mitkIpFuncMasc_t ) ); - if ( m == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->off_vekt = malloc ( _mitkIpPicElements( mask ) * sizeof ( mitkIpInt4_t ) ); - if ( m->off_vekt == NULL ) - { - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->mask_vekt = malloc ( _mitkIpPicElements( mask ) * sizeof ( mitkIpFloat8_t ) ); - if ( m->mask_vekt == NULL ) - { - free ( m->off_vekt ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to compress mask (for all data types) */ - - mitkIpPicFORALL_5 ( OFF_M, mask, pic_old, beg, size, m, kind ); - - return ( m ); - -} -#endif diff --git a/Utilities/IpFunc/Conv.c b/Utilities/IpFunc/Conv.c deleted file mode 100644 index 199fdddc762..00000000000 --- a/Utilities/IpFunc/Conv.c +++ /dev/null @@ -1,236 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function convolves an image with a mask - */ - -/** this function convolves an image with a mask - * @param pic_old pointer to the image that should be convolved - * @param mask pointer to the mask that is used for convolution - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncFlagBorderOld : original greyvalues - * @arg @c mitkIpFuncFlagBorderZero : edge is set to minimal greyvalue - * - * @return pointer to the convolved image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncConv( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncConv\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define CONV( typ, pic, size, mask, beg, end, m) \ -{ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; \ - mitkIpInt4_t off[_mitkIpPicNDIM]; \ - mitkIpUInt4_t i; \ - mitkIpInt4_t offset; \ - mitkIpFloat8_t help, min_gv, max_gv; \ - typ *data, *data_new; \ - \ - /* calculate max. and min. possible greyvalues */ \ - \ - _mitkIpFuncExtT ( pic->type, pic->bpe, &min_gv, &max_gv ); \ - data = pic->data; \ - data_new = pic_new->data; \ - \ - /* convolve image with compressed mask */ \ - \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - offset = off[1] + beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - \ - /* calculate new greyvalue */ \ - \ - help = 0; \ - for ( i = 0; i < m->length; i++ ) \ - help = help + m->mask_vekt[i] * \ - data[offset + m->off_vekt[i]]; \ - \ - data_new[offset] = \ - ( help < max_gv )? \ - ( ( help < min_gv ) ? ( typ )min_gv : help ) : \ - ( typ ) max_gv; \ - /* \ - help = help + m->mask_vekt[i] * \ - (( typ * )pic->data)[offset + m->off_vekt[i]]; \ - \ - (( typ * )pic_new->data )[offset] = \ - ( help < max_gv )? \ - ( ( help < min_gv ) ? ( typ )min_gv : help ) : \ - ( typ ) max_gv; \ - */ \ - offset++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncConv( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ) -{ - - mitkIpPicDescriptor *pic_new; /* convolved image */ - mitkIpUInt4_t i; /* loopindex */ - mitkIpInt4_t beg[_mitkIpPicNDIM]; - mitkIpInt4_t end[_mitkIpPicNDIM]; - mitkIpFuncMasc_t *m; /* length of mask and offsets */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; - - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( ( pic_mask->dim > pic_old->dim ) || ( pic_mask->dim < 1 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - if ( pic_mask->n[i] > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* create a new picture, copy the header, allocate memory */ - - if ( border == mitkIpFuncBorderOld ) - { - /*pic_new = _mitkIpFuncBorder ( pic_old, pic_mask, mitkIpFuncBorderOld );*/ - pic_new = mitkIpPicClone ( pic_old ); - } - else if ( border == mitkIpFuncBorderZero ) - { - /* pic_new = _mitkIpFuncBorder ( pic_old, pic_mask, mitkIpFuncBorderZero ); */ - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialize vectors */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) size[i] = size[i-1] * pic_old->n[i-1]; - - /* compress mask */ - - m = _mitkIpFuncCompressM ( pic_mask, pic_old, mitkIpFuncReflect, beg, end ); - if ( m == NULL ) return ( mitkIpFuncERROR ); - - /* macro to convolve an image (for all data types) */ - - mitkIpPicFORALL_5 ( CONV, pic_old, size, pic_mask, beg, end, m ); - /* free memory */ - - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/Convert.c b/Utilities/IpFunc/Convert.c deleted file mode 100644 index c022f516878..00000000000 --- a/Utilities/IpFunc/Convert.c +++ /dev/null @@ -1,196 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * this function converts one image to an image of another data type - * (at the moment only datatype mitkIpUInt1_t, mitkIpInt2_t, mitkIpFloat8_t ) are - * supported. - */ - - /** this function converts one image to an image of another data type - * (at the moment only datatype mitkIpUInt1_t, mitkIpInt2_t, mitkIpFloat8_t ) are - * supported. - * - * @param pic_old pointer to input image - * @param type image data type - * 3 mitkIpPicInt - * 4 mitkIpPicUInt - * 5 mitkIpPicFloat - * @param bpe bits per element representing on pixel - * - * qreturn pointer to converted image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - - -mitkIpPicDescriptor *mitkIpFuncConvert ( mitkIpPicDescriptor *pic_old, - mitkIpPicType_t type, - mitkIpUInt4_t bpe ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncConvert\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define CONV_1( type_old, pic_old, pic_new, min_gv, max_gv ) \ -{ \ - mitkIpPicFORALL_4( CONV_2, pic_new, pic_old, type_old, min_gv, max_gv ) \ -} - -#define CONV_3( type_old, pic_old, pic_new ) \ -{ \ - mitkIpPicFORALL_2( CONV_4, pic_new, pic_old, type_old ) \ -} - - -#define CONV_4( type_new, pic_new, pic_old, type_old ) \ -{ \ - size_t i; \ - size_t no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_old ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_new * ) pic_new->data ) [i] = ( type_new ) \ - (( type_old * ) pic_old->data ) [i]; \ - } \ -} - -#define CONV_2( type_new, pic_new, pic_old, type_old, min_gv, max_gv ) \ -{ \ - size_t i; \ - size_t no_elem; \ - type_old help; \ - \ - no_elem = _mitkIpPicElements ( pic_new ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_old * ) pic_old->data ) [i]; \ - (( type_new * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help ) ? \ - ( min_gv < ( mitkIpFloat8_t ) help ? \ - ( type_new )help : ( type_new ) min_gv ) : \ - ( type_new ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncConvert ( mitkIpPicDescriptor *pic_old, - mitkIpPicType_t type, - mitkIpUInt4_t bpe ) - -{ - mitkIpFloat8_t min, max; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t max_gv; - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - - - /* ckeck whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( ! ( ( type == mitkIpPicFloat && ( bpe == 32 || bpe == 64 ) ) || - ( type == mitkIpPicUInt && ( bpe == 8 || bpe == 16 || bpe == 32 ) ) || - ( type == mitkIpPicInt && ( bpe == 8 || bpe == 16 || bpe == 32 ) ) ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate max. and min. possible greyvalues for output image */ - - if ( _mitkIpFuncExtT ( type, bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* calculate extreme greyvalues in input image */ - - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* allocate output image */ - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_new->type = type; - pic_new->bpe = bpe; - - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to convert the picture (for all data types) */ - - if ( ( min < min_gv ) || ( max > max_gv ) ) - mitkIpPicFORALL_3 ( CONV_1, pic_old, pic_new, min_gv, max_gv ) - else - mitkIpPicFORALL_1 ( CONV_3, pic_old, pic_new ) - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/CopyTags.c b/Utilities/IpFunc/CopyTags.c deleted file mode 100644 index fdbd9c66488..00000000000 --- a/Utilities/IpFunc/CopyTags.c +++ /dev/null @@ -1,66 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function copies the tags of one image to another - */ - -/** @brief copies the tags of one image to another - * @param pic_new pointer to the destination image - * @param pic_old pointer to the source image - * - * @author Carlos and Ivo - * @date 14.04.2000 - */ - -#include "mitkIpFuncP.h" - -void mitkIpFuncCopyTags(mitkIpPicDescriptor *pic_new, mitkIpPicDescriptor *pic_old) -{ - /* Copy Tags */ - - if(pic_new!=NULL) - { - strncpy( pic_new->info->version, pic_old->info->version, _mitkIpPicTAGLEN ); - pic_new->info->tags_head = _mitkIpPicCloneTags( pic_old->info->tags_head ); - pic_new->info->write_protect = pic_old->info->write_protect; - } -} - diff --git a/Utilities/IpFunc/Curtosis.c b/Utilities/IpFunc/Curtosis.c deleted file mode 100644 index fa21d63b67a..00000000000 --- a/Utilities/IpFunc/Curtosis.c +++ /dev/null @@ -1,116 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the curtosis of all - * greyvalues in an image - */ - -/** @brief calculates the curtosis of all - * greyvalues in an image - * - * @param pic pointer to the image - * - * @return curtosis of image - * - * @author Steffen Gundel - */ - - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncCurtosis ( mitkIpPicDescriptor *pic ); - -/* definition of extreme value macro */ - -#ifndef DOXYGEN_IGNORE - -/* include-files */ - -#include "mitkIpFuncP.h" - -/* definition of extreme value macro */ - -#define CURTOSIS( type, pic, mean, excess ) \ - { \ - mitkIpUInt4_t i, no_elem; \ - \ - excess = 0.; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - excess = ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) + \ - excess; \ - } \ - } - -mitkIpFloat8_t mitkIpFuncCurtosis ( mitkIpPicDescriptor *pic ) -{ - - mitkIpFloat8_t curt; - mitkIpFloat8_t mean, std; - - - /* check image data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpOK ) return ( mitkIpFuncERROR ); - - curt = 0.0; - if ( _mitkIpPicElements ( pic ) != 1 ) - { - - mean = mitkIpFuncMean ( pic ); - std = mitkIpFuncSDev( pic ); - - mitkIpPicFORALL_2( CURTOSIS, pic, mean, curt ); - - curt = curt / ((( mitkIpFloat8_t )(_mitkIpPicElements ( pic ) - 1 )) *std*std*std*std) -3; - } - - return( curt ); -} -#endif - diff --git a/Utilities/IpFunc/CurtosisR.c b/Utilities/IpFunc/CurtosisR.c deleted file mode 100644 index 636d385b6c3..00000000000 --- a/Utilities/IpFunc/CurtosisR.c +++ /dev/null @@ -1,87 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the curtosis of all - * greyvalues included by a rectangle - */ - -/** @brief calculates the curtosis of all - * greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to the image - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return curtosis in window - * - * @author Steffen Gundel - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - - -/* ========================================================== */ -/* -** function picVar : calculates the mean value (mean) -** of an image (pic) -*/ -/* ========================================================== */ - -double mitkIpFuncCurtosisR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) { - - mitkIpFloat8_t var; - mitkIpPicDescriptor *pic_help; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - var = mitkIpFuncCurtosis ( pic_help ); - - mitkIpPicFree ( pic_help ); - - return ( var ); -} diff --git a/Utilities/IpFunc/Dila.c b/Utilities/IpFunc/Dila.c deleted file mode 100644 index 298fea75402..00000000000 --- a/Utilities/IpFunc/Dila.c +++ /dev/null @@ -1,95 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file -* this function performs a dilation. If the original - * image is a binary image each pixel is connected with the surrounding - * pixels which are non zero in the kernel by using logical operations - * ( and for erosion, or for dilation ). Greylevel images are transformed - * by taking the minimum (erosion) of the surrounding pixels or the - * maximum (dilation). - */ - - /** @brief performs a dilation. If the original - * image is a binary image each pixel is connected with the surrounding - * pixels which are non zero in the kernel by using logical operations - * ( and for erosion, or for dilation ). Greylevel images are transformed - * by taking the minimum (erosion) of the surrounding pixels or the - * maximum (dilation). - * - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to the transformed image - * - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncDila ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -mitkIpPicDescriptor *mitkIpFuncDila ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; - - pic_new = _mitkIpFuncMorph ( pic_old, pic_mask, mitkIpFuncDilaF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new = mitkIpFuncBorder ( pic_new, pic_mask, pic_new ); - - - mitkIpFuncCopyTags(pic_new, pic_old); - - return ( pic_new ); -} - -#endif - diff --git a/Utilities/IpFunc/DivC.c b/Utilities/IpFunc/DivC.c deleted file mode 100644 index 94a22b32c75..00000000000 --- a/Utilities/IpFunc/DivC.c +++ /dev/null @@ -1,258 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file -* this function divides the greyvalues of an image by a value -*/ - -/** @brief divides the greyvalues of an image by a value - * - * @param pic_1 pointer to the first image - * @param value constant which is multiplied to image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncDivC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncDivC\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of macros */ - -#define DIVC( type_1, pic_1, pic_new, value ) \ -{ \ - mitkIpPicFORALL_3 ( DIVC2, pic_new, pic_1, type_1, value ); \ -} \ - -#define DIVC2( type_n, pic_new, pic_1, type_1, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = ( type_n ) \ - ( ( mitkIpFloat8_t )(( type_1 * ) pic_1->data ) [i] / value );\ - } \ -} - -#define DIVC3( type_n, pic_1, pic_new, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - mitkIpFloat8_t help; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = ( mitkIpFloat8_t )(( type_n * ) pic_1->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help / value ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help / value ) ? \ - ( (type_n)( help / value ) ) : ( type_n ) min_gv ) : \ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncDivC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check value */ - - if ( value == 0. ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_old, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 / value; - smin = min1 / value; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_old->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( DIVC, pic_old, pic_new, value ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( DIVC3, pic_old, pic_new, value ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/DivI.c b/Utilities/IpFunc/DivI.c deleted file mode 100644 index ad3531d50ea..00000000000 --- a/Utilities/IpFunc/DivI.c +++ /dev/null @@ -1,295 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function divides corresponding greyvalues of two images -*/ - -/** this function divides corresponding greyvalues of two images - * - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncDivI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncDivI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of macros */ - -#define DIVI( type_1, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpPicFORALL_3 ( DIVI2, pic_new, pic_1, pic_2, type_1 ); \ -} \ - -#define DIVI2( type_n, pic_new, pic_1, pic_2, type_1 ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_1 help2; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help2 = (( type_1 * ) pic_2->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( help2 == ( type_1) 0 ) ? \ - ( type_1) 0 : \ - (( type_1 * ) pic_1->data ) [i] / help2; \ - } \ -} - -#define DIVI3( type_n, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_n help; \ - type_n help2; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - help2 = (( type_n * ) pic_2->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( help2 == ( type_n) 0 ) ? ( type_n) 0 : \ - (( max_gv > ( mitkIpFloat8_t ) help / ( mitkIpFloat8_t ) help2 ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help / ( mitkIpFloat8_t ) help2 ) ? \ - ((type_n)help / (type_n)help2 ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncDivI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t min2, max2; /* extreme greyvalues of 2. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - mitkIpFloat8_t min_max12; /* product of min1 and max2 */ - mitkIpFloat8_t min_max21; /* product of min2 and max1 */ - - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check whether images have the same size */ - - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_1->type, pic_1->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mitkIpFuncExtr ( pic_2, &min2, &max2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 / max2; - smin = min1 / min2; - min_max12 = min1 / max2; - min_max21 = max1 / min2; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_1->type == mitkIpPicInt ) - { - if ( smax < max_gv && min_max12 < max_gv && min_max21 < max_gv && - smin > min_gv && min_max12 > min_gv && min_max21 > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicUInt ) - { - if ( smax < max_gv && min_max12 < max_gv && min_max21 < max_gv && - smin > min_gv && min_max12 > min_gv && min_max21 > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || min_max12 > max_gv || min_max21 > max_gv || - smin < min_gv || min_max12 < min_gv || min_max21 < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - { - mitkIpPicFORALL_2 ( DIVI, pic_1, pic_2, pic_new ) - } - else if ( keep == mitkIpFuncKeep ) - { - mitkIpPicFORALL_2 ( DIVI3, pic_1, pic_2, pic_new ) - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/DrawPoly.c b/Utilities/IpFunc/DrawPoly.c deleted file mode 100644 index 0578829cec3..00000000000 --- a/Utilities/IpFunc/DrawPoly.c +++ /dev/null @@ -1,388 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file -* this function draws the edge of an ROI in an image -*/ - -/** this function draws the edge of an ROI in an image - * @param pic_old pointer to original image - * @param pol_x vector with the x-coordinates of the points which - * form the roi - * @param pol_y vector with the y-coordinates of the points which - * form the roi - * @param no_pts number of points used to describe ROI - * - * @arg @c this function could just be used for 2D images - * - * @return image with roi - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncDrawPoly ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncDrawPoly\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define MAX( x, y ) ( x > y ) ? x : y -#define MIN( x, y ) ( x < y ) ? x : y - -#define DRAW( type, pic_help, a, b, pol_x, pol_y ) \ -{ \ - mitkIpUInt4_t beg; \ - mitkIpUInt4_t end; \ - mitkIpUInt4_t i, j; \ - mitkIpUInt4_t y; \ - type max; \ - \ - max = ( type ) max_gv; \ - /* draw polygon to pic_help */\ - \ - for ( i = 0; i < no_pts-1; i++ ) \ - { \ - if ( pol_x[i] == pol_x[i+1] ) \ - { \ - if ( pol_y[i] < pol_y[i+1] ) \ - { \ - beg = pol_y[i]; \ - end = pol_y[i+1]; \ - } \ - else \ - { \ - end = pol_y[i]; \ - beg = pol_y[i+1]; \ - } \ - for ( j = beg; j < end; j++ ) \ - (( type * )pic_help->data )[ j * pic_help->n[1] + pol_x[i]] = max;\ - } \ - else \ - { \ - if ( pol_x[i] < pol_x[i+1] ) \ - { \ - beg = pol_x[i]; \ - end = pol_x[i+1]; \ - } \ - else \ - { \ - end = pol_x[i]; \ - beg = pol_x[i+1]; \ - } \ - if ( pol_y[i] == pol_y[i+1] ) end = beg -1; \ - \ - for ( j = beg; j <= end; j++ ) \ - { \ - y = a[i] * j + b[i]; \ - (( type * )pic_help->data )[ y * pic_help->n[1] + j ] = max;\ - } \ - } \ - \ - if ( pol_y[i] == pol_y[i+1] ) \ - { \ - if ( pol_x[i] < pol_x[i+1] ) \ - { \ - beg = pol_x[i]; \ - end = pol_x[i+1]; \ - } \ - else \ - { \ - end = pol_x[i]; \ - beg = pol_x[i+1]; \ - } \ - \ - for ( j = beg; j < end; j++ ) \ - (( type * )pic_help->data )[ j + pic_help->n[1] * pol_y[i]] = max;\ - } \ - else \ - { \ - if ( pol_y[i] < pol_y[i+1] ) \ - { \ - beg = pol_y[i]; \ - end = pol_y[i+1]; \ - } \ - else \ - { \ - end = pol_y[i+1]; \ - beg = pol_y[i]; \ - } \ - if ( pol_x[i] == pol_x[i+1] ) end = beg - 1; \ - \ - for ( j = beg; j <= end; j++ ) \ - { \ - y = ( j - b[i] ) / a[i]; \ - (( type * )pic_help->data )[ j * pic_help->n[1] + y ] = max;\ - } \ - } \ - } \ - \ - if ( pol_x[no_pts-1] == pol_x[0] ) \ - { \ - if ( pol_y[no_pts-1] < pol_y[0] ) \ - { \ - beg = pol_y[no_pts-1]; \ - end = pol_y[0]; \ - } \ - else \ - { \ - end = pol_y[no_pts-1]; \ - beg = pol_y[0]; \ - } \ - \ - for ( j = beg; j < end; j++ ) \ - (( type * )pic_help->data )[ j * pic_help->n[1] + pol_x[no_pts-1]] = max;\ - } \ - else \ - { \ - if ( pol_x[no_pts-1] < pol_x[0] ) \ - { \ - beg = pol_x[no_pts-1]; \ - end = pol_x[0]; \ - } \ - else \ - { \ - end = pol_x[no_pts-1]; \ - beg = pol_x[0]; \ - } \ - if ( pol_y[no_pts-1] == pol_y[0] ) end = beg -1; \ - \ - for ( j = beg; j <= end; j++ ) \ - { \ - y = a[no_pts-1] * j + b[no_pts-1]; \ - (( type * )pic_help->data )[ y * pic_help->n[1] + j ] = max;\ - } \ - } \ - \ - if ( pol_y[no_pts-1] == pol_y[0] ) \ - { \ - if ( pol_x[no_pts-1] < pol_x[0] ) \ - { \ - beg = pol_x[no_pts-1]; \ - end = pol_x[0]; \ - } \ - else \ - { \ - end = pol_x[no_pts-1]; \ - beg = pol_x[0]; \ - } \ - \ - for ( j = beg; j < end; j++ ) \ - (( type * )pic_help->data )[ j + pic_help->n[1] * pol_y[no_pts-1]] = max;\ - } \ - else \ - { \ - if ( pol_y[no_pts-1] < pol_y[0] ) \ - { \ - beg = pol_y[no_pts-1]; \ - end = pol_y[0]; \ - } \ - else \ - { \ - end = pol_y[no_pts-1]; \ - beg = pol_y[0]; \ - } \ - if ( pol_x[no_pts-1] == pol_x[0] ) end = beg - 1; \ - \ - for ( j = beg; j <= end; j++ ) \ - { \ - y = ( j - b[no_pts-1] ) / a[no_pts-1]; \ - (( type * )pic_help->data )[ j * pic_help->n[1] + y ] = max;\ - } \ - } \ -} - -/* -------------------------------------------------------------------- */ - -/* -** mitkIpFuncDrawPoly -*/ - -mitkIpPicDescriptor *mitkIpFuncDrawPoly ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) -{ - - mitkIpUInt4_t min_x, max_x; /* min, max x-coordinate of ROI */ - mitkIpUInt4_t min_y, max_y; /* min, max y-coordinate of ROI */ - mitkIpFloat8_t min_gv, max_gv; - mitkIpFloat8_t *a, *b; /* Gerade y = ax+b */ - mitkIpFloat8_t diff; /* difference between two points */ - mitkIpPicDescriptor *pic_help; - mitkIpUInt4_t i; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim > 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* calculate min. and max. coordiantes of ROI */ - - min_x = pol_x[0]; - min_y = pol_y[0]; - max_x = pol_x[0]; - max_y = pol_y[0]; - for ( i = 1; i < no_pts; i++ ) - { - min_x = MIN ( min_x, pol_x[i] ); - min_y = MIN ( min_y, pol_y[i] ); - max_x = MAX ( max_x, pol_x[i] ); - max_y = MAX ( max_y, pol_y[i] ); - } - - /* check whether ROI is in image */ - - /* Expression is always false. - if ( min_x < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_x > pic_old->n[0] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Expression is always false. - if ( min_y < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_y > pic_old->n[1] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for a and b */ - - a = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - if ( !a ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - b = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - if ( !b ) - { - free ( a ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Geraden zwischen zwei benachbarten Punkten berechnen */ - - for ( i = 0; i < no_pts-1; i++ ) - { - diff = ( mitkIpFloat8_t ) pol_x[i+1] - ( mitkIpFloat8_t ) pol_x[i]; - if ( diff ) - { - a[i] = ( ( mitkIpFloat8_t ) pol_y[i+1] - ( mitkIpFloat8_t ) pol_y[i] ) / diff; - - b[i] = ( ( mitkIpFloat8_t ) pol_y[i] - a[i] * ( mitkIpFloat8_t )pol_x[i] ); - } - else - { - b[i] = 0.; - a[i] = 0.; - } - } - diff = ( mitkIpFloat8_t ) pol_x[no_pts-1] - ( mitkIpFloat8_t ) pol_x[0]; - if ( diff ) - { - a[no_pts-1] = ( ( mitkIpFloat8_t ) pol_y[no_pts-1] - ( mitkIpFloat8_t ) pol_y[0] ) / diff; - b[no_pts-1] = ( pol_y[no_pts-1] - a[no_pts-1] * pol_x[no_pts-1] ); - } - else - { - b[no_pts-1] = 0.; - a[no_pts-1] = 0.; - } - - - /* allocate memory for pic help */ - - pic_help = mitkIpPicClone ( pic_old ); - if ( pic_help == NULL ) - { - free ( a ); - free ( b ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - mitkIpPicFORALL_4 ( DRAW, pic_help, a, b, pol_x, pol_y ); - - free ( a ); - free ( b ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_help, pic_old); - - return ( pic_help ); -} -#endif diff --git a/Utilities/IpFunc/Equal.c b/Utilities/IpFunc/Equal.c deleted file mode 100644 index ab04954e334..00000000000 --- a/Utilities/IpFunc/Equal.c +++ /dev/null @@ -1,222 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file -* this function equalizes a greyvalue histogram -*/ - - -/** this function equalizes a greyvalue histogram - * - * @param pic_old pointer to the image that should be equalized - * @param kind intervall of transformation - * @arg @c mitkIpFuncMinMax (extreme greyvalues) - * @arg @c mitkIpFuncTotal (max. and min. possible - * greyvalues) - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the egalized image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncEqual ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ) ; - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncEqual\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of EQUAL-macro */ - -#define EQUAL( type, pic, pic_new, kind, factor, hist, help, size_hist ) \ -{ \ - type *hist_cp; \ - mitkIpUInt4_t i, no_elem; \ - mitkIpUInt4_t index; \ - mitkIpFloat8_t a, b; \ - mitkIpFloat8_t min, max; /* intervall for transformation */ \ - \ - /* allocate memory for the transformed histogram */ \ - \ - hist_cp = calloc( size_hist + 1, sizeof( type ) ); \ - if ( hist_cp == NULL ) \ - { \ - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); \ - return ( NULL ); \ - } \ - \ - /* cumulative greylevel histogram */ \ - \ - for ( i = 1; i <= size_hist; i++ ) \ - { \ - hist[i] = hist[i] + hist[i-1]; \ - } \ - \ - /* check wether linerisation in [min_gv, max_gv] or in [min_max] */ \ - \ - if ( kind == mitkIpFuncMinMax ) \ - { \ - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) \ - return ( mitkIpFuncERROR ); \ - } \ - else if ( kind == mitkIpFuncTotal ) \ - { \ - max = max_gv; \ - min = min_gv; \ - } \ - else \ - { \ - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); \ - free ( hist_cp ); \ - free ( hist ); \ - return ( mitkIpFuncERROR ); \ - } \ - \ - /* transformation of histogram */ \ - \ - a = ( mitkIpFloat8_t ) _mitkIpPicElements ( pic ) / ( max - min ); \ - b = - a * min; \ - for ( i = 0; i <= size_hist; i++ ) \ - hist_cp[i] = ( type ) ( ( ( mitkIpFloat8_t )hist[i] - b ) / a ); \ - \ - /* transform greyvalues */ \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - index = ( mitkIpUInt4_t ) \ - ( factor * ((( type * ) pic->data )[i] + ( type )help ) );\ - ( ( type * ) pic_new->data )[i] = ( type ) hist_cp[index]; \ - } \ - free ( hist_cp ); \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncEqual ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpUInt4_t *hist; /* greylevel histogram */ - mitkIpUInt4_t size_hist; /* no. of elements in histogram */ - mitkIpFloat4_t factor; - mitkIpFloat8_t help; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - { - mitkIpPicFree ( pic_new ); - return ( NULL ); - } - - /* calculate greylevel histogram */ - - mitkIpFuncHist ( pic_old, min_gv, max_gv, &hist, &size_hist ); - if ( hist == 0 ) - { - mitkIpPicFree ( pic_new ); - return ( NULL ); - } - - /* help variables to calculate histogram */ - - help = fabs ( min_gv ); - - if ( pic_old->type == mitkIpPicFloat ) - factor = 1000.; - else if ( pic_old->type == mitkIpPicInt || pic_old->type == mitkIpPicUInt ) - factor = 1.; - else - { - mitkIpPicFree ( pic_new ); - free ( hist ); - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( NULL ); - } - - /* macro to change image (for all data types) */ - - mitkIpPicFORALL_6 ( EQUAL, pic_old, pic_new, kind, factor, hist, help, size_hist ); - - free ( hist ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Ero.c b/Utilities/IpFunc/Ero.c deleted file mode 100644 index 1d7b96f0a49..00000000000 --- a/Utilities/IpFunc/Ero.c +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs an erosion - */ - -/** @brief this function performs an erosion - * - * If the original image is a binary image each pixel is connected with - * the surrounding - * pixels which are non zero in the kernel by using logical operations - * ( and for erosion, or for dilation ). Greylevel images are transformed - * by taking the minimum (erosion) of the surrounding pixels or the - * maximum (dilation). - * - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to the transformed image - * - * @par Uses - * @arg _mitkIpFuncError() - check the image data - * @arg _mitkIpFuncCompressM() - compress filtering mask - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncEro ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -mitkIpPicDescriptor *mitkIpFuncEro ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; - - pic_new = _mitkIpFuncMorph ( pic_old, pic_mask, mitkIpFuncEroF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new = mitkIpFuncBorder ( pic_new, pic_mask, pic_new ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/Error.c b/Utilities/IpFunc/Error.c deleted file mode 100644 index a45e0c80b1f..00000000000 --- a/Utilities/IpFunc/Error.c +++ /dev/null @@ -1,134 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions checks, whether the information of the image header - * are correct - */ - - /** @briefs checks, whether the information of the image header - * are correct - * - * @param pic pointer to the image - * - * @return mitkIpFuncOK - if data are correct - * @return mitkIpFuncERROR - if data aren't correct - * - * AUTHOR & DATE - */ - -/* include files */ - -# include "mitkIpFuncP.h" - -mitkIpUInt4_t _mitkIpFuncError ( mitkIpPicDescriptor *pic ); - - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/*-------------------------------------------------------------------*/ -/* -*/ -/*-------------------------------------------------------------------*/ - -mitkIpUInt4_t _mitkIpFuncError ( mitkIpPicDescriptor *pic ) -{ - mitkIpUInt4_t i; /* loop index */ - - /* is image existing ? */ - - if ( !pic ) - { - _mitkIpFuncSetErrno ( mitkIpFuncNOPIC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* is dimension correct ? */ - - if ( pic->dim < 1 || pic->dim > _mitkIpPicNDIM ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* is size correct ? */ - - for ( i = 0; i < pic->dim; i++ ) - if ( pic->n[i] < 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncSIZE_ERROR ); - return ( mitkIpFuncERROR ); - } - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) - pic->n[i] = 0; - - /* is image data type correct ? */ - - if ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) - { - if ( pic->bpe != 8 && pic->bpe != 16 && pic->bpe != 32 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else if ( pic->type == mitkIpPicFloat ) - { - if ( pic->bpe != 32 && pic->bpe != 64 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - return ( mitkIpFuncOK ); -} -#endif - diff --git a/Utilities/IpFunc/Exp.c b/Utilities/IpFunc/Exp.c deleted file mode 100644 index beff407d920..00000000000 --- a/Utilities/IpFunc/Exp.c +++ /dev/null @@ -1,154 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * transforms the greyvalues by an exponential function (y = exp (ax) + b) -*/ - -/** transforms the greyvalues by an exponential function (y = exp (ax) + b) - * - * @param pic_old pointer to the image that should be inverted - * @param kind determines - * mitkIpFuncTotal => transformation of all greyvalues - * mitkIpFuncMinMax=> transformation of greyvalues between min and max - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the image after exponential transformation - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncExp ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncExp\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of macro for normalisation */ - -#define EXP( type, pic, min_gv, max_gv ) \ -{ \ - mitkIpUInt4_t no_elem; \ - mitkIpFloat8_t a; \ - \ - a = log ( max_gv - min_gv + 1 ) / ( max_gv - min_gv ); \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - ( type ) ( exp ( a * ((( type * ) pic->data ) [i] - min_gv)) \ - -1 + min_gv ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -** function mitkIpFuncExp: -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncExp ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpUInt4_t i; /* loopindex */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - - - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. or min possible greyvalue for datatype */ - - if ( kind == mitkIpFuncTotal ) - { - if ( _mitkIpFuncExtT( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - } - else if ( kind == mitkIpFuncMinMax ) - { - if ( mitkIpFuncExtr ( pic_old, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL_2( EXP, pic_old, min_gv, max_gv ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/ExtT.c b/Utilities/IpFunc/ExtT.c deleted file mode 100644 index 134a6304f87..00000000000 --- a/Utilities/IpFunc/ExtT.c +++ /dev/null @@ -1,140 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function returns the allowed greyvalue range for a specific data-type - */ - -/** @brief this function returns the allowed greyvalue range for a - * specific data-type - * - * @param type data-type of image data - * @param bpe number of bits per element - * @param max_gv max. possible greyvalue - * @param min_gv min. possible greyvalue - * - * @return mitkIpFuncERROR if an error occured - * @return mitkIpFuncOK when no error occured - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpInt4_t _mitkIpFuncExtT ( mitkIpPicType_t type, - mitkIpUInt4_t bpe, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)_mitkIpFuncExtT\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -#ifdef _WIN32 -#include -#endif - -/* definition of EXP-macro */ - -#define EXP( max_gv, bpe ) \ -{ \ - mitkIpUInt4_t i; \ - \ - *max_gv = 1; \ - for ( i = 1; i <= bpe; i++ ) \ - *max_gv = *max_gv * 2; \ -} - -/* ------------------------------------------------------------------- */ -/* -** function _picExtT: calculates the max. and min. possible greyvalues for -** a certain datatype -*/ -/* ------------------------------------------------------------------- */ - -mitkIpInt4_t _mitkIpFuncExtT ( mitkIpPicType_t type, - mitkIpUInt4_t bpe, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv ) -{ - - /* calculate max. or min possible greyvalue for datatype */ - - if ( type == mitkIpPicInt ) - { - EXP( max_gv, bpe - 1 ) - *max_gv = *max_gv - 1; - *min_gv = - *max_gv; - } - else if ( type == mitkIpPicUInt ) - { - EXP (max_gv, bpe ) - *max_gv = *max_gv - 1; - *min_gv = 0; - } - else if ( type == mitkIpPicFloat ) - { - if ( bpe = 32 ) - { - *max_gv = FLT_MAX; - *min_gv = - FLT_MAX; - } - else if ( bpe = 64 ) - { - *max_gv = DBL_MAX; - *min_gv = - DBL_MAX; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - return ( mitkIpFuncOK ); -} -#endif diff --git a/Utilities/IpFunc/ExtrC.c b/Utilities/IpFunc/ExtrC.c deleted file mode 100644 index a92fbe95186..00000000000 --- a/Utilities/IpFunc/ExtrC.c +++ /dev/null @@ -1,220 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function calculates the extreme greyvalues of all greyvalues which are - * included by a circle. - */ - -/** @brief calculates the extreme greyvalues of all greyvalues which are - * included by a circle. - * - * The circle is described by its center and radius. - * - * @param pic_old pointer to the original image - * @param min` pointer to minimal greyvalue in circle ( return value ) - * @param max pointer to maximal greyvalue in circle ( return value ) - * @param center pointer to an array that contains the coordinates - * of the center - * of the circle - * @param radius radius of the circle - * - * @return mitkIpFuncOK - if no error occured - * @return mitkIpFuncERROR - if an error occured - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpUInt4_t mitkIpFuncExtrC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncExtrC\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - - -#define EXTR( type, pic, beg, end, size, center, radius ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t offset; /* offset of pixels in pic_new */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - mitkIpUInt4_t dist[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - mitkIpFloat8_t help; \ - \ - offset = 0; \ - for ( i = 0; i < pic->dim; i++ ) \ - offset = offset + center[i] * size[i]; \ - *max = ( mitkIpFloat8_t )( ( type * ) pic->data ) [offset]; \ - *min = ( mitkIpFloat8_t )( ( type * ) pic->data ) [offset]; \ - \ - for ( ind[7] = beg[7] ; ind[7] < end[7]; ind[7]++ ) \ - { \ - dist[7] = ( ind[7] - center[7] ) * ( ind[7] - center[7] ); \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6] ; ind[6] < end[6]; ind[6]++ ) \ - { \ - dist[6] = ( ind[6] - center[6] ) * ( ind[6] - center[6] ) + dist[7]; \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5] ; ind[5] < end[5]; ind[5]++ ) \ - { \ - dist[5] = ( ind[5] - center[5] ) * ( ind[5] - center[5] ) + dist[6]; \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4] ; ind[4] < end[4]; ind[4]++ ) \ - { \ - dist[4] = ( ind[4] - center[4] ) * ( ind[4] - center[4] ) + dist[5]; \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3] ; ind[3] < end[3]; ind[3]++ ) \ - { \ - dist[3] = ( ind[3] - center[3] ) * ( ind[3] - center[3] ) + dist[4]; \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2] ; ind[2] < end[2]; ind[2]++ ) \ - { \ - dist[2] = ( ind[2] - center[2] ) * ( ind[2] - center[2] ) + dist[3]; \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1] ; ind[1] < end[1]; ind[1]++ ) \ - { \ - dist[1] = ( ind[1] - center[1] ) * ( ind[1] - center[1] ) +dist[2];\ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1]+beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - dist[0] = ( ind[0] - center[0] ) * ( ind[0] - center[0] )+dist[1];\ - if ( sqrt ( ( mitkIpFloat8_t ) dist[0] ) <= radius ) \ - { \ - help = ( mitkIpFloat8_t )( ( type * ) pic->data ) [off[0]]; \ - *max = ( help > *max ) ? help : *max; \ - *min = ( help < *min ) ? help : *min; \ - } \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpUInt4_t mitkIpFuncExtrC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ) -{ - mitkIpInt4_t help; - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of window */ - mitkIpUInt4_t begin[_mitkIpPicNDIM]; /* beginning of window */ - mitkIpUInt4_t centr[_mitkIpPicNDIM]; /* beginning of window */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( radius <= 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - help = center[i] - radius; - if ( help < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - else begin[i] = ( mitkIpUInt4_t )help; - - help = center[i] + radius; - if ( (mitkIpUInt4_t) help > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - else end[i] = ( mitkIpUInt4_t )help + 1; - centr[i] = center[i]; - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - { - centr[i] = 0; - begin[i] = 0; - end[i] = 1; - } - - /* allocate image structure */ - - mitkIpPicFORALL_5 ( EXTR, pic_old, begin, end, size, centr, radius ); - - return ( mitkIpFuncOK ); -} - -#endif - diff --git a/Utilities/IpFunc/ExtrR.c b/Utilities/IpFunc/ExtrR.c deleted file mode 100644 index 9e01811b66b..00000000000 --- a/Utilities/IpFunc/ExtrR.c +++ /dev/null @@ -1,98 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the extreme values of all greyvalues included by a rectangle - */ - - -/** @brief calculates the extreme values of all greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to original image - * @param min pointer to minimal greyvalue ( return value ) - * @param max pointer to maximal greyvalue ( return value ) - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return mitkIpFuncOK if no error occured - * @return mitkIpFuncERROR if an error occured - * - * AUTHOR & DATE - */ -#include "mitkIpFuncP.h" - -mitkIpUInt4_t mitkIpFuncExtrR ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncExtrR\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -mitkIpUInt4_t mitkIpFuncExtrR ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) -{ - - mitkIpPicDescriptor *pic_help; - mitkIpInt4_t error; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - if ( pic_help ) - error = mitkIpFuncExtr ( pic_help, min, max ); - else - return ( mitkIpFuncERROR ); - - mitkIpPicFree ( pic_help ); - - return ( error ); -} -#endif diff --git a/Utilities/IpFunc/ExtrROI.c b/Utilities/IpFunc/ExtrROI.c deleted file mode 100644 index 9fcabb8c341..00000000000 --- a/Utilities/IpFunc/ExtrROI.c +++ /dev/null @@ -1,251 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the extreme greyvalues - * of all pixels which are included by a polygon which - * is described by a sequence of points - */ - -/** @brief calculates the extreme greyvalues - * of all pixels which are included by a polygon which - * is described by a sequence of points - * - * @param pic_old pointer to original image - * @param min minimal greyvalue in ROI ( return value ) - * @param max maximal greyvalue in ROI ( return value ) - * @param pol_x vector with the x-coordinates of the points which form - * form the roi - * @param pol_y vector with the y-coordinates of the points which form - * form the roi - * @param no_pts number of points used to describe ROI - * - * REMARKS - * this function could just be used for 2D images - * - * @return mitkIpFuncOK when no error occured - * @return mitkIpFuncERROR when an error occured - * - * AUTHOR & DATE - */ -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpUInt4_t mitkIpFuncExtrROI ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncExtrROI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/*definition of macros */ - -#define MAX( x, y ) ( x > y ) ? x : y -#define MIN( x, y ) ( x < y ) ? x : y -#define ROI( type, pic, pic_help ) \ -{ \ - mitkIpBool_t in; \ - mitkIpUInt4_t i, j; \ - mitkIpUInt4_t offset; \ - mitkIpFloat8_t help; \ - \ - *max = (( type * )pic->data )[pol_x[0] + pol_y[0] * pic->n[0]]; \ - *min = (( type * )pic->data )[pol_x[0] + pol_y[0] * pic->n[0]]; \ - for ( i = min_y; i <= max_y; i++ ) \ - { \ - in = mitkIpFalse; \ - offset = i * pic->n[0] + min_x; \ - for ( j = min_x; j <= max_x; j++ ) \ - { \ - if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( !in ) ) \ - in = mitkIpTrue; \ - else if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( in ) ) \ - { \ - in = mitkIpFalse; \ - help = ( mitkIpFloat8_t ) (( type * )pic->data )[offset]; \ - *max = MAX ( help, *max ); \ - *min = MIN ( help, *min ); \ - } \ - \ - if ( in ) \ - { \ - help = ( mitkIpFloat8_t ) (( type * )pic->data )[offset]; \ - *max = MAX ( help, *max ); \ - *min = MIN ( help, *min ); \ - } \ - offset++; \ - } \ - } \ -} - -/* -** mitkIpFuncMeanROI -*/ - -mitkIpUInt4_t mitkIpFuncExtrROI ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) -{ - mitkIpFloat8_t *a, *b; /* Gerade y = ax+b */ - mitkIpPicDescriptor *pic_help; /* contains edge of ROI */ - mitkIpUInt4_t min_x, max_x; /* min, max x-coordinate of ROI */ - mitkIpUInt4_t min_y, max_y; /* min, max y-coordinate of ROI */ - mitkIpUInt4_t i; /* loop variable */ - mitkIpFloat8_t diff; /* difference between two points */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim > 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate min. and max. coordiantes of ROI */ - - min_x = pol_x[0]; - min_y = pol_y[0]; - max_x = pol_x[0]; - max_y = pol_y[0]; - for ( i = 1; i < no_pts; i++ ) - { - min_x = MIN ( min_x, pol_x[i] ); - min_y = MIN ( min_y, pol_y[i] ); - max_x = MAX ( max_x, pol_x[i] ); - max_y = MAX ( max_y, pol_y[i] ); - } - - /* check whether ROI is in image */ - - /* Expression is always false! - if ( min_x < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - if ( max_x > pic_old->n[0] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - /* Expression is always false! - if ( min_y < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - if ( max_y > pic_old->n[1] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for a and b */ - - a = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - b = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - - /* Geraden zwischen zwei benachbarten Punkten berechnen */ - - for ( i = 0; i < no_pts-1; i++ ) - { - diff = ( mitkIpFloat8_t ) pol_x[i+1] - ( mitkIpFloat8_t ) pol_x[i]; - if ( diff ) - { - a[i] = ( ( mitkIpFloat8_t ) pol_y[i+1] - ( mitkIpFloat8_t ) pol_y[i] ) / diff; - b[i] = ( ( mitkIpFloat8_t ) pol_y[i] - a[i] * ( mitkIpFloat8_t )pol_x[i] ); - } - else - { - b[i] = 0.; - a[i] = 0.; - } - } - diff = ( mitkIpFloat8_t ) pol_x[no_pts-1] - ( mitkIpFloat8_t ) pol_x[0]; - if ( diff ) - { - a[no_pts-1] = ( ( mitkIpFloat8_t ) pol_y[no_pts-1] - ( mitkIpFloat8_t ) pol_y[0] ) / diff; - b[no_pts-1] = ( pol_y[no_pts-1] - a[no_pts-1] * pol_x[no_pts-1] ); - } - else - { - b[no_pts-1] = 0.; - a[no_pts-1] = 0.; - } - - /* draw polygon to image */ - - pic_help = _mitkIpFuncDrawPoly ( pic_old, pol_x, pol_y, no_pts, a, b ); - if ( ! pic_help ) - { - free ( a ); - free ( b ); - return ( mitkIpFuncERROR ); - } - - /* macro to calculate mean */ - - mitkIpPicFORALL_1 ( ROI, pic_old, pic_help ); - - - free ( a ); - free ( b ); - mitkIpPicFree ( pic_help ); - - return ( mitkIpFuncOK ); - -} - -#endif diff --git a/Utilities/IpFunc/Extrema.c b/Utilities/IpFunc/Extrema.c deleted file mode 100644 index eb80a033bc5..00000000000 --- a/Utilities/IpFunc/Extrema.c +++ /dev/null @@ -1,123 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the extreme greyvalues of an image - */ - - -/** this function calculates the extreme greyvalues of an image - * @param pic pointer to the image - * @param &min result variable: minimum - * @param &max result variable: maximum - * - * @return mitkIpFuncOK no error occured - * @return mitkIpFuncERROR an error occured - * - * AUTHOR - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpInt4_t mitkIpFuncExtr ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max ); - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncExtr\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of extreme value macro */ - -#define EXTR( type, pic, min_c, max_c ) \ - { \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no_elem; \ - mitkIpFloat8_t help; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - max_c = ( mitkIpFloat8_t )( ( type * ) pic->data ) [0]; \ - min_c = ( mitkIpFloat8_t )( ( type * ) pic->data ) [0]; \ - \ - for ( i = 1; i < no_elem; i++ ) \ - { \ - help = ( mitkIpFloat8_t )( ( type * ) pic->data ) [i]; \ - max_c = ( help > max_c ) ? help : max_c; \ - min_c = ( help < min_c ) ? help : min_c; \ - \ - } \ - } - -/* ========================================================== */ -/* -*/ -/* ========================================================== */ - -mitkIpInt4_t mitkIpFuncExtr ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max ) -{ - - mitkIpFloat8_t min_c = 0.0; - mitkIpFloat8_t max_c = 0.0; - - /* check data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* macro to calculate extreme values ( for all data types */ - - mitkIpPicFORALL_2( EXTR, pic, min_c, max_c) - - *min = min_c; - *max = max_c; - - return( mitkIpFuncOK ); -} -#endif - diff --git a/Utilities/IpFunc/FillArea.c b/Utilities/IpFunc/FillArea.c deleted file mode 100644 index c2efe084e31..00000000000 --- a/Utilities/IpFunc/FillArea.c +++ /dev/null @@ -1,201 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/**@file - * this function fills an area - */ - -/** @brief fills an area - * - * @warning not tested - * - * AUTHOR & DATE - */ - -#ifndef lint - static char *what = { "@(#)\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include-Files */ - -#include "mitkIpFuncP.h" - -/* definition of macros and constants */ - -#define KL < -#define GR > - -#define MAX( x, y ) ( x > y ) ? x : y -#define MIN( x, y ) ( x < y ) ? x : y - -#define RECT( type, pic, beg, end, value ) \ -{ \ - mitkIpUInt4_t i, j, n; \ - mitkIpUInt4_t offset; \ - \ - n = pic->n[0]; \ - for ( j = beg[1]; j < end[1]; j++ ) \ - { \ - offset = j * n; \ - for ( i = beg[0]; i < end[0]; i++ ) \ - (( type * )pic->data )[i + offset] = ( type ) value; \ - } \ -} -#define TRI( type, pic, beg, end, value, a, b, OP ) \ -{ \ - mitkIpUInt4_t i, j, n; \ - mitkIpUInt4_t offset; \ - mitkIpFloat8_t help; \ - \ - n = pic->n[0]; \ - for ( j = beg[1]; j < end[1]; j++ ) \ - { \ - offset = j * n; \ - for ( i = beg[0]; i < end[0]; i++ ) \ - { \ - help = a * i + b; \ - if ( j OP help ) \ - { \ - (( type * )pic->data )[i + offset] = ( type ) value; \ - } \ - } \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncFillArea ( mitkIpPicDescriptor *pic_old, - mitkIpFuncBox_t box, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t over, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpFloat8_t a, b; /* parameter der Gerade y = ax + b */ - mitkIpUInt4_t beg[2]; /* Anfangswerte */ - mitkIpUInt4_t end[2]; /* Endwerte */ - - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - if ( pic_new != pic_old ) - { - memmove ( pic_new->data, pic_old->data, _mitkIpPicElements ( pic_old ) * pic_old->bpe /8 ); - } - - /* Gerade durch die beiden Punkte */ - - a = ( ( mitkIpFloat8_t ) box.y1 - ( mitkIpFloat8_t ) box.y0 ) / - ( ( mitkIpFloat8_t ) box.x1 - ( mitkIpFloat8_t ) box.x0 ); - - b = ( mitkIpFloat8_t ) box.y0 - a * box.x0; - - /* check which region (above/beneath) has to be changed */ - - if ( over == mitkIpFuncAbove ) - { - beg[0] = 0; end[0] = pic_old->n[0]; - beg[1] = 0; end[1] = MIN ( box.y0, box.y1 ); - /* printf ( "1.Rechteck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_3 ( RECT, pic_new, beg, end, value ); - - beg[0] = ( box.y0 < box.y1 ) ? box.x1 : 0; - end[0] = ( box.y0 < box.y1 ) ? pic_old->n[0] : box.x0; - beg[1] = MIN ( box.y0, box.y1 ); - end[1] = MAX ( box.y0, box.y1 ); -/* printf ( "2.Rechteck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_3 ( RECT, pic_new, beg, end, value ); - - beg[0] = box.x0; end[0] = box.x1; - beg[1] = MIN ( box.y0, box.y1 ); - end[1] = MAX ( box.y0, box.y1 ); -/* printf ( "1.Dreieck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_6 ( TRI, pic_new, beg, end, value, a, b, KL ); - } - else if ( over == mitkIpFuncBeneath ) - { - beg[0] = 0; end[0] = pic_old->n[0]; - beg[1] = MAX ( box.y0, box.y1 ); end[1] = pic_old->n[1]; -/* printf ( "1.Rechteck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_3 ( RECT, pic_new, beg, end, value ); - - beg[0] = ( box.y0 < box.y1 ) ? 0 : box.x1; - end[0] = ( box.y0 < box.y1 ) ? box.x0 : pic_old->n[0]; - beg[1] = MIN ( box.y0, box.y1 ); - end[1] = MAX ( box.y0, box.y1 ); -/* printf ( "2.Rechteck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_3 ( RECT, pic_new, beg, end, value ); - - beg[0] = box.x0; end[0] = box.x1; - beg[1] = MIN ( box.y0, box.y1 ); - end[1] = MAX ( box.y0, box.y1 ); -/* printf ( "1.Dreieck: beg %d %d end: %d %d \n", beg[0], beg[1], end[0], end[1] ); */ - mitkIpPicFORALL_6 ( TRI, pic_new, beg, end, value, a, b, GR ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - - return pic_new; -} - diff --git a/Utilities/IpFunc/Frame.c b/Utilities/IpFunc/Frame.c deleted file mode 100644 index 5d1393039b4..00000000000 --- a/Utilities/IpFunc/Frame.c +++ /dev/null @@ -1,119 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function adds a frame around an image - */ - -/** @brief adds a frame around an image - * - * The thickness of the frame can be chosen separately for each dimension - * (parameter edge). The original image will not be changed, instead a - * new one will be returned. - * - * @param pic_old image to which the frame will be added - * @param edge vector with the thichness' of the frame in each direction - * @param value this greyvalue is used for the frame - * - * $Log$ - * Revision 1.3 2005/10/05 16:31:55 nolden - * FIX: added newline to avoid warning - * - * Revision 1.2 2000/05/24 15:29:42 tobiask - * Changed the installation paths of the package. - * - * Revision 1.4 2000/05/04 12:52:10 ivo - * inserted BSD style license - * - * Revision 1.3 2000/03/06 17:02:39 ivo - * ipFunc now with doxygen documentation. - * - * Revision 1.2 2000/02/18 14:58:02 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 2000/02/18 15:30:50 ivo - * memory leak removed: mitkIpFuncKeep in call of mitkIpFuncWindowR substituted - * by mitkIpFuncKeep (pic_new is already a new image!). - * - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" -mitkIpPicDescriptor *mitkIpFuncFrame ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncFrame ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - - pic_new = _mitkIpFuncBorderX ( pic_old, edge, value ); - if ( mitkIpFuncErrno > mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - else - pic_new = mitkIpFuncWindowR ( pic_new, pic_old, edge, mitkIpFuncNoKeep ); - - /* Copy Tags */ - - strncpy( pic_new->info->version, pic_old->info->version, _mitkIpPicTAGLEN ); - pic_new->info->tags_head = _mitkIpPicCloneTags( pic_old->info->tags_head ); - pic_new->info->write_protect = pic_old->info->write_protect; - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/GaussF.c b/Utilities/IpFunc/GaussF.c deleted file mode 100644 index d45dbbef110..00000000000 --- a/Utilities/IpFunc/GaussF.c +++ /dev/null @@ -1,213 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function smoothes an image using a filtering mask which consists - * of elements calculated from a Gausian distribution - */ - -/** this function smoothes an image using a filtering mask which consists - * of elements calculated from a Gausian distribution - * - * @param pic_old pointer to original image - * @param len_mask number of mask elements for each dimension - * @param dim_mask dimension of mask - * @param border handling of the edge - * @arg @c mitkIpFuncBorderZero : set edge pixels to zero - * @arg @c mitkIpFuncBorderOld : keep greyvalues of original image - * - * @return pointer to smoothed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" -mitkIpPicDescriptor *mitkIpFuncGausF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncGaussF\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* --------------------------------------------------------------------- */ -/* -** function mitkIpFuncGausF -*/ -/* --------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncGausF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image structure */ - mitkIpPicDescriptor *pic_mask; /* pointer to mask */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* size of each dimension */ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ - mitkIpUInt4_t i, k; /* loop index */ - mitkIpUInt4_t no_elem; /* number of mask elements */ - mitkIpUInt4_t offset; /* offset of pixels */ - mitkIpUInt4_t element; /* used to calculate mask elements */ - mitkIpUInt4_t sum; /* sum of all mask elements */ - mitkIpUInt4_t nn, nfac, kfac; /* used to calculate bin. coeff */ - mitkIpUInt4_t *bin; /* binomial coeffizients */ - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim < dim_mask || dim_mask < 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( len_mask % 2 != 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate binomial coefficient */ - - bin = malloc ( len_mask * sizeof ( mitkIpUInt4_t ) ); - if ( bin == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - nn = len_mask; - bin[0] = 1; - bin[nn-1] = 1; - nfac = 1; - kfac = 1; - - for ( k = 1; k < nn-1; k++ ) - { - kfac = k * kfac; - nfac = nfac * ( nn - k ); - bin[k] = nfac / kfac; - } - - /* initialize mask */ - - pic_mask = mitkIpPicNew(); - - if ( pic_mask == NULL ) - { - free ( bin ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicFloat; - pic_mask->bpe = 64; - pic_mask->dim = dim_mask; - - for ( i = 0; i < dim_mask; i++ ) pic_mask->n[i] = len_mask; - - pic_mask->data = malloc ( _mitkIpPicSize ( pic_mask ) ); - - if ( pic_mask->data == NULL ) - { - free ( bin ); - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialize vectors */ - - for ( i = 0; i < pic_mask->dim; i++ ) - n[i] = len_mask; - for ( i = pic_mask->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - /* calculate mask */ - - offset = 0; - sum = 0; - for ( ind[7] = 0; ind[7] < n[7]; ind[7]++ ) - for ( ind[6] = 0; ind[6] < n[6]; ind[6]++ ) - for ( ind[5] = 0; ind[5] < n[5]; ind[5]++ ) - for ( ind[4] = 0; ind[4] < n[4]; ind[4]++ ) - for ( ind[3] = 0; ind[3] < n[3]; ind[3]++ ) - for ( ind[2] = 0; ind[2] < n[2]; ind[2]++ ) - for ( ind[1] = 0; ind[1] < n[1]; ind[1]++ ) - for ( ind[0] = 0; ind[0] < n[0]; ind[0]++ ) - { - element = 1; - for ( i = 0; i < pic_mask->dim; i++ ) - element = element * bin[ind[i]]; - - (( mitkIpFloat8_t * )pic_mask->data)[offset] = - ( mitkIpFloat8_t ) element; - sum = sum + element; - offset++; - } - - no_elem = _mitkIpPicElements ( pic_mask ); - for ( i = 0; i < no_elem; i++ ) - (( mitkIpFloat8_t * ) pic_mask->data ) [i] = - (( mitkIpFloat8_t * ) pic_mask->data ) [i] / ( mitkIpFloat8_t ) sum; - - /* convolve image with Gausian mask */ - - pic_new = mitkIpFuncConv ( pic_old, pic_mask, border ); - - mitkIpPicFree ( pic_mask ); - free ( bin ); - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} - -#endif - diff --git a/Utilities/IpFunc/Grad.c b/Utilities/IpFunc/Grad.c deleted file mode 100644 index 29881ff2f7c..00000000000 --- a/Utilities/IpFunc/Grad.c +++ /dev/null @@ -1,358 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs an absolute gradient to extract - * edges of an image - */ - -/** @brief performs an absolute gradient to extract - * edges of an image - * - * @param pic_old pointer to original image - * @param dim_mask dimension of mask - * @param border tells how the edge is transformed - * mitkIpFuncBorderOld: original greyvalues - * mitkIpFuncBorderZero: edge is set to minimal greyvalue - * - * @return pointer to transformed iamge - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncGrad ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) ; -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncGrad\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define GRAD( type, pic, pic_new, pic_mask, m, beg, end, dim_mask ) \ -{ \ - mitkIpUInt4_t i, j; /* loop index */ \ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - mitkIpUInt4_t begin[_mitkIpPicNDIM]; \ - mitkIpFloat8_t help, help2; \ - \ - /* initialisation of vectors */ \ - \ - size [0] = 1; \ - for ( i = 1; i < pic->dim; i++ ) \ - size[i] = size[i-1] * pic_old->n[i-1]; \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - size[i] = 0; \ - \ - begin[0] = 0; \ - for ( i = 1; i <= dim_mask; i++ ) \ - begin[i] = begin[i-1] + m->length / dim_mask; \ - \ - /* transformation of image */ \ - \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - help2 = 0; \ - for ( j = 0; j < dim_mask; j++ ) \ - { \ - help = 0; \ - for ( i = begin[j]; i < begin[j+1]; i++ ) \ - { \ - help = help + m->mask_vekt[i] / sum * ( mitkIpFloat8_t )\ - (( type * )pic->data )[off[0]+m->off_vekt[i]];\ - } \ - help2 = help2 + help * help; \ - } \ - (( type * )pic_new->data)[off[0]] = \ - ( type ) sqrt ( help2 / dim_mask ) / 2.; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -/* ----------------------------------------------------------------- */ -/* -** mitkIpFuncGrad -*/ -/* ----------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncGrad ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - #include "gradient.h" - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpPicDescriptor *pic_mask; /* sobel mask */ - mitkIpUInt4_t pos; /* position in m->off_vekt */ - mitkIpUInt4_t i, j; /* loopindex */ - mitkIpUInt4_t off_mask; /* loopindex */ - mitkIpFuncMasc_t *m; /* compressed mask */ - mitkIpInt4_t offset; - mitkIpInt4_t beg[_mitkIpPicNDIM]; - mitkIpInt4_t end[_mitkIpPicNDIM]; - mitkIpInt4_t ind[_mitkIpPicNDIM]; - mitkIpUInt4_t size[_mitkIpPicNDIM]; - mitkIpInt4_t n[_mitkIpPicNDIM]; - mitkIpFloat8_t sum; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( ( dim_mask > 4 ) || ( dim_mask < 1 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( pic_old->dim < dim_mask ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* create a new picture, copy the header, allocate memory */ - - if ( border == mitkIpFuncBorderOld ) - pic_new = mitkIpPicClone ( pic_old ); - else if ( border == mitkIpFuncBorderZero ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new->data == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of pic_mask */ - - pic_mask = mitkIpPicNew (); - if ( pic_mask == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicInt; - pic_mask->bpe = 16; - pic_mask->dim = dim_mask+1; - for ( i = 0; i < dim_mask; i++ ) - pic_mask->n[i] = 3; - pic_mask->n[dim_mask] = dim_mask; - - if ( dim_mask == 4 ) - pic_mask->data = mask4; - else if ( dim_mask == 3 ) - pic_mask->data = mask3; - else if ( dim_mask == 2 ) - pic_mask->data = mask2; - else - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - - for ( i = 0; i < dim_mask; i++ ) - n[i] = pic_mask->n[i] / 2 + 1; - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - n[i] = 0; - - for ( i = 0; i < dim_mask; i++ ) - { - end[i] = pic_old->n[i] - pic_mask->n[i] / 2; - beg[i] = ( ( pic_mask->n[i] % 2 ) == 1 ) ? - ( pic_mask->n[i] / 2 ) : ( pic_mask->n[i] / 2 - 1 ); - } - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - beg[i] = 0; - - for ( i = dim_mask; i < pic_old->dim; i++ ) - end[i] = pic_old->n[i]; - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - end[i] = beg[i] + 1; - - size [0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - - /* allocate mask-structure */ - - m = malloc ( sizeof ( mitkIpFuncMasc_t ) ); - if ( m == NULL ) - { - mitkIpPicFree ( pic_new ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->off_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpInt4_t ) ); - if ( m->off_vekt == NULL ) - { - mitkIpPicFree ( pic_new ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - m->mask_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpFloat8_t ) ); - if ( m->mask_vekt == NULL ) - { - mitkIpPicFree ( pic_new ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - free ( m->off_vekt ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate offset vector for the compressed mask */ - - m->length = 0; - - off_mask = 0; - for ( i = 0; i < pic_mask->n[dim_mask] ; i++ ) - for ( ind[3] = -1; ind[3] < n[3]; ind[3]++ ) - for ( ind[2] = -1; ind[2] < n[2]; ind[2]++ ) - for ( ind[1] = -1; ind[1] < n[1]; ind[1]++ ) - for ( ind[0] = -1; ind[0] < n[0]; ind[0]++ ) - { - if ( (( mitkIpInt2_t * )pic_mask->data)[off_mask] != 0 ) - { - offset = 0; - for ( j = 0; j < dim_mask; j++ ) - offset = offset + ind[j] * size[j]; - m->off_vekt[m->length] = offset; - m->length++; - } - off_mask++; - } - - /* remove elements that are zero from mask */ - - pos = 0; - sum = 0; - for ( i = 0; i < m->length; i++ ) - { - while ( (( mitkIpInt2_t * )pic_mask->data)[pos] == 0 ) pos++; - m->mask_vekt[i] = ( mitkIpFloat8_t )(( mitkIpInt2_t * )pic_mask->data)[pos]; - sum = sum + fabs ( m->mask_vekt[i] ); - pos++; - } - - sum = sum / ( 2 * dim_mask ); - - mitkIpPicFORALL_6 ( GRAD, pic_old, pic_new, pic_mask, m, beg, end, dim_mask ); - - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Grav.c b/Utilities/IpFunc/Grav.c deleted file mode 100644 index 623ce9243fa..00000000000 --- a/Utilities/IpFunc/Grav.c +++ /dev/null @@ -1,159 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * This Function calculates the center of gravity of an region of - * interest in an binary image - */ - -/** @brief calculates the center of gravity of an region of - * interest in an binary image - * - * @param pic binary image: contains the region of interest - * - * @return pointer to the vector which contains the coordinates - * of the center of gravity - * - * AUTHOR & DATE - */ - - - -/* include Files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t *mitkIpFuncGrav ( mitkIpPicDescriptor *pic_old ); - -#ifndef DOXYGEN_IGNORE - -/* definition of reflect-macro */ - -#define GRAV( type, pic, index ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no; \ - mitkIpUInt4_t offset_refl; \ - mitkIpInt4_t n[_mitkIpPicNDIM]; \ - \ - for ( i = 0; i < pic_old->dim; i++ ) \ - n[i] = pic_old->n[i]; \ - \ - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) \ - n[i] = 1; \ - \ - no = 0; \ - offset_refl = 0; \ - for ( index[7] = 0; index[7] < n[7]; index[7]++ ) \ - \ - for ( index[6] = 0; index[6] < n[6]; index[6]++ ) \ - \ - for ( index[5] = 0; index[5] < n[5]; index[5]++ ) \ - \ - for ( index[4] = 0; index[4] < n[4]; index[4]++ ) \ - \ - for ( index[3] = 0; index[3] < n[3]; index[3]++ ) \ - \ - for ( index[2] = 0; index[2] < n[2]; index[2]++ ) \ - \ - for ( index[1] = 0; index[1] < n[1]; index[1]++ ) \ - \ - for ( index[0] = 0; index[0] < n[0]; index[0]++ ) \ - { \ - if ( (( type * )pic->data )[offset_refl] ) \ - { \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - gravity[i] = gravity[i] + index[i]; \ - } \ - no++; \ - } \ - offset_refl++; \ - } \ - \ - for ( i = 0; i < pic->dim; i++ ) gravity[i] = gravity[i]/no; \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpFloat8_t *mitkIpFuncGrav ( mitkIpPicDescriptor *pic_old ) -{ - - mitkIpUInt4_t index_vect[_mitkIpPicNDIM]; /* loopindex-vector */ - mitkIpInt4_t n[_mitkIpPicNDIM]; /* number of pixels in each */ - /* dimension */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t *gravity; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* initialisation of vectors */ - - for ( i = 0; i < pic_old->dim; i++ ) - n[i] = pic_old->n[i]; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - index_vect[i] = 0; - - gravity = ( mitkIpFloat8_t * ) malloc ( 8 * sizeof ( mitkIpFloat8_t ) ); - if ( gravity == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - gravity[i] = 0.; - - mitkIpPicFORALL_1 ( GRAV, pic_old, index_vect ) - - return gravity; -} -#endif diff --git a/Utilities/IpFunc/Hist.c b/Utilities/IpFunc/Hist.c deleted file mode 100644 index c7ce45a968a..00000000000 --- a/Utilities/IpFunc/Hist.c +++ /dev/null @@ -1,174 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function calculates the greyvalue histogram of an image - */ - -/** this function calculates the greyvalue histogram of an image - * - * @param pic_old pointer to the image that should be inverted - * @param min_gv min. greyvalue in histogram - * @param max_gv max. greyvalue in histogram - * @param hist pointer to the greyvalue histogram ( return value ) - * @param size_hist pointer to the number of elements in the histogram - * ( result value ) - * - * @return @arg @c mitkIpFuncERROR - if an error occured - * @return @arg @c mitkIpFuncOK - if no error occured - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpInt4_t mitkIpFuncHist ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ) ; - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncHist\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* definition of HIST-macro */ - -#define HIST( type, pic, help, factor ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no_elem; \ - mitkIpUInt4_t index; \ - \ - /* calculate histogram */ \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - index = ( mitkIpUInt4_t ) \ - ( factor * ( (( type * ) pic->data)[i] + ( type ) help) );\ - ( hist_help[index] )++; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpInt4_t mitkIpFuncHist ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ) -{ - mitkIpUInt4_t *hist_help; - mitkIpFloat8_t help; /* absolute of min_gv */ - mitkIpFloat8_t min, max; /* extreme greyvalues */ - mitkIpUInt4_t factor; /* factor to calculate histogram of */ - /* float images */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( min_gv == 0 && max_gv == 0 ) - { - if ( mitkIpFuncExtr ( pic_old, &min_gv, &max_gv ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - } - else - { - if ( min_gv > max_gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( min_gv > min || max_gv < max ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* calculate variables which are necessary to calculate histogram */ - /* index */ - - help = fabs ( min_gv ); - - if ( pic_old->type == mitkIpPicInt || pic_old->type == mitkIpPicUInt ) - factor = 1; - else if ( pic_old->type == mitkIpPicFloat ) - factor = 1000; - else - { - _mitkIpFuncSetErrno (mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory */ - - *size_hist = factor * ( ( mitkIpUInt4_t ) max_gv + ( mitkIpUInt4_t ) help ); - -/*hist = ( mitkIpUInt4_t ** ) malloc ( sizeof ( mitkIpUInt4_t * ) );*/ - *hist = ( mitkIpUInt4_t * ) calloc ( *size_hist+1, sizeof ( mitkIpUInt4_t ) ); - hist_help = *hist; - if ( hist_help == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to calculate the histogram */ - - mitkIpPicFORALL_2 ( HIST, pic_old, help, factor ); - - return ( mitkIpFuncOK ); -} -#endif diff --git a/Utilities/IpFunc/Histo.c b/Utilities/IpFunc/Histo.c deleted file mode 100644 index 5c3644ec4f4..00000000000 --- a/Utilities/IpFunc/Histo.c +++ /dev/null @@ -1,180 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function calculates the greyvalue histogram of an image - */ - -/** this function calculates the greyvalue histogram of an image - * - * @param pic_old pointer to the image that should be inverted - * @param min_gv min. greyvalue in histogram; if min_gv==max_gv==0 - * the min/max greyvalues are calculated - * @param max_gv max. greyvalue in histogram - * @param hist pointer to the greyvalue histogram ( return value ) - * @param size_hist pointer to the number of elements in the histogram - * ( result value ) - * - * @return @arg @c mitkIpFuncERROR - if an error occured - * @return @arg @c mitkIpFuncOK - if no error occured - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpInt4_t mitkIpFuncHisto( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ) ; - -#ifndef DOXYGEN_IGNORE - -/* definition of HIST-macro */ - -#define HIST( type, pic, help, factor ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no_elem; \ - mitkIpUInt4_t index; \ - \ - /* calculate histogram */ \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - index = ( mitkIpUInt4_t ) \ - ( factor * ( (( type * ) pic->data)[i] - ( type )*min_gv ) );\ - if ( ( index <= *size_hist ) ) \ - ( hist_help[index] )++; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpInt4_t mitkIpFuncHisto( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ) -{ - mitkIpUInt4_t *hist_help; - mitkIpFloat8_t help; /* absolute of min_gv */ - mitkIpFloat8_t min, max; /* extreme greyvalues */ - mitkIpUInt4_t factor; /* factor to calculate histogram of */ - /* float images */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( *min_gv == 0 && *max_gv == 0 ) - { - if ( mitkIpFuncExtr ( pic_old, min_gv, max_gv ) != mitkIpFuncOK ) - { - printf("ipFunc: Probleme mit dem eingegebenen Intervall\n"); - return ( mitkIpFuncERROR ); - } - } - else - { - if ( *min_gv > *max_gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - printf("ipFunc: Probleme mit dem eingegebenen Intervall\n"); - return ( mitkIpFuncERROR ); - } - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( *min_gv < min || *max_gv > max ) - { - printf("ipFunc: Probleme mit dem von ipFunc Extrema berechnete Intervall\n"); - printf("ipFunc: Von Extrema: %f %f \n", *min_gv, *max_gv); - /* - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - */ - } - } - - /* calculate variables which are necessary to calculate histogram */ - /* index */ - - help = fabs ( *min_gv ); - - if ( pic_old->type == mitkIpPicInt || pic_old->type == mitkIpPicUInt ) - factor = 1; - else if ( pic_old->type == mitkIpPicFloat ) - factor = 1000; - else - { - printf("ipFunc: Probleme mit dem von ipFunc Extrema berechnete Intervall\n"); - _mitkIpFuncSetErrno (mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory */ - - *size_hist = 1 + factor * (mitkIpUInt4_t ) ( ( mitkIpInt4_t ) *max_gv - ( mitkIpInt4_t ) *min_gv ); - -/*hist = ( mitkIpUInt4_t ** ) malloc ( sizeof ( mitkIpUInt4_t * ) );*/ - *hist = ( mitkIpUInt4_t * ) calloc ( *size_hist+1, sizeof ( mitkIpUInt4_t ) ); - hist_help = *hist; - if ( hist_help == NULL ) - { - printf("ipFunc: Probleme mit dem Allokieren von Platz\n"); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to calculate the histogram */ - - mitkIpPicFORALL_2 ( HIST, pic_old, help, factor ); - - return ( mitkIpFuncOK ); -} -#endif - diff --git a/Utilities/IpFunc/HitMiss.c b/Utilities/IpFunc/HitMiss.c deleted file mode 100644 index 1c358fe2c10..00000000000 --- a/Utilities/IpFunc/HitMiss.c +++ /dev/null @@ -1,132 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs the morphological hit and miss operation - */ - -/** @brief performs the morphological hit and miss operation - * - * @param pic_old pointer to original image - * @param pic_masks pointer to a set of hit and miss masks - * ( if pic_masks = NULL -> default masks are used ) - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to minimal greyvalue - * - * @return pointer to image after hit and miss operation - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncHitMiss ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncHitMiss\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* ------------------------------------------------------------------ */ -/* -** mitkIpFuncHitMiss -*/ -/* ------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncHitMiss ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ) -{ - mitkIpBool_t allocated=mitkIpFalse; - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt1_t mask[] = /* hit and miss mask (edge detection) */ - { 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0 }; - - if ( pic_masks == NULL ) - { - allocated = mitkIpTrue; - pic_masks = mitkIpPicNew (); - if ( pic_masks == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_masks->dim = 3; - pic_masks->type = mitkIpPicUInt; - pic_masks->bpe = 8; - pic_masks->n[0] = 3; - pic_masks->n[1] = 3; - pic_masks->n[2] = 8; - pic_masks->data = mask; - } - pic_new = _mitkIpFuncHitMissI ( pic_old, pic_masks, border ); - - if ( allocated ) - { - pic_masks->data = NULL; - mitkIpPicFree ( pic_masks ); - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/HitMissI.c b/Utilities/IpFunc/HitMissI.c deleted file mode 100644 index 834a412fe8e..00000000000 --- a/Utilities/IpFunc/HitMissI.c +++ /dev/null @@ -1,314 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* performs the morphological hit and miss operator - * - * FUNCTION DECLARATION - * mitkIpPicDescriptor *_mitkIpFuncHitMissI( mitkIpPicDescriptor *pic_old, - * mitkIpPicDescriptor *pic_masks, - * mitkIpFuncFlagI_t border ) - * - * PARAMETERS - * - * RETURN VALUES - * - * AUTHOR & DATE - * Antje Schroeder 05.09.95 - * - * UPDATES - * a short history of the file - * - *--------------------------------------------------------------------- - */ -#ifndef lint - static char *what = { "@(#)mitkIpFuncHitMissI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - -/* definition of macros */ - -#define C_MASC( typ, pic_masks, m1, m2, end_m, beg_m1, beg_m2 ) \ -{ \ - mitkIpUInt4_t no_elem; \ - mitkIpUInt4_t i; /* loop variable */ \ - \ - /* copy pic_masks to mask_1 and mask_2 */ \ - \ - for ( i = 0; i < end_m; i++ ) \ - { \ - (( typ * )mask_1->data )[i] = (( typ * )pic_masks->data )[i + beg_m1]; \ - (( typ * )mask_2->data )[i] = (( typ * )pic_masks->data )[i + beg_m2]; \ - } \ - \ - /* check mask data */ \ - \ - no_elem = _mitkIpPicElements ( mask_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - if ( (( typ * )mask_1->data )[i] != 0 && \ - (( typ * )mask_2->data )[i] != 0 ) \ - { \ - mitkIpPicFree ( mask_1 ); \ - mitkIpPicFree ( mask_2 ); \ - mitkIpPicFree ( pic_1 ); \ - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); \ - return ( mitkIpFuncERROR ); \ - } \ - \ - /* compress masks */ \ - \ - m1 = _mitkIpFuncCompressM ( mask_1, pic_old, mitkIpFuncNoReflect, beg, end ); \ - m2 = _mitkIpFuncCompressM ( mask_2, pic_old, mitkIpFuncNoReflect, beg, end ); \ - \ -} - -#define HITMISS( type_i, pic_old, pic_new, pic_inv ) \ -{ \ - type_i help; \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t end_m; /* loop index */ \ - mitkIpUInt4_t beg_m1; /* */ \ - mitkIpUInt4_t beg_m2; /* */ \ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - mitkIpFloat8_t max, min; /* max and min possible greyvalue */ \ - \ - /* initialisation of vectors */ \ - \ - size [0] = 1; \ - for ( i = 1; i < _mitkIpPicNDIM; i++ ) \ - size[i] = size[i-1] * pic_old->n[i-1]; \ - size[pic_old->dim] = 0; \ - \ - \ - /* calculate max. and min. possible greyvalues */ \ - \ - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min, &max ) != mitkIpFuncOK ) \ - { \ - mitkIpPicFree ( mask_1 ); \ - mitkIpPicFree ( mask_2 ); \ - mitkIpPicFree ( pic_1 ); \ - return ( mitkIpFuncERROR ); \ - } \ - \ - /* transformation of image */ \ - \ - end_m = _mitkIpPicElements ( pic_masks ) / pic_masks->n[dim] ; \ - for ( j = 0; j < pic_masks->n[dim] / 2; j++ ) \ - { \ - /* copy masks and compress them */ \ - \ - beg_m1 = 2 * j * end_m; \ - beg_m2 = beg_m1 + end_m; \ - mitkIpPicFORALL_5 ( C_MASC, pic_masks, m1, m2, end_m, beg_m1, beg_m2 ); \ - \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - help = (( type_i * ) \ - pic_old->data )[off[0]+ m1->off_vekt[0]]; \ - for ( i = 1; i < m1->length; i++ ) \ - { \ - help = help && \ - (( type_i * )pic_old->data ) \ - [m1->off_vekt[i]+off[0]]; \ - } \ - for ( i = 0; i < m2->length; i++ ) \ - { \ - help = help && \ - (( type_i * )pic_inv->data ) \ - [m2->off_vekt[i]+off[0]]; \ - } \ - (( type_i * )pic_new->data )[off[0]] = ( (( type_i * ) \ - pic_new->data )[off[0]] || ( type_i ) help ) * max;\ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - free ( m1->off_vekt ); \ - free ( m1->mask_vekt ); \ - free ( m1 ); \ - free ( m2->off_vekt ); \ - free ( m2->mask_vekt ); \ - free ( m2 ); \ - } \ -} - - -/* ------------------------------------------------------------------------- */ -/* -** mitkIpFuncHitMissI -*/ -/* ------------------------------------------------------------------------- */ - - mitkIpPicDescriptor *_mitkIpFuncHitMissI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_inv; /* pointer to the inverted image */ - mitkIpPicDescriptor *pic_1; /* image after hit and miss */ - mitkIpPicDescriptor *mask_1; /* hit mask */ - mitkIpPicDescriptor *mask_2; /* miss mask */ - mitkIpInt4_t beg[_mitkIpPicNDIM]; /* */ - mitkIpInt4_t end[_mitkIpPicNDIM]; /* */ - mitkIpFuncMasc_t *m1, *m2; /* compressed masks */ - mitkIpUInt4_t dim; /* dimension of mask */ - mitkIpUInt4_t j; /* loop variable */ - - /* check image data and mask data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_masks ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* allocate memory for masks */ - - dim = pic_masks->dim - 1; - mask_1 = mitkIpPicCopyHeader ( pic_masks, NULL ); - mask_1->dim = dim; - if ( mask_1 == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - mask_1->data = malloc ( _mitkIpPicSize ( mask_1 ) ); - if ( mask_1->data == NULL ) - { - mitkIpPicFree ( mask_1 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - mask_2 = mitkIpPicCopyHeader ( mask_1, NULL ); - if ( mask_2 == NULL ) - { - mitkIpPicFree ( mask_1 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - mask_2->data = malloc ( _mitkIpPicSize ( mask_2 ) ); - if ( mask_2->data == NULL ) - { - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate images */ - - if ( border == mitkIpFuncBorderOld ) - { - pic_1 = mitkIpPicClone ( pic_old ); - memset ( pic_1->data, 0, _mitkIpPicElements ( pic_1 ) ); - } - else if ( border == mitkIpFuncBorderZero ) - { - pic_1 = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_1->data = calloc ( _mitkIpPicElements ( pic_1 ), pic_1->bpe/8 ); - } - else - { - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_1 == NULL ) - { - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_1->data == NULL ) - { - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - mitkIpPicFree ( pic_1 ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_inv = mitkIpFuncInv ( pic_old, NULL ); - if ( pic_inv == NULL ) - { - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - mitkIpPicFree ( pic_1 ); - } - - mitkIpPicFORALL_2 ( HITMISS, pic_old, pic_1, pic_inv ); - - mitkIpPicFree ( pic_inv ); - mitkIpPicFree ( mask_1 ); - mitkIpPicFree ( mask_2 ); - - return ( pic_1 ); -} diff --git a/Utilities/IpFunc/Inertia.c b/Utilities/IpFunc/Inertia.c deleted file mode 100644 index 86a0afc0fe9..00000000000 --- a/Utilities/IpFunc/Inertia.c +++ /dev/null @@ -1,299 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * mitkIpFuncInertia - *--------------------------------------------------------------------- - * DESCRIPTION - * function to calculate the moments of inertia of a region of - * interest - * - * FUNCTION DECLARATION - * mitkIpInt4_t mitkIpFuncInertia ( mitkIpPicDescriptor *pic_old, - * mitkIpFloat8_t **eigen_vekt, - * mitkIpFloat8_t **eigen_val ) - * - * PARAMETERS - * pic_old - pointer to an image structure which contains the ROI - * eigen_vekt - contains the axis of inertia (spaltenweise) - * eigen_val - eigenvalues of the tensor of inertia - * - * RETURN VALUES - * mitkIpFuncOK - no error occured - * mitkIpFuncERROR - an error occured - * - * UPDATES - * update of Manu's program to calculate axis of inertia. It's a - * function now, which can be used for images of different data - * types and for images up to 8 dimensions now - * - * AUTHOR & DATE - * Antje Schroeder 08.06.95 - * - *--------------------------------------------------------------------- - */ -/* include Files */ - -#include "mitkIpFuncP.h" - -#ifdef MESCHACH -#include - -/* definition of reflect-macro */ - -#define GRAV( type, pic, index, s, s_diag, dist ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t no; \ - mitkIpUInt4_t offset_refl; \ - mitkIpInt4_t n[_mitkIpPicNDIM]; \ - \ - for ( i = 0; i < pic_old->dim; i++ ) \ - n[i] = pic_old->n[i]; \ - \ - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) \ - n[i] = 1; \ - \ - offset_refl = 0; \ - for ( index[7] = 0; index[7] < n[7]; index[7]++ ) \ - \ - for ( index[6] = 0; index[6] < n[6]; index[6]++ ) \ - \ - for ( index[5] = 0; index[5] < n[5]; index[5]++ ) \ - \ - for ( index[4] = 0; index[4] < n[4]; index[4]++ ) \ - \ - for ( index[3] = 0; index[3] < n[3]; index[3]++ ) \ - \ - for ( index[2] = 0; index[2] < n[2]; index[2]++ ) \ - \ - for ( index[1] = 0; index[1] < n[1]; index[1]++ ) \ - \ - for ( index[0] = 0; index[0] < n[0]; index[0]++ ) \ - { \ - if ( (( type * )pic->data )[offset_refl] ) \ - { \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - dist[i] = index[i] - gravity[i]; \ - s_diag[i] = s_diag[i] + dist[i] * dist[i]; \ - } \ - \ - for ( i = 0; i < pic->dim; i++ ) \ - for ( j = 0; j < pic->dim; j++ ) \ - s[i*pic->dim+j] = s[i*pic->dim+j] - dist[i] * dist[j];\ - } \ - offset_refl++; \ - } \ - \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpInt4_t mitkIpFuncInertia ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t **eigen_vekt, - mitkIpFloat8_t **eigen_val ) -{ - - mitkIpUInt4_t index_vect[_mitkIpPicNDIM]; /* loopindex-vector */ - mitkIpInt4_t n[_mitkIpPicNDIM]; /* number of pixels in each */ - /* dimension */ - mitkIpUInt4_t i, j; /* loop index */ - mitkIpFloat8_t *gravity; /* center of gravity */ - mitkIpFloat8_t *help_vekt; /* pointer to eigen_vekt */ - mitkIpFloat8_t *help_val; /* pointer to eigen_val */ - MAT *ev; /* eigenvector */ - MAT *tt; /* tensor of inertia */ - VEC *ew; /* eigenvalue */ - mitkIpFloat8_t *s, *s_diag, *dist; /* used to calculate tt */ - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* initialisation of vectors */ - - for ( i = 0; i < pic_old->dim; i++ ) - n[i] = pic_old->n[i]; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - index_vect[i] = 0; - - /* memory allocation */ - - gravity = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - if ( gravity == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - dist = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - if ( dist == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - return ( mitkIpFuncERROR ); - } - - s_diag = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - if ( s_diag == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - free ( dist ); - return ( mitkIpFuncERROR ); - } - - s = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - if ( s == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - free ( dist ); - free ( s_diag ); - return ( mitkIpFuncERROR ); - } - - tt = m_get ( pic_old->dim, pic_old->dim ); - if ( tt == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - free ( dist ); - free ( s_diag ); - free ( s ); - return ( mitkIpFuncERROR ); - } - - ev = m_get ( pic_old->dim, pic_old->dim ); - if ( ev == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - free ( dist ); - free ( s_diag ); - free ( s ); - M_FREE ( tt ); - return ( mitkIpFuncERROR ); - } - - ew = v_get ( pic_old->dim-1 ); - if ( ew == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( gravity ); - free ( dist ); - free ( s_diag ); - free ( s ); - M_FREE ( tt ); - M_FREE ( ev ); - return ( mitkIpFuncERROR ); - } - - /* calculate center of gravity */ - - gravity = mitkIpFuncGrav ( pic_old ); - - /* Initialization of vectors */ - - for ( i = 0; i < pic_old->dim; i++ ) - { - s_diag[i] = 0.; - dist[i] = 0.; - for ( j = 0; j < pic_old->dim; j++ ) - s[i*pic_old->dim+j] = 0.; - } - - /* preparation for calculating the tensor of inertia */ - - mitkIpPicFORALL_4 ( GRAV, pic_old, index_vect, s, s_diag, dist ) - - /* calculate tensor of inertia */ - - for ( i = 0; i < pic_old->dim; i++ ) - { - tt->me[i][i] = 0.; - for ( j = 0; j < pic_old->dim; j++ ) - { - if ( i < j ) - tt->me[i][j] = s[i*pic_old->dim+j]; - else if ( j < i ) - tt->me[i][j] = s[j*pic_old->dim+i]; - if ( i != j ) - tt->me[i][i] = tt->me[i][i] + s_diag[j]; - } - } - - /* calculate eigenvectors and eigenvalues of the tensor of inertia */ - - ew = symmeig ( tt, ev, ew ); - - *eigen_vekt = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - help_vekt = *eigen_vekt; - *eigen_val = ( mitkIpFloat8_t * ) malloc ( pic_old->dim * sizeof ( mitkIpFloat8_t ) ); - help_val = *eigen_val; - - for ( i = 0; i < pic_old->dim; i++ ) - { - help_val[i] = ew->ve[i]; - for ( j = 0; j < pic_old->dim; j++ ) - help_vekt[i*pic_old->dim+j] = ev->me[i][j]; - } - - M_FREE ( tt ); - M_FREE ( ev ); - V_FREE ( ew ); - free ( s ); - free ( dist ); - free ( s_diag ); - free ( gravity ); - - return mitkIpFuncOK; -} -#endif diff --git a/Utilities/IpFunc/Inv.c b/Utilities/IpFunc/Inv.c deleted file mode 100644 index f498a9514c8..00000000000 --- a/Utilities/IpFunc/Inv.c +++ /dev/null @@ -1,133 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file -* this function inverts the greyvalues of an image -*/ - -/** @brief inverts the greyvalues of an image - * - * @param pic_old pointer to the image that should be inverted - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the inverted image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncInv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncInv\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of invert-macro */ - -#define INV( type, pic ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type help; \ - \ - /* calculate min. and max. */\ - \ - type max = ( ( type * ) pic->data ) [0]; \ - type min = ( ( type * ) pic->data ) [0]; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 1; i < no_elem; i++ ) \ - { \ - help = ( ( type * ) pic->data ) [i]; \ - max = ( help > max ) ? help : max; \ - min = ( help < min ) ? help : min; \ - } \ - \ - /* invert greyvalues */\ - \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - max + min - (( type * ) pic->data ) [i]; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncInv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL ( INV, pic_old ); - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/LN.c b/Utilities/IpFunc/LN.c deleted file mode 100644 index a5c73ce5efb..00000000000 --- a/Utilities/IpFunc/LN.c +++ /dev/null @@ -1,222 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function transforms the greyvalues by a ln-function - * (y = a ln (x+1)) - */ - -/** @brief transforms the greyvalues by a ln-function - * (y = a ln (x+1)) - * - * @param pic_old pointer to the original image - * - * @return pointer to the transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncLN ( mitkIpPicDescriptor *pic_old ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncLN\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define LN( type, pic, max_gv ) \ -{ \ - mitkIpUInt4_t i; /* loopindex */\ - mitkIpUInt4_t no_elem; /* number of pixels */\ - mitkIpFloat8_t a; /* factor to calculate the logaritm */\ - \ - a = max_gv / log ( max_gv + 1. ); \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - (( type * )pic_new->data )[i] = \ - ( type ) ( a * log ( 1. + (( type * )pic->data )[i] ) ); \ -} - -/* ------------------------------------------------------------------------ */ -/* -** function mitkIpFuncLN -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncLN ( mitkIpPicDescriptor *pic_old ) -{ - mitkIpFloat8_t min_gv, max_gv; /* max and min posiible greyvalues */ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t no_elem; /* loop index */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* check datatype of image */ - - no_elem = _mitkIpPicElements ( pic_old ); - if ( pic_old->type == mitkIpPicUInt ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->data = malloc ( _mitkIpPicSize ( pic_old ) ); - - if ( ( pic_new != NULL ) && ( pic_new->data != NULL ) ) - { - mitkIpPicFORALL_1 ( LN, pic_old, max_gv ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* mitkIpPicInt images are copied to mitkIpPicUInt iamges to avoid negative */ - /* greyvalues */ - - else if ( pic_old->type == mitkIpPicInt ) - { - pic_new = mitkIpPicNew (); - if ( pic_new != NULL ) - { - pic_new->type = mitkIpPicUInt; - pic_new->bpe = pic_old->bpe; - pic_new->dim = pic_old->dim; - for ( i = 0; i < pic_new->dim; i++ ) pic_new->n[i] = pic_old->n[i]; - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* transform integer image to unsigned integer image */ - - if ( pic_new->bpe == 8 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt1_t * )pic_new->data )[i] = - (( mitkIpInt1_t * )pic_old->data )[i] - min_gv; - } - - else if ( pic_new->bpe == 16 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt2_t * )pic_new->data )[i] = - (( mitkIpInt2_t * )pic_old->data )[i] - min_gv; - } - - else if ( pic_new->bpe == 32 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt4_t * )pic_new->data )[i] = - (( mitkIpInt4_t * )pic_old->data )[i] - min_gv; - } - - else - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - max_gv = max_gv - min_gv; - - mitkIpPicFORALL_1 ( LN, pic_new, max_gv ); - - /* transform unsigned integer image to an integer image */ - - pic_new->type = mitkIpPicInt; - - if ( pic_new->bpe == 8 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpInt1_t * )pic_new->data )[i] = - (( mitkIpUInt1_t * )pic_new->data )[i] + min_gv; - } - - else if ( pic_new->bpe == 16 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpInt2_t * )pic_new->data )[i] = - (( mitkIpUInt2_t * )pic_new->data )[i] + min_gv; - } - - else if ( pic_new->bpe == 32 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpInt4_t * )pic_new->data )[i] = - (( mitkIpUInt4_t * )pic_new->data )[i] + min_gv; - } - - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/Label.c b/Utilities/IpFunc/Label.c deleted file mode 100644 index 27e163fd5e6..00000000000 --- a/Utilities/IpFunc/Label.c +++ /dev/null @@ -1,363 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * This functions looks for areas in an image with the same greyvalue. - * Each of these areas gets it's own greyvalue. - */ - -/** This functions looks for areas in an image with the same greyvalue. - * Each of these areas gets it's own greyvalue. - * - * CAUTION! In case of many small regions to label, the routine may - * break down without exception handling, if the number of labels is - * running out. - * - * @param pic_old pointer to original image structure - * @param no_label number of different labels (return value) - * - * @return pointer to new image - * - * USES - * function _mitkIpFuncError - checks image data - * function _mitkIpFuncExtr - calculates extreme greyvalues - * function _mitkIpFuncHist - calculates greyvalue histogram - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncLabel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *no_lab ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncLabel\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define LABEL1( type, pic_old, pic_new, no_label, type_new ) \ -{ \ - mitkIpUInt4_t i, j; /* loop index */ \ - mitkIpUInt4_t offset; /* offset of actual pixel */ \ - mitkIpBool_t in_lab; /* currently in label flag */ \ - mitkIpUInt4_t end; \ - \ - offset = 0; \ - no_label = 0; \ - \ - end = _mitkIpPicElements ( pic_old ) / pic_old->n[0]; \ - for ( j = 0; j < end; j++ ) \ - for ( i = 0, in_lab = mitkIpFalse; i < pic_old->n[0]; i++ ) \ - { \ - /*if ( (( type * )pic_old->data )[offset] == max ) */ \ - if ( (( type * )pic_old->data )[offset] ) \ - { \ - if ( in_lab ) \ - (( type_new * )pic_new->data )[offset] = \ - (type_new) no_label; \ - else \ - { \ - in_lab = mitkIpTrue; \ - no_label++; \ - (( type_new * )pic_new->data )[offset] = \ - (type_new) no_label; \ - } \ - } \ - else in_lab = mitkIpFalse; \ - offset++; \ - } \ -} - -#define LABEL2( type, pic_new, a, a_new, a_sort, size ) \ -{ \ - mitkIpUInt4_t aa; /* actual anchestor */ \ - mitkIpUInt4_t al; /* actual label */ \ - mitkIpUInt4_t i, j, k, l; /* loop index */ \ - mitkIpUInt4_t end; \ - mitkIpInt4_t off; /* offset of actual pixel */ \ - mitkIpInt4_t dist; /* distnace between actual and */ \ - /* neighbour pixel */ \ - \ - for ( l = 1; l < pic_new->dim; l++ ) \ - { \ - dist = size[l]; \ - end = _mitkIpPicElements ( pic_new ) / size[l+1]; \ - for ( k = 0; k < end; k++ ) \ - for ( j = 1; j < pic_new->n[l]; j++ ) \ - { \ - off = j * size[l] + k * size[l+1]; \ - for ( i = 0; i < size[l]; i++ ) \ - { \ - /* calculate actual ancestors */ \ - \ - al = (( type * )pic_new->data ) [off]; \ - aa = (( type * )pic_new->data ) [off - dist]; \ - \ - off++; \ - \ - /* if this is a line label */ \ - \ - if ( al ) \ - { \ - if ( aa ) \ - { \ - /* test whether anchestor found */ \ - if ( a[al] == al ) \ - a[al] = a_new[a[aa]]; \ - else if ( a[al] != a[a[al]] ) \ - a[al] = a[a[al]]; \ - else if ( a[al] != a_new[a[aa]] ) \ - a_new[a[aa]] = a[al]; \ - } \ - } \ - } \ - } \ - } \ -} - -#define LABEL3( type, pic_new, a, a_sort ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_new ); \ - for ( i = 0; i < no_elem; i++ ) \ - (( type * )pic_new->data )[i] = \ - ( type ) a_sort[a[( mitkIpUInt4_t ) (( type * )pic_new->data )[i]]]; \ -} - - -/* ------------------------------------------------------------------- */ -/* -** mitkIpFuncLabel -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncLabel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *no_lab ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image structure */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t *a; /* pointer to list with all anchestors*/ - mitkIpUInt4_t *a_new; /* look up table for new labels */ - mitkIpUInt4_t *a_sort; /* pointer to list of sorted anchest. */ - mitkIpUInt4_t no_label; /* number of labels */ - mitkIpUInt4_t new_label; /* */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; - mitkIpFloat8_t min, max; /* extreme greyvalues in image */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate extreme greyvalues in image */ - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check whether image is binary */ - /* - mitkIpFuncHist ( pic_old, min, max, &hist, &size_hist ); - if ( hist == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - i = 0; - no_gv = 0; - while ( i <= ( mitkIpUInt4_t ) ( fabs ( min ) + max ) && no_gv < 3 ) - { - if ( hist [i] != 0 ) no_gv++; - i++; - } - - if ( no_gv != 2 ) - { - free ( hist ); - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - /* allocate memory for new image */ - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe / 8 ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* preparation of image */ - - mitkIpPicFORALL_3 ( LABEL1, pic_old, pic_new, no_label, mitkIpInt2_t ); - - if(no_label>SHRT_MAX) - { - mitkIpPicFree(pic_new); - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicUInt; - pic_new->bpe = 32; - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe / 8 ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - mitkIpPicFORALL_3 ( LABEL1, pic_old, pic_new, no_label, mitkIpUInt4_t ); - } - - /* allocation and initialisation of vectors */ - - a = malloc ( ( no_label + 1 ) * sizeof ( mitkIpUInt4_t ) ); - if ( a == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - a_new = malloc ( ( no_label + 1 ) * sizeof ( mitkIpUInt4_t ) ); - if ( a_new == NULL ) - { - free ( a ); - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - a_sort = malloc ( ( no_label + 1 ) * sizeof ( mitkIpUInt4_t ) ); - if ( a_sort == NULL ) - { - free ( a ); - free ( a_new ); - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i <= no_label; i++ ) - { - a[i] = i; - a_new[i] = i; - a_sort[i] = 0; - } - - size[0] = 1; - for ( i = 1; i <= pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - for ( i = pic_old->dim + 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[pic_old->dim]; - - /* change anchestor list */ - - mitkIpPicFORALL_4 ( LABEL2, pic_new, a, a_new, a_sort, size ); - - /* replace anchestors with new anchestors */ - - for ( i = 0; i <= no_label; i++ ) - { - a[i] = a_new[a[i]]; - } - for ( i = 0; i <= no_label; i++ ) - { - a[i] = _ipGetANew ( a_new, a[i] ); - } - - /* - ** replace image with new labels - */ - - /* hit used labels with 1 */ - - for ( i = 0; i < no_label; i++ ) a_sort[a[i]] = 1; - - /* write new ascending labels to a_sort */ - - for ( i = 0, new_label = 0; i <= no_label; i++ ) - { - if ( a_sort[i] ) - { - new_label++; - a_sort[i] = new_label; - } - } - - /* renumber pixels with new labels */ - - mitkIpPicFORALL_2 ( LABEL3, pic_new, a, a_sort ); - - /**no_lab = no_label;*/ - - *no_lab = new_label; - - if((new_label<=SHRT_MAX) && ( pic_new->bpe != 16 )) - { - mitkIpPicDescriptor * tmp; - tmp=mitkIpFuncConvert(pic_new, mitkIpPicInt, 16); - mitkIpPicFree(pic_new); - pic_new=tmp; - } - - /* free memory */ - - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - free ( a ); - free ( a_new ); - free ( a_sort ); - return ( pic_new ); - -} -#endif - diff --git a/Utilities/IpFunc/Laplace.c b/Utilities/IpFunc/Laplace.c deleted file mode 100644 index c1c0ff67a9c..00000000000 --- a/Utilities/IpFunc/Laplace.c +++ /dev/null @@ -1,150 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * This function performs a filtering with a 2D or 3D Laplace filtering - * mask - */ - -/** This function performs a filtering with a 2D or 3D Laplace filtering - * mask - * - * @param pic_old pointer to the image that should be convolved - * @param dim_mask dimension of filtering mask - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to minimal greyvalue - * - * @return pointer to the transformed image - * - * USES - * function mitkIpFuncConv: convolves image with mask - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncLaplace( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncLaplace\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -mitkIpPicDescriptor *mitkIpFuncLaplace( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - - mitkIpPicDescriptor *pic_new; /* convolved image */ - mitkIpPicDescriptor *pic_mask; /* laplace mask */ - mitkIpUInt4_t i; /* loop index */ - mitkIpInt2_t laplace2[] = /* 2D laplace-mask */ - { 0, -1, 0, -1, 4, -1, 0, -1, 0 }; - mitkIpInt2_t laplace3[] = /* 3D laplace-mask */ - { 0, 0, 0, 0, -1, 0, 0, 0, 0, - 0, -1, 0, -1, 6, -1, 0, -1, 0, - 0, 0, 0, 0, -1, 0, 0, 0, 0 }; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim < dim_mask || dim_mask < 2 || dim_mask > 3 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of pic_mask */ - - pic_mask = mitkIpPicNew (); - if ( pic_mask == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicInt; - pic_mask->bpe = 16; - pic_mask->dim = dim_mask; - for ( i = 0; i < dim_mask; i++ ) - pic_mask->n[i] = 3; - - if ( dim_mask == 3 ) - { - pic_mask->data = laplace3; - } - else if ( dim_mask == 2 ) - { - pic_mask->data = laplace2; - } - else - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* function to convolve image with mask */ - - pic_new = mitkIpFuncConv ( pic_old, pic_mask, border ); - - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/LevWind.c b/Utilities/IpFunc/LevWind.c deleted file mode 100644 index 07174c85345..00000000000 --- a/Utilities/IpFunc/LevWind.c +++ /dev/null @@ -1,137 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a level-window operation - */ - -/** @brief this function performs a level-window operation - * - * All greyvalues which are not included in the - * intervall [level-0.5*window, level+0.5*window] are set to - * the minimal (if greyvaluelevel-0.5*window), respectively. - * - * @param pic_old pointer to original image - * @param level greyvalue that forms center of the window - * @param window length of window - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the transformed image - * - * @par Uses - * @arg mitkIpFuncSelMM - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncLevWin ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t level, - mitkIpFloat8_t window, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncLevWin\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* ------------------------------------------------------------------------- */ -/* -** mitkIpFunclevWin -*/ -/* ------------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncLevWin ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t level, - mitkIpFloat8_t window, - mitkIpPicDescriptor *pic_return ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t gv_low; /* lower greyvalue of range */ - mitkIpFloat8_t gv_up; /* upper greyvalue of range */ - mitkIpFloat8_t max_gv, min_gv; /* max and min possible greyvalues */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max and min possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - /* calculate lower and upper greyvalue of range with level and window */ - - gv_low = level - 0.5 * window; - - if ( gv_low < min_gv ) - gv_low = min_gv; - else if ( gv_low > max_gv ) - gv_low = max_gv; - - gv_up = level + 0.5 * window; - - if ( gv_up < min_gv ) - gv_up = min_gv; - else if ( gv_up > max_gv ) - gv_up = max_gv; - - /* calculate new image in Function mitkIpFuncSelect */ - - pic_new = mitkIpFuncSelMM ( pic_old, gv_low, gv_up, pic_return ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Log.c b/Utilities/IpFunc/Log.c deleted file mode 100644 index 79429e9119f..00000000000 --- a/Utilities/IpFunc/Log.c +++ /dev/null @@ -1,213 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions transforms the greyvalues of an image with a lg-function - * (y = a lg (x+1)) - */ - -/** this functions transforms the greyvalues of an image with a lg-function - * (y = a lg (x+1)) - * @param pic_old pointer to original image - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncLog ( mitkIpPicDescriptor *pic_old ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncLog\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* definition of macros */ - -#define LOG( type, pic, max_gv ) \ -{ \ - mitkIpUInt4_t i; /* loopindex */\ - mitkIpUInt4_t no_elem; /* */\ - mitkIpFloat8_t a; /* factor to calculate the logaritm */\ - \ - a = ( max_gv ) / log10 ( max_gv + 1 ); \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - (( type * )pic_new->data )[i] = \ - ( type ) ( a * log10 ( 1. + (( type * )pic->data )[i] ) ); \ -} - -/* ------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncLog ( mitkIpPicDescriptor *pic_old ) -{ - mitkIpFloat8_t min_gv, max_gv; /* max and min posiible greyvalues */ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t no_elem; /* loop index */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* check datatype of image */ - - no_elem = _mitkIpPicElements ( pic_old ); - if ( pic_old->type == mitkIpPicUInt ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->data = malloc ( _mitkIpPicSize ( pic_old ) ); - - if ( ( pic_new != NULL ) && ( pic_new->data != NULL ) ) - { - mitkIpPicFORALL_1 ( LOG, pic_old, max_gv ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* copy integer image to usigned integer image to avoid negative greyvalues*/ - - else if ( pic_old->type == mitkIpPicInt ) - { - pic_new = mitkIpPicNew (); - if ( pic_new != NULL ) - { - pic_new->type = mitkIpPicUInt; - pic_new->bpe = pic_old->bpe; - pic_new->dim = pic_old->dim; - for ( i = 0; i < pic_new->dim; i++ ) pic_new->n[i] = pic_old->n[i]; - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* transform integer image to unsigned integer image */ - - if ( pic_new->bpe == 8 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt1_t * )pic_new->data )[i] = - (( mitkIpInt1_t * )pic_old->data )[i] - min_gv; - } - - else if ( pic_new->bpe == 16 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt2_t * )pic_new->data )[i] = - (( mitkIpInt2_t * )pic_old->data )[i] - min_gv; - } - - else if ( pic_new->bpe == 32 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpUInt4_t * )pic_new->data )[i] = - (( mitkIpInt4_t * )pic_old->data )[i] - min_gv; - } - - else - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - max_gv = max_gv - min_gv; - - mitkIpPicFORALL_1 ( LOG, pic_new, max_gv ); - - /* transform unsigned integer image to an integer image */ - - pic_new->type = mitkIpPicInt; - if ( pic_new->bpe == 8 ) - { - for ( i = 0; i < no_elem; i++ ); - (( mitkIpInt1_t * )pic_new->data )[i] = - (( mitkIpUInt1_t * )pic_new->data )[i] + min_gv; - } - - else if ( pic_new->bpe == 16 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpInt2_t * )pic_new->data )[i] = - (( mitkIpUInt2_t * )pic_new->data )[i] + min_gv; - } - - else if ( pic_new->bpe == 32 ) - { - for ( i = 0; i < no_elem; i++ ) - (( mitkIpInt4_t * )pic_new->data )[i] = - (( mitkIpUInt4_t * )pic_new->data )[i] + min_gv; - } - - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/MakePicName.c b/Utilities/IpFunc/MakePicName.c deleted file mode 100644 index ef91a62910b..00000000000 --- a/Utilities/IpFunc/MakePicName.c +++ /dev/null @@ -1,100 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function inserts an extension into a filename - */ - -/** @brief inserts an extension into a filename - * - * @warning not tested - * - * @param pic_name file name of input image - * @param extension extension which shoulb be inserted into the filename - - * @return name for the file for the output image - * - * AUTHOR & DATE - */ -char *mitkIpFuncMakePicName ( char *pic_name, char *extension ); - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -#include -#include -#include - -#define NAME_MAX 40 - - -/* ===================================================================*/ -/* */ -/* MakePicName */ -/* */ -/* ===================================================================*/ - - -char *mitkIpFuncMakePicName ( char *pic_name, char *extension ) -{ - - char *result_name; - int length, pos; - - if ( pic_name == NULL || extension == NULL ) - return NULL; - - length = strlen ( pic_name ) + strlen ( extension ) + 5; - - result_name = ( char * ) malloc ( length * sizeof ( char ) ); - if ( result_name == NULL ) return NULL; - - pos = strstr ( pic_name, ".pic" ) - pic_name; - if ( pos >= 0 ) - strncpy ( result_name, pic_name, pos ); - else - strcpy ( result_name, pic_name ); - - strcat ( result_name, extension ); - strcat ( result_name, ".pic" ); - - return ( result_name ); -} diff --git a/Utilities/IpFunc/Malloc.c b/Utilities/IpFunc/Malloc.c deleted file mode 100644 index fab1b3a4f8a..00000000000 --- a/Utilities/IpFunc/Malloc.c +++ /dev/null @@ -1,135 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function allocates the memory for a new image depending on the - * parameter pic_return. If pic_return is equal NULL, new memory is - * allocated otherwise it is reused. - */ - -/** this function allocates the memory for a new image depending on the - * parameter pic_return. If pic_return is equal NULL, new memory is - * allocated otherwise it is reused. - * - * @param pic_old pointer to original image - * @param pic_return pointer to the memory which should be reused - * @param over_write tells whether the memory could be reused - * @arg @c mitkIpTrue => memory could be reused - * @arg @c mitkIpFalse => new memory must be allocated - * - * @return pointer to the memory for transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *_mitkIpFuncMalloc ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return, - mitkIpBool_t over_write ); - -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* -** mitkIpFuncMalloc -*/ - -mitkIpPicDescriptor *_mitkIpFuncMalloc ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return, - mitkIpBool_t over_write ) -{ - mitkIpBool_t okay=mitkIpTrue; - mitkIpUInt4_t i; - - if ( pic_return == NULL || ( !over_write ) ) - { - pic_return = mitkIpPicCopyHeader ( pic_old, 0 ); - if ( pic_return == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_return->data = calloc ( _mitkIpPicElements ( pic_old ), pic_old->bpe/8 ); - if ( pic_return->data == NULL ) - { - mitkIpPicFree ( pic_return ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - if ( pic_old->type != pic_return->type ) okay = mitkIpFalse; - if ( pic_old->bpe != pic_return->bpe ) okay = mitkIpFalse; - if ( pic_old->dim != pic_return->dim ) okay = mitkIpFalse; - for ( i = 0; i < pic_old->dim; i++ ) - if ( pic_old->n[i] != pic_return->n[i] ) okay = mitkIpFalse; - } - - if ( !okay ) - { - mitkIpPicFree ( pic_return ); - pic_return = mitkIpPicCopyHeader ( pic_old, 0 ); - if ( pic_return == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_return->data = calloc ( _mitkIpPicElements ( pic_old ), pic_old->bpe/8 ); - if ( pic_return->data == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - return ( pic_return ); -} -#endif - diff --git a/Utilities/IpFunc/Mean.c b/Utilities/IpFunc/Mean.c deleted file mode 100644 index 9c17e356379..00000000000 --- a/Utilities/IpFunc/Mean.c +++ /dev/null @@ -1,106 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the mean greyvalue of all greyvalues - * in an image - */ - -/** this function calculates the mean greyvalue of all greyvalues - * in an image - * - * - * @param pic pointer to the image - * - * @return mean greyvalue - * - * AUTHOR & DATE - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncMean ( mitkIpPicDescriptor *pic ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMean\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of extreme value macro */ - -#define MEAN( type, pic, mean ) \ - { \ - mitkIpUInt4_t i, no_elem; \ - \ - mean = 0.; \ - no_elem = _mitkIpPicElements ( pic ); \ - \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - mean = ( ( type * ) pic->data ) [i] + mean; \ - } \ - mean = mean / _mitkIpPicElements ( pic ); \ - } - -/* ========================================================== */ -/* -*/ -/* ========================================================== */ - -mitkIpFloat8_t mitkIpFuncMean ( mitkIpPicDescriptor *pic ) -{ - - mitkIpFloat8_t mean = 0.0; - - /* check data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - mitkIpPicFORALL_1( MEAN, pic, mean ) - - return( mean ); -} -#endif - diff --git a/Utilities/IpFunc/MeanC.c b/Utilities/IpFunc/MeanC.c deleted file mode 100644 index 5c4928ca00d..00000000000 --- a/Utilities/IpFunc/MeanC.c +++ /dev/null @@ -1,202 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the mean of all greyvalues which are included - * by a circle - * - * @param pic_old pointer to riginal image - * @param center coordiantest of the center of the circle - * @param radius radius of the circle - * - * qreturn mean of all greyvalues included by the circle - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncMeanC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMeanC\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - - -#define MEAN( type, pic, beg, end, size, center, radius ) \ -{ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - mitkIpUInt4_t dist[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - for ( ind[7] = beg[7] ; ind[7] < end[7]; ind[7]++ ) \ - { \ - dist[7] = ( ind[7] - center[7] ) * ( ind[7] - center[7] ); \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6] ; ind[6] < end[6]; ind[6]++ ) \ - { \ - dist[6] = ( ind[6] - center[6] ) * ( ind[6] - center[6] ) + dist[7]; \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5] ; ind[5] < end[5]; ind[5]++ ) \ - { \ - dist[5] = ( ind[5] - center[5] ) * ( ind[5] - center[5] ) + dist[6]; \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4] ; ind[4] < end[4]; ind[4]++ ) \ - { \ - dist[4] = ( ind[4] - center[4] ) * ( ind[4] - center[4] ) + dist[5]; \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3] ; ind[3] < end[3]; ind[3]++ ) \ - { \ - dist[3] = ( ind[3] - center[3] ) * ( ind[3] - center[3] ) + dist[4]; \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2] ; ind[2] < end[2]; ind[2]++ ) \ - { \ - dist[2] = ( ind[2] - center[2] ) * ( ind[2] - center[2] ) + dist[3]; \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1] ; ind[1] < end[1]; ind[1]++ ) \ - { \ - dist[1] = ( ind[1] - center[1] ) * ( ind[1] - center[1] ) +dist[2];\ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1]+beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - dist[0] = ( ind[0] - center[0] ) * ( ind[0] - center[0] )+dist[1];\ - if ( ( mitkIpUInt4_t ) sqrt ( ( mitkIpFloat8_t ) dist[0] ) <= radius ) \ - { \ - mean = mean + (( type * )pic->data )[off[0]]; \ - count++; \ - } \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpFloat8_t mitkIpFuncMeanC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ) -{ - mitkIpInt4_t help; - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t mean; - mitkIpUInt4_t count; - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of window */ - mitkIpUInt4_t centr[_mitkIpPicNDIM]; /* end of window */ - mitkIpUInt4_t begin[_mitkIpPicNDIM]; /* beginning of window */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( radius <= 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - help = (mitkIpInt4_t *) center[i] - (mitkIpInt4_t *) radius; - if ( help < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - else begin[i] = help; - - help = center[i] + radius; - if ( (mitkIpUInt4_t) help > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - else end[i] = help + 1; - centr[i] = center[i]; - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - { - centr[i] = 0; - begin[i] = 0; - end[i] = 1; - } - - /* allocate image structure */ - - mean = 0; - count = 0; - - mitkIpPicFORALL_5 ( MEAN, pic_old, begin, end, size, centr, radius ); - - mean = mean / count; - - return ( mean ); -} - -#endif diff --git a/Utilities/IpFunc/MeanF.c b/Utilities/IpFunc/MeanF.c deleted file mode 100644 index cfd8e0497e1..00000000000 --- a/Utilities/IpFunc/MeanF.c +++ /dev/null @@ -1,153 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a smoothing by a mean-value filter - */ - -/** @brief performs a smoothing by a mean-value filter - * - * @param pic_old pointer to original image - * @param len_mask number of pixels for each dimension - * @param dim_mask number of dimensions of filter in mask - * @param border handling of the edge - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge pixels are set to zero - * - * @return pointer to the smoothed image - * - * @par Uses @arg mitkIpFuncConv() convolve image with mask - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncMeanF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* --------------------------------------------------------------------- */ -/* -*/ -/* --------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncMeanF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image structure */ - mitkIpPicDescriptor *pic_mask; /* pointer to mask */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t no_elem; - mitkIpFloat8_t help; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim < dim_mask || dim_mask < 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( len_mask % 2 != 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialize mask */ - - pic_mask = mitkIpPicNew(); - - if ( pic_mask == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicFloat; - pic_mask->bpe = 64; - pic_mask->dim = dim_mask; - - for ( i = 0; i < dim_mask; i++ ) pic_mask->n[i] = len_mask; - - pic_mask->data = malloc ( _mitkIpPicSize ( pic_mask ) ); - if ( pic_mask->data == NULL ) - { - mitkIpPicFree ( pic_mask->data ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - no_elem = _mitkIpPicElements ( pic_mask ); - help = 1. / ( mitkIpFloat8_t ) no_elem; - for ( i = 0; i < no_elem; i++ ) - (( mitkIpFloat8_t * ) pic_mask->data ) [i] = help; - - /* convolve image with filtering mask */ - - pic_new = mitkIpFuncConv ( pic_old, pic_mask, border ); - - mitkIpPicFree ( pic_mask ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} - -#endif diff --git a/Utilities/IpFunc/MeanR.c b/Utilities/IpFunc/MeanR.c deleted file mode 100644 index ef8710927fd..00000000000 --- a/Utilities/IpFunc/MeanR.c +++ /dev/null @@ -1,87 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * calculates the mean value of all greyvalues included by a rectangle - */ - -/** @brief calculates the mean value of all greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to original image - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return mean value in window - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncMeanR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)ipFUncMeanR\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -mitkIpFloat8_t mitkIpFuncMeanR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) -{ - mitkIpFloat8_t mean; /* mean value */ - mitkIpPicDescriptor *pic_help; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - mean = mitkIpFuncMean ( pic_help ); - - mitkIpPicFree ( pic_help ); - - return ( mean ); -} -#endif - diff --git a/Utilities/IpFunc/MeanROI.c b/Utilities/IpFunc/MeanROI.c deleted file mode 100644 index 0c99645e953..00000000000 --- a/Utilities/IpFunc/MeanROI.c +++ /dev/null @@ -1,246 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the mean of all pixels inside of a polygon - */ - -/** @brief calculates the mean of all pixels inside of a polygon - * - * The polygon is described by a sequence of points - * - * @param pic_old pointer to original image - * @param pol_x vector with the x-coordinates of the points which form - * form the roi - * @param pol_y vector with the y-coordinates of the points which form - * form the roi - * @param no_pts number of points used to describe ROI - * - * REMARKS - * this function could just be used for 2D images - * - * @return mean of all greyvalues in ROI - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncMeanROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) ; -#ifndef DOXYGEN_IGNORE - - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMeanROI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/*definition of macros */ - -#define MAX( x, y ) ( x > y ) ? x : y -#define MIN( x, y ) ( x < y ) ? x : y -#define ROI( type, pic, pic_help, sum, count ) \ -{ \ - mitkIpBool_t in; \ - mitkIpUInt4_t i, j; \ - mitkIpUInt4_t offset; \ - \ - for ( i = min_y; i <= max_y; i++ ) \ - { \ - in = mitkIpFalse; \ - offset = i * pic->n[0] + min_x; \ - for ( j = min_x; j <= max_x; j++ ) \ - { \ - if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( !in ) ) \ - in = mitkIpTrue; \ - else if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( in ) ) \ - { \ - in = mitkIpFalse; \ - sum = sum + (( type * )pic->data )[offset]; \ - count++; \ - } \ - \ - if ( in ) \ - { \ - sum = sum + (( type * )pic->data )[offset]; \ - count++; \ - } \ - \ - offset++; \ - } \ - } \ -} - -/* -** mitkIpFuncMeanROI -*/ - -mitkIpFloat8_t mitkIpFuncMeanROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) -{ - mitkIpFloat8_t mean; /* mean of greyvalues in ROI */ - mitkIpFloat8_t sum=0; /* sum of greyvalues in ROI */ - mitkIpFloat8_t *a, *b; /* Gerade y = ax+b */ - mitkIpPicDescriptor *pic_help; /* contains edge of ROI */ - mitkIpUInt4_t min_x, max_x; /* min, max x-coordinate of ROI */ - mitkIpUInt4_t min_y, max_y; /* min, max y-coordinate of ROI */ - mitkIpUInt4_t i; /* loop variable */ - mitkIpUInt4_t count=0; /* number of pixels in ROI */ - mitkIpFloat8_t diff; /* difference between two points */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim > 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate min. and max. coordiantes of ROI */ - - min_x = pol_x[0]; - min_y = pol_y[0]; - max_x = pol_x[0]; - max_y = pol_y[0]; - for ( i = 1; i < no_pts; i++ ) - { - min_x = MIN ( min_x, pol_x[i] ); - min_y = MIN ( min_y, pol_y[i] ); - max_x = MAX ( max_x, pol_x[i] ); - max_y = MAX ( max_y, pol_y[i] ); - } - - - /* check whether ROI is in image */ - - /* Expression is always false. - if ( min_x < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_x > pic_old->n[0] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Expression is always false. - if ( min_y < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_y > pic_old->n[1] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for a and b */ - - a = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - b = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - - /* Geraden zwischen zwei benachbarten Punkten berechnen */ - - for ( i = 0; i < no_pts-1; i++ ) - { - diff = ( mitkIpFloat8_t ) pol_x[i+1] - ( mitkIpFloat8_t ) pol_x[i]; - if ( diff ) - { - a[i] = ( ( mitkIpFloat8_t ) pol_y[i+1] - ( mitkIpFloat8_t ) pol_y[i] ) / diff; - b[i] = ( ( mitkIpFloat8_t ) pol_y[i] - a[i] * ( mitkIpFloat8_t )pol_x[i] ); - } - else - { - b[i] = 0.; - a[i] = 0.; - } - } - diff = ( mitkIpFloat8_t ) pol_x[no_pts-1] - ( mitkIpFloat8_t ) pol_x[0]; - if ( diff ) - { - a[no_pts-1] = ( ( mitkIpFloat8_t ) pol_y[no_pts-1] - ( mitkIpFloat8_t ) pol_y[0] ) / diff; - b[no_pts-1] = ( pol_y[no_pts-1] - a[no_pts-1] * pol_x[no_pts-1] ); - } - else - { - b[no_pts-1] = 0.; - a[no_pts-1] = 0.; - } - - /* draw polygon to image */ - - pic_help = _mitkIpFuncDrawPoly ( pic_old, pol_x, pol_y, no_pts, a, b ); - if ( ! pic_help ) - { - free ( a ); - free ( b ); - return ( mitkIpFuncERROR ); - } - - /* macro to calculate mean */ - - mitkIpPicFORALL_3 ( ROI, pic_old, pic_help, sum, count ); - - mean = sum / count; - - free ( a ); - free ( b ); - mitkIpPicFree ( pic_help ); - - return ( mean ); - -} -#endif diff --git a/Utilities/IpFunc/Median.c b/Utilities/IpFunc/Median.c deleted file mode 100644 index 58cc6f49e7e..00000000000 --- a/Utilities/IpFunc/Median.c +++ /dev/null @@ -1,132 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the median of the image data -*/ - -/** @brief calculates the median of the image data - * - * @param pic_old pointer to the image - * - * @return median of the image data - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncMedI ( mitkIpPicDescriptor *pic_old ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMedI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* ------------------------------------------------------------------- */ -/* -** function mitkIpFuncMedI: -*/ -/* ------------------------------------------------------------------- */ - -mitkIpFloat8_t mitkIpFuncMedI ( mitkIpPicDescriptor *pic_old ) -{ - - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpUInt4_t *hist; /* greylevel histogram */ - mitkIpUInt4_t size_hist; /* no. of elements in histogram */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t sum; /* sum of histogram elements */ - mitkIpUInt4_t limit; /* */ - mitkIpFloat4_t factor; - mitkIpFloat8_t median; /* median of image data */ - - /* check whether image data are ok */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) == mitkIpFuncERROR ) - { - return ( mitkIpFuncERROR ); - } - - /* calculate greylevel histogram */ - - mitkIpFuncHist ( pic_old, min_gv, max_gv, &hist, &size_hist ); - if ( hist == 0 ) - { - return ( mitkIpFuncERROR ); - } - - /* factor to calculate the greyvalue belonging to an histogram index */ - - if ( pic_old->type == mitkIpPicFloat ) - factor = 0.001; - else if ( pic_old->type == mitkIpPicInt || pic_old->type == mitkIpPicUInt ) - factor = 1.; - else - { - free ( hist ); - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* find median */ - - limit = _mitkIpPicElements ( pic_old ) / 2; - for ( i = 0, sum = 0; sum < limit; i++ ) - sum = sum + hist [i]; - - median = i * factor - fabs ( min_gv ); - - free ( hist ); - - return ( median ); -} -#endif - diff --git a/Utilities/IpFunc/Morph.c b/Utilities/IpFunc/Morph.c deleted file mode 100644 index 6bd8df9b588..00000000000 --- a/Utilities/IpFunc/Morph.c +++ /dev/null @@ -1,388 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a morphological operation - */ - -/** @brief performs a morphological operation. - * - * Depending on the parameter kind a erosion or dilation is performed. If the original - * image is an binary image each pixel is connected with the surrounding - * pixels which are non zero in the kernel by using logical operations - * ( and for erosion, or for dilation ). Greylevel images are transformed - * by taking the minimum (erosion) of the surrounding pixels or the - * maximum (dilation). - * - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param kind tells whether erosion or dilation is performed - * 0 (mitkIpERO) : erosion - * 1 (mitkIpDILA) : dilation - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to the transformed image - * - * @par Uses - * @arg _mitkIpFuncError() - check the image data - * @arg mitkIpFuncHist() - calculate the greylevel histogram - * @arg _mitkIpFuncCompressM() - compress filtering mask - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *_mitkIpFuncMorph ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMorph\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - -/* definition of macros and constants */ - -#define ERO_B && -#define DILA_B || -#define ERO_G < -#define DILA_G > - -#define INIT( type, pic_new ) \ -{ \ - mitkIpUInt4_t i; /* loop variable */ \ - mitkIpUInt4_t no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_new ); \ - for ( i = 0; i < no_elem; i++ ) \ - (( type * )pic_new->data )[i] = 1; \ -} - - -#define MORPH_B( type, pic_old, pic_new, m, beg, end, OP ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t offset; /* offset */ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - \ - /* transformation of image */ \ - \ - for ( i = 0; i < m->length; i++ ) \ - { \ - offset = m->off_vekt[i]; \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * )pic_new->data )[off[0]] = \ - (( type * )pic_new->data)[off[0]] OP \ - (( type * )pic_old->data)[off[0] + offset]; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -#define MORPH_G( type, pic_old, pic_new, m, beg, end, OP ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* offset vector */ \ - type help, help2; \ - \ - \ - /* transformation of image */ \ - \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = ind[7] * size[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = ind[6] * size[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = ind[5] * size[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = ind[4] * size[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = ind[3] * size[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = ind[2] * size[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = ind[1] * size[1] + off[2]; \ - off[0] = beg[0] + off[1]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - help = (( type* )pic_old->data)[off[0]]; \ - for ( i = 0; i < m->length; i++ ) \ - { \ - help2 = (( type * )pic_old->data)[m->off_vekt[i]+off[0]];\ - help = ( help OP help2 ) ? help : help2; \ - } \ - (( type * )pic_new->data)[off[0]] = help; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - \ -} - -/* ---------------------------------------------------------------------- */ -/* -** function _mitkIpFuncMorph -*/ -/* ---------------------------------------------------------------------- */ - -mitkIpPicDescriptor *_mitkIpFuncMorph ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpFuncMasc_t *m; /* compressed mask and belonging offsets*/ - mitkIpInt4_t beg[_mitkIpPicNDIM]; - mitkIpInt4_t end[_mitkIpPicNDIM]; - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpUInt4_t no_gv; /* number of different greyvalues */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t size_hist; /* number of elements in histogram */ - mitkIpUInt4_t *hist; /* pointer to greyvalue histogram */ - mitkIpFloat8_t min, max; /* extreme greyvalues in image */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mask->dim > pic_old->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < mask->dim; i++ ) - if ( mask->n[i] > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_new = NULL; - - /* initialisation of vectors */ - - size [0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - /* compress filtering mask */ - - m = _mitkIpFuncCompressM ( mask, pic_old, mitkIpFuncNoReflect, beg, end ); - if ( m == NULL ) - { - free ( hist ); - mitkIpPicFree ( pic_new ); - return ( mitkIpFuncERROR ); - } - - /* allocate and initialize pic_new */ - - if ( border == mitkIpFuncBorderOld ) - pic_new = mitkIpPicClone ( pic_old ); - else if ( border == mitkIpFuncBorderZero ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe / 8 ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( kind == mitkIpFuncEroF ) - { - mitkIpPicFORALL ( INIT, pic_new ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* check whether binary or greylevel image */ - - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - mitkIpFuncHist ( pic_old, min, max, &hist, &size_hist ); - if ( hist == NULL ) - { - mitkIpPicFree ( pic_new ); - return ( mitkIpFuncERROR ); - } - - i = 0; - no_gv = 0; - while ( i <= ( mitkIpUInt4_t ) ( fabs ( min ) + max ) && no_gv < 3 ) - { - if ( hist [i] != 0 ) no_gv++; - i++; - } - - - /* transform image (depending on kind and no_gv) */ - - if ( kind == mitkIpFuncEroF ) /* erosion */ - { - if ( no_gv == 2 ) /* binary image */ - { - mitkIpPicFORALL_5 ( MORPH_B, pic_old, pic_new, m, beg, end, ERO_B ); - } - else if ( no_gv > 2 ) /* greylevel image */ - { - mitkIpPicFORALL_5 ( MORPH_G, pic_old, pic_new, m, beg, end, ERO_G ); - } - else - { - free ( hist ); - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - /*_mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR );*/ - return ( pic_new ); - } - } - else if ( kind == mitkIpFuncDilaF ) /* dilation */ - { - if ( no_gv == 2 ) /* binary image */ - { - mitkIpPicFORALL_5 ( MORPH_B, pic_old, pic_new, m, beg, end, DILA_B ); - } - else if ( no_gv > 2 ) /* greylevel image */ - { - mitkIpPicFORALL_5 ( MORPH_G, pic_old, pic_new, m, beg, end, DILA_G ); - } - else - { - free ( hist ); - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - /*_mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR );*/ - return ( pic_new ); - } - } - else - { - mitkIpPicFree ( pic_new ); - free ( hist ); - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* free memory */ - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - free ( hist ); - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/MultC.c b/Utilities/IpFunc/MultC.c deleted file mode 100644 index cfffd817fe2..00000000000 --- a/Utilities/IpFunc/MultC.c +++ /dev/null @@ -1,264 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function multiplies two images - */ - -/** @brief multiplies two images - * - * @param pic_1 pointer to the first image - * @param value constant which is multiplied to image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @retrun pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncMultC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncMultI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* definition of macros */ - -#define MULTC( type_1, pic_1, pic_new, value ) \ -{ \ - mitkIpPicFORALL_3 ( MULTC2, pic_new, pic_1, type_1, value ); \ -} \ - - -#define MULTC2( type_n, pic_new, pic_1, type_1, value ) \ -{ \ - mitkIpUInt4_t i; /* loop index */\ - mitkIpUInt4_t no_elem; \ - \ - \ - /* multiply greyvalues of both images */\ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = ( type_n ) \ - ( ( mitkIpFloat8_t ) (( type_1 * ) pic_1->data ) [i] * \ - value ); \ - } \ -} - -#define MULTC3( type_n, pic_1, pic_new, value ) \ -{ \ - mitkIpUInt4_t i; /* loop index */\ - mitkIpFloat8_t help; /* greyvalue of actual pixel */\ - mitkIpUInt4_t no_elem; \ - \ - \ - /* multiply greyvalues of both images */\ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = ( mitkIpFloat8_t ) (( type_n * ) pic_1->data ) [i] * value; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help ) ? \ - ( (type_n) ( help ) ) : ( type_n ) min_gv ) : \ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncMultC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check value */ - - /* if ( value == 0. ) return ( mitkIpFuncERROR ); */ - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_old, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 * value; - smin = min1 * value; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_old->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - - /* macro to invert the picture (for all data types) */ - - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( MULTC, pic_old, pic_new, value ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( MULTC3, pic_old, pic_new, value ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/MultI.c b/Utilities/IpFunc/MultI.c deleted file mode 100644 index f939d2b243e..00000000000 --- a/Utilities/IpFunc/MultI.c +++ /dev/null @@ -1,279 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function multiplies two images - */ - -/** this function multiplies two images - * - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncMultI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define MULTI( type_1, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpPicFORALL_3 ( MULTI2, pic_new, pic_1, pic_2, type_1 ); \ -} \ - - -#define MULTI2( type_n, pic_new, pic_1, pic_2, type_1 ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = \ - (( type_1 * ) pic_1->data ) [i] * \ - (( type_1 * ) pic_2->data ) [i]; \ - } \ -} - -#define MULTI3( type_n, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_n help; \ - type_n help2; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - help2 = (( type_n * ) pic_2->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help * ( mitkIpFloat8_t ) help2 ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help * ( mitkIpFloat8_t ) help2 ) ? \ - ( (type_n)help * (type_n)help2 ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncMultI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t min2, max2; /* extreme greyvalues of 2. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - mitkIpFloat8_t min_max12; /* product of min1 and max2 */ - mitkIpFloat8_t min_max21; /* product of min2 and max1 */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check whether images have the same size */ - - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_1->type, pic_1->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mitkIpFuncExtr ( pic_2, &min2, &max2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 * max2; - smin = min1 * min2; - min_max12 = min1 * max2; - min_max21 = min2 * max1; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_1->type == mitkIpPicInt ) - { - if ( smax < max_gv && min_max12 < max_gv && min_max21 < max_gv && - smin > min_gv && min_max12 > min_gv && min_max21 > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicUInt ) - { - if ( smax < max_gv && min_max12 < max_gv && min_max21 < max_gv && - smin > min_gv && min_max12 > min_gv && min_max21 > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || min_max12 > max_gv || min_max21 > max_gv || - smin < min_gv || min_max12 < min_gv || min_max21 < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( MULTI, pic_1, pic_2, pic_new ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( MULTI3, pic_1, pic_2, pic_new ) - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Norm.c b/Utilities/IpFunc/Norm.c deleted file mode 100644 index e266e60fa50..00000000000 --- a/Utilities/IpFunc/Norm.c +++ /dev/null @@ -1,137 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function normalizes an image - */ - -/** @brief normalizes an image - * @param pic_old pointer to the image that should be inverted - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the normalized image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncNorm ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - - -/* definition of macro for normalisation */ - -#define NORM( type, pic, min, max, min_gv, max_gv ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - mitkIpFloat8_t a, b; \ - \ - a = ( mitkIpFloat8_t ) ( max_gv - min_gv ) / ( max - min ); \ - b = ( mitkIpFloat8_t ) ( max_gv ) - a * max; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - ( type ) ( a * (( type * ) pic->data ) [i] + b ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -** function picNorm: normalizes the greyvalues of the picture (pic_old) -** and returns the normalized picture (pic_new) -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncNorm ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpFloat8_t max, min; /* extreme greyvalues in the image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate extreme grevalues of the image */ - - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. or min possible greyvalue for datatype */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* test whether normalisation is necessary */ - - if ( ( max_gv == max ) && ( min_gv == min ) ) - return ( pic_old ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL_4( NORM, pic_old, min, max, min_gv, max_gv ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/NormXY.c b/Utilities/IpFunc/NormXY.c deleted file mode 100644 index 929dfa94407..00000000000 --- a/Utilities/IpFunc/NormXY.c +++ /dev/null @@ -1,164 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function normalizes an image to a specified range -*/ - -/** @brief normalizes an image to a specified range - * - * @param pic_old pointer to the image to normalize - * @param low lower border of range - * @param up upper border of range - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the noRmalized image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncNormXY ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t low, - mitkIpFloat8_t up, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -/* definition of macro for normalisation */ - -#define NORM( type, pic, min, max, min_gv, max_gv ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - mitkIpFloat8_t a, b; \ - \ - a = ( mitkIpFloat8_t ) ( max_gv - min_gv ) / ( max - min ); \ - b = ( mitkIpFloat8_t ) ( max_gv ) - a * max; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - ( type ) ( a * (( type * ) pic->data ) [i] + b ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -** function picNorm: normalizes the greyvalues of the picture (pic_old) -** and returns the normalized picture (pic_new) -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncNormXY ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t low, - mitkIpFloat8_t up, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpFloat8_t max, min; /* extreme greyvalues in the image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - - - /* check whether data are ok */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate extreme grevalues of the image */ - - if ( mitkIpFuncExtr ( pic_old, &min, &max ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* check data */ - - if ( max == min ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( low >= up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( low < min_gv || up > max_gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* test whether normalisation is necessary */ - - if ( ( up == max ) && ( low == min ) ) - return ( pic_old ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL_4( NORM, pic_old, min, max, low, up ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Not.c b/Utilities/IpFunc/Not.c deleted file mode 100644 index b2b4d2e3a1c..00000000000 --- a/Utilities/IpFunc/Not.c +++ /dev/null @@ -1,114 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs the logical not operation on an image - */ - -/** @brief performs the logical not operation on an image - * - * @param pic_old pointer to the image that should be inverted - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the inverted image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncNot ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -/* definition of invert-macro */ - -#define NOT( type, pic ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = ! ( (( type * ) pic->data ) [i] ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncNot ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL ( NOT, pic_old ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/OpCl.c b/Utilities/IpFunc/OpCl.c deleted file mode 100644 index 9c742d9ea2d..00000000000 --- a/Utilities/IpFunc/OpCl.c +++ /dev/null @@ -1,147 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions performs the morphological operations opening and - * closing. - */ - -/** @briefs performs the morphological operations opening and - * closing. - * - * Opening is an erosion followed by a dilation and a - * closing is a dilation followed by an erosion. - * - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param kind tells whether opening or closing is performed - * @arg @c 0 (mitkIpOPEN) : opening - * @arg @c 1 (mitkIpCLOSE) : closing - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to the transformed image - * - * USES - * function _mitkIpFuncError - checks the image data - * function _mitkIpFuncMorph - performs morphological operations - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *_mitkIpFuncOpCl ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* ---------------------------------------------------------------------- */ -/* -** function mitkIpFuncOpCl -*/ -/* ---------------------------------------------------------------------- */ - -mitkIpPicDescriptor *_mitkIpFuncOpCl ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new1; /* pointer to transformed image */ - mitkIpPicDescriptor *pic_new2; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( mask ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mask->dim > pic_old->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - for ( i = 0; i < mask->dim; i++ ) - if ( mask->n[i] > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncSIZE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* check whether opening or closing operation should be performed */ - - if ( kind == mitkIpFuncOpenF ) - { - pic_new1 = _mitkIpFuncMorph ( pic_old, mask, mitkIpFuncEroF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new1 = mitkIpFuncBorder ( pic_new1, mask, pic_new1 ); - pic_new2 = _mitkIpFuncMorph ( pic_new1, mask, mitkIpFuncDilaF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new2 = mitkIpFuncBorder ( pic_new2, mask, pic_new2 ); - } - else if ( kind == mitkIpFuncCloseF ) - { - pic_new1 = _mitkIpFuncMorph ( pic_old, mask, mitkIpFuncDilaF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new1 = mitkIpFuncBorder ( pic_new1, mask, pic_new1 ); - pic_new2 = _mitkIpFuncMorph ( pic_new1, mask, mitkIpFuncEroF, border ); - if ( border == mitkIpFuncBorderZero ) - pic_new2 = mitkIpFuncBorder ( pic_new2, mask, pic_new2 ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - mitkIpPicFree ( pic_new1 ); - - return ( pic_new2 ); -} -#endif diff --git a/Utilities/IpFunc/Open.c b/Utilities/IpFunc/Open.c deleted file mode 100644 index f0469bed677..00000000000 --- a/Utilities/IpFunc/Open.c +++ /dev/null @@ -1,91 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions performs the morphological opening operation - */ - -/** @briefs performs the morphological opening operation - * - * Opening is an erosion followed by a dilation - * @param pic_old pointer to the original image - * @param mask pointer to the kernel - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * - * @return pointer to transformed iamge - * - * AUTHOR & DATE - */ - -/* include /files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncOpen ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -mitkIpPicDescriptor *mitkIpFuncOpen ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; - - pic_new = _mitkIpFuncOpCl ( pic_old, pic_mask, mitkIpFuncOpenF, border ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} - -#endif diff --git a/Utilities/IpFunc/Or.c b/Utilities/IpFunc/Or.c deleted file mode 100644 index 9ae42777751..00000000000 --- a/Utilities/IpFunc/Or.c +++ /dev/null @@ -1,135 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function connects two images using the OR - */ - -/** @brief connects two images using the OR - * - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncOr ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ) ; -#ifndef DOXYGEN_IGNORE - -/* definition of invert-macro */ - -#define OR( type, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - (( type * ) pic_1->data ) [i] || \ - (( type * ) pic_2->data ) [i]; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncOr ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - - /* check whether images have the same size */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - /* allocate new iumage */ - - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to connect two images using AND */ - - mitkIpPicFORALL_2 ( OR, pic_1, pic_2, pic_new ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/Pot.c b/Utilities/IpFunc/Pot.c deleted file mode 100644 index 43c2aa33458..00000000000 --- a/Utilities/IpFunc/Pot.c +++ /dev/null @@ -1,227 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * This function takes all greyvalues of the image to the power of the exponent. - */ - -/** @brief takes all greyvalues of the image to the power of the exponent. - * - * @param pic_1 pointer to the first image - * @param exponent exponent - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c mitkIpFuncNoKeep : image data type could be changed - * @arg @c mitkIpFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncPot ( mitkIpPicDescriptor *pic_1, - mitkIpFloat8_t exponent, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define POT1( type_1, pic_1, exponent, pic_new ) \ -{ \ - mitkIpPicFORALL_3 ( POT2, pic_new, pic_1, exponent, type_1 ); \ -} \ - - -#define POT2( type_n, pic_new, pic_1, exponent, type_1 ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - mitkIpFloat8_t help; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = pow( ( mitkIpFloat8_t) (( type_1 * ) pic_1->data ) [i], \ - exponent ); \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > help ) ? \ - (( min_gv < help ) ? (type_n)help : ( type_n )min_gv ) : \ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncPot ( mitkIpPicDescriptor *pic_1, - mitkIpFloat8_t exponent, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_1->type, pic_1->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - smax = pow ( max1, exponent ); - smin = pow ( min1, exponent ); - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_1->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL_2 ( POT1, pic_1, exponent, pic_new ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Range.c b/Utilities/IpFunc/Range.c deleted file mode 100644 index a14b66ed907..00000000000 --- a/Utilities/IpFunc/Range.c +++ /dev/null @@ -1,107 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function checks whether the greyvalues of the image are in the - * spezified range - */ - -/** @brief checks whether the greyvalues of the image are in the - * spezified range - * - * @param pic_old pointer to original image - * @param gv_low lower end of range - * @param gv_up upper end of range - * - * @return mitkIpFuncOK when greyvalues are in specified range - * @return mitkIpFuncERROR when greyvalues are not in specigfied range or an error - * occured - * - * USES - * function mitkIpFuncExtr : to calculate extreme greyvalues of the image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpUInt4_t mitkIpFuncRange ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* ------------------------------------------------------------------------ */ -/* -** function mitkIpFuncRange -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpUInt4_t mitkIpFuncRange ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up ) -{ - mitkIpFloat8_t min, max; /* extreme greyvalues */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( gv_low > gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate max. and min. possible greyvalues */ - - if ( mitkIpFuncExtr ( pic_old, &min, &max) == mitkIpFuncERROR ) return ( mitkIpFuncERROR ); - - if ( min > gv_low || max < gv_up ) return ( mitkIpFuncOK ); - else return ( mitkIpFuncERROR ); - -} -#endif - diff --git a/Utilities/IpFunc/Rank.c b/Utilities/IpFunc/Rank.c deleted file mode 100644 index 5ac4cb530a3..00000000000 --- a/Utilities/IpFunc/Rank.c +++ /dev/null @@ -1,323 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a filtering of the image. The new greyvalue of - * the image is calculated by taking the greyvalue belonging to the - * specified range after having sorted the greyvalues included by the mask - */ - -/** @brief performs a filtering of the image. The new greyvalue of - * the image is calculated by taking the greyvalue belonging to the - * specified range after having sorted the greyvalues included by the mask - * - * @param pic_old pointer to original image - * @param rank rank (number of pixel which is taken after having sorted - * the pixels under the mask) - * rank = 0 : Median - * @param mask_dim dimension of mask - * @param mask_size number of pixel in each dimension of the mask - * @param border tells how the edge is handled - * @arg @c mitkIpFuncBorderOld : greyvalue of pic_old is kept - * @arg @c mitkIpFuncBorderZero : greyvalue of edge pixels is set to zero - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncRank ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t rank, - mitkIpUInt4_t mask_dim, - mitkIpUInt4_t mask_size, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - -/* definition of macros */ - -#define INDEX0( typ, pic ) ( mitkIpUInt4_t ) ( factor * (( typ * ) pic->data ) \ - [off_vekt[i] + off[0]] + help ) -#define INDEX2( typ, pic ) ( mitkIpUInt4_t ) ( factor * (( typ * ) pic->data ) \ - [off_vekt[i] + off[0]] + help ) -#define INDEX3( typ, pic ) ( mitkIpUInt4_t ) ( factor * (( typ * ) pic->data ) \ - [off[0] - off_vekt[i]] + help ) -#define RANK( typ, pic, begin, no_elem, size, rank ) \ -{ \ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* size of each dimension */ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t *hist; /* greyvalue histogram */ \ - mitkIpUInt4_t sum; /* used to calculate rank */ \ - mitkIpUInt4_t end; /* number of elements that change */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t beg; /* beginning of the loops */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - mitkIpFloat8_t min_gv, max_gv; /* min./max. possible greyvalues */ \ - mitkIpFloat8_t help, factor; \ - mitkIpUInt4_t hist_size; \ - \ - /* initialize vectors */ \ - \ - beg = ( mitkIpUInt4_t ) begin; \ - for ( i = 0; i < _mitkIpPicNDIM; i++ ) off[i] = 0; \ - for ( i = 0; i < pic->dim; i++ ) n[i] = pic->n[i] - beg; \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - { \ - n[i] = 1 + beg; \ - size[i] = 0; \ - } \ - \ - /* calculate max. and min. possible greyvalues */ \ - \ - if ( mitkIpFuncExtr( pic, &min_gv, &max_gv ) == mitkIpFuncERROR ) \ - { \ - free ( off_vekt ); \ - mitkIpPicFree ( pic_new ); \ - return ( mitkIpFuncERROR ); \ - } \ - \ - /* allocate memory for histogram and calculate variables which are needed for */ \ - /* allocation */ \ - \ - end = no_elem / mask_size; \ - factor = ( pic->type == mitkIpPicFloat ) ? 1000. : 1.; \ - help = fabs ( min_gv ); \ - hist_size = ( mitkIpUInt4_t ) ( factor * ( fabs ( max_gv ) + help ) ); \ - help = help * factor; \ -/*hist = calloc ( hist_size+1, sizeof ( mitkIpUInt4_t ) ); \ - if ( hist == NULL ) \ - { \ - free ( off_vekt ); \ - mitkIpPicFree ( pic_new ); \ - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); \ - return ( mitkIpFuncERROR ); \ - } \ - */ \ - /* transform pixels */ \ - \ - for ( ind[7] = beg ; ind[7] < n[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg ; ind[6] < n[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg ; ind[5] < n[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg ; ind[4] < n[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg ; ind[3] < n[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg ; ind[2] < n[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg ; ind[1] < n[1]; ind[1]++ ) \ - { \ - /* calculate histogram with pixels under mask */ \ - /* (complete histogram for new rows) */ \ - \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + beg; \ - /*memset ( hist, 0, hist_size );*/ \ - hist = calloc ( hist_size+1, sizeof ( mitkIpUInt4_t ) ); \ - for ( i = 0; i < no_elem; i++ ) hist[INDEX0 ( typ, pic )]++; \ - for ( i = 0, sum = 0; sum < rank; i++ ) sum = sum + hist[i]; \ - (( typ * ) pic_new->data )[off[0]] = ( typ ) \ - ( ( ( mitkIpFloat8_t ) i - help ) / factor ); \ - for ( ind[0] = beg+1; ind[0] < n[0]; ind[0]++ ) \ - { \ - /* change histogram for each column */ \ - \ - for ( i = 0; i < end; i++ ) hist[INDEX2 ( typ, pic )]--; \ - off[0]++; \ - for ( i = 0; i < end; i++ ) hist[INDEX3 ( typ, pic )]++; \ - for ( i = 0, sum = 0; sum < rank; i++ ) sum = sum + hist[i]; \ - (( typ * ) pic_new->data )[off[0]] = ( typ ) \ - ( ( ( mitkIpFloat8_t ) i - help -1.) / factor );\ - } \ - free ( hist );\ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -/*free ( hist ); */ \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -** function mitkIpFuncRank -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncRank ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t rank, - mitkIpUInt4_t mask_dim, - mitkIpUInt4_t mask_size, - mitkIpFuncFlagI_t border ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpInt4_t i; /* loop index */ - mitkIpInt4_t offset; /* offset of image */ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ - mitkIpInt4_t *off_vekt; /* pointer to offset vector */ - mitkIpInt4_t begin; /* 0.5 * mask_size */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpInt4_t n[_mitkIpPicNDIM]; /* size of each dimension */ - mitkIpUInt4_t no_elem; /* number of elements in mask */ - mitkIpUInt4_t len; /* length of offset vector */ - - /* calculate number of elements in mask */ - - no_elem = mask_size; - for ( i = 1; i < mask_dim; i++ ) - no_elem = no_elem * mask_size; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mask_dim < 1 || mask_dim > pic_old->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( rank > no_elem ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( mask_size % 2 != 1 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncSIZE_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - len = 0; - begin = mask_size / 2; - - for ( i = 0; i < mask_dim; i++ ) - n[i] = begin + 1; - for ( i = mask_dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1 - begin; - - /* allocate image structure */ - - if ( border == mitkIpFuncBorderOld ) - pic_new = mitkIpPicClone ( pic_old ); - else if ( border == mitkIpFuncBorderZero ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate offset vector */ - - off_vekt = malloc ( no_elem * sizeof ( mitkIpUInt4_t ) ); - if ( off_vekt == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate offset vector */ - - for ( ind[0] = -begin; ind[0] < n[0]; ind[0]++ ) - for ( ind[7] = -begin; ind[7] < n[7]; ind[7]++ ) - for ( ind[6] = -begin; ind[6] < n[6]; ind[6]++ ) - for ( ind[5] = -begin; ind[5] < n[5]; ind[5]++ ) - for ( ind[4] = -begin; ind[4] < n[4]; ind[4]++ ) - for ( ind[3] = -begin; ind[3] < n[3]; ind[3]++ ) - for ( ind[2] = -begin; ind[2] < n[2]; ind[2]++ ) - for ( ind[1] = -begin; ind[1] < n[1]; ind[1]++ ) - { - offset = 0; - for ( i = 0; i < pic_old->dim; i++ ) - offset = offset + ind[i] * size[i]; - off_vekt[len] = offset; - len++; - } - if ( rank == 0 ) rank = no_elem / 2 + 1; - mitkIpPicFORALL_4 ( RANK, pic_old, begin, no_elem, size, rank ); - - free ( off_vekt ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/Refl.c b/Utilities/IpFunc/Refl.c deleted file mode 100644 index 1fc3d895607..00000000000 --- a/Utilities/IpFunc/Refl.c +++ /dev/null @@ -1,202 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function reflects an image along one axis - */ - -/** @brief reflects an image along one axis - * - * @param pic_old pointer to the image that should be inverted - * @param axis reflection axis: 1 => x-axis - * 2 => y-axis - * 3 => z-axis - * 4 => t-axis - * - * @return pointer to the reflected image - * - * AUTHOR & DATE - */ -/* include Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncRefl ( mitkIpPicDescriptor *pic_old, int axis ); - -#ifndef DOXYGEN_IGNORE - -/* definition of reflect-macro */ - -#define ForLoop( type, pic, pic_new, index, offset_orig, offset_func ) \ -{ \ - mitkIpUInt4_t i; \ - mitkIpUInt4_t offset_refl; \ - mitkIpInt4_t n[_mitkIpPicNDIM]; \ - \ - for ( i = 0; i < pic_old->dim; i++ ) \ - n[i] = pic_old->n[i]; \ - \ - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) \ - n[i] = 1; \ - \ - offset_refl = 0; \ - for ( index[7] = 0; index[7] < n[7]; index[7]++ ) \ - \ - for ( index[6] = 0; index[6] < n[6]; index[6]++ ) \ - \ - for ( index[5] = 0; index[5] < n[5]; index[5]++ ) \ - \ - for ( index[4] = 0; index[4] < n[4]; index[4]++ ) \ - \ - for ( index[3] = 0; index[3] < n[3]; index[3]++ ) \ - \ - for ( index[2] = 0; index[2] < n[2]; index[2]++ ) \ - \ - for ( index[1] = 0; index[1] < n[1]; index[1]++ ) \ - \ - for ( index[0] = 0; index[0] < n[0]; index[0]++ ) \ - { \ - offset_func; \ - (( type * ) pic_new->data ) [offset_refl] = \ - (( type * ) pic->data ) [offset_orig]; \ - offset_refl++; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -** function picRefl : reflects a picture (pic_old) along one axis -** (axis) -** axis: 1 => x-axis -** 2 => y-axis -** 3 => z-axis -** 4 => t-axis -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncRefl ( mitkIpPicDescriptor *pic_old, int axis ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpUInt4_t index_vect[_mitkIpPicNDIM]; /* loop index vector */ - mitkIpUInt4_t length_vect[_mitkIpPicNDIM]; - mitkIpUInt4_t axis_vect[_mitkIpPicNDIM]; - mitkIpInt4_t n[_mitkIpPicNDIM]; /* number of pixels in each */ - /* dimension */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t offset_orig; - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( axis < 1 || axis > pic_old->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - for ( i = 0; i < pic_old->dim; i++ ) - n[i] = pic_old->n[i]; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - index_vect[i] = 0; - axis_vect[i] = 0; - } - - /* change index for x and y axis */ - - if ( axis == 1 ) - axis = 2; - else if ( axis == 2 ) - axis = 1; - axis_vect[axis - 1] = n[axis - 1] - 1; - - length_vect[0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - { - length_vect[i] = n[i-1] * length_vect[i-1]; - } - - /* create a new picture, copy the header, allocate memory */ - - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to reflect image (for all image data types) */ - mitkIpPicFORALL_4 ( ForLoop, pic_old, pic_new, index_vect, offset_orig, - offset_orig = 0; - for ( i = 0; i < pic_old->dim; i++ ) - { - offset_orig = offset_orig + length_vect [i] * - (( axis_vect [i] == 0 ) ? - index_vect [i] : - ( axis_vect [i] - index_vect[i] )); - } - ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/RegGrow.c b/Utilities/IpFunc/RegGrow.c deleted file mode 100644 index 7fb62631aff..00000000000 --- a/Utilities/IpFunc/RegGrow.c +++ /dev/null @@ -1,593 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a region growing by mean and standard deviation. - */ - -/** @brief performs a region growing by mean and standard deviation. - * - * The growing criteria is, that the new pixels greyvalue must be in the - * standard deviation of the seed region. - * After calculating the mean and standard deviation of the seed region, all - * pixels of this region are investigated whether they belong to a region - * or not. All accepted pixels are marked with a region_label. In the next - * step the neigbours of all accepted pixels are investigated whether they - * belong to the region or to the border or to none of them. At the end all - * pixels which belong to the boder (which contains the first pixel of the - * outside region) are marked. - * - * @param pic_old pointer to original image - * @param dim_seed dimension of seed region - * @param beg_seed array with start pixels of seed_region - * @param end_seed array with end pixels of seed_region - * @param border_label greyvalue for border pixels - * @param region_label greyvalue for pixels in region - * @param std_fact factor ( to multiply standard deviation with ) - * @param kind tells wether region or border should be shown - * 0 : border of region is shown - * 1 : region is shown - * - * @return pointer to new image - * - * USES - * function _mitkIpFuncError - check image data - * - * AUTHOR & DATE - * UPDATES - * - * $Log$ - * Revision 1.2 2000/05/24 15:29:43 tobiask - * Changed the installation paths of the package. - * - * Revision 1.4 2000/05/04 12:52:10 ivo - * inserted BSD style license - * - * Revision 1.3 2000/03/06 17:02:44 ivo - * ipFunc now with doxygen documentation. - * - * Revision 1.2 2000/02/18 14:58:06 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 2000/02/18 15:22:50 ivo - * in macro REGGROW line if(diffdata) [off[0]]; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - mean = sum / ( mitkIpFloat8_t ) size_seed; \ - \ - \ - /* standard deviation */ \ - \ - saq = 0.; \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - diff = ( mitkIpFloat8_t ) (( type * ) pic_old->data )[off[0]] - \ - mean; \ - saq = saq + diff * diff; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - std_dev = sqrt ( saq / ( mitkIpFloat8_t ) ( size_seed - 1 ) ); \ - std_win = std_dev * std_fact; \ - printf ( "mean: %lf std_win: %lf \n", mean, std_win);\ -} - -#define ACPT( type, pic_old, pic_new, acpt, acpt_len, region_label, std_win ) \ -{ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset */ \ - mitkIpFloat8_t diff; /* difference between pixel and mean */ \ - \ - /* find pixels in seed region which are accepted */ \ - \ - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - diff = fabs ( ( mitkIpFloat8_t ) \ - (( type * )pic_old->data )[off[0]] - mean ); \ - \ - /* pixel accepted */ \ - \ - if ( diff <= std_win ) \ - { \ - acpt[acpt_len] = off[0]; \ - acpt_len++; \ - (( type * ) pic_new->data )[off[0]] = \ - ( type ) region_label; \ - } \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -#define REGGROW( type, pic_old, pic_new, acpt, acpt_len, \ - border, border_len, std_win ) \ -{ \ - mitkIpUInt4_t i, j; /* loop variables */ \ - mitkIpInt4_t k; /* loop variable */ \ - mitkIpInt4_t rest; /* */ \ - mitkIpInt4_t z2; /* */ \ - mitkIpInt4_t z[_mitkIpPicNDIM]; /* */ \ - mitkIpBool_t found; /* found flag */ \ - mitkIpBool_t out; /* offset out of image flag */ \ - mitkIpFloat8_t diff; /* difference between pixel and mean */ \ - mitkIpUInt4_t offset; /* offset of pixel in image */ \ - \ - while ( acpt_len > 0 ) \ - { \ - for ( i = 0; i < acpt_len; i++ ) \ - { \ - rest = ( mitkIpInt4_t ) acpt[i]; \ - for ( k = pic_old->dim-1; k >= 0; k-- ) \ - { \ - z[k] = rest / ( mitkIpInt4_t )size[k]; \ - rest = rest % ( mitkIpInt4_t )size[k]; \ - } \ - \ - for ( j = 0; j < no_neigh; j++ ) \ - { \ - rest = off_vekt[j]; \ - out = mitkIpFalse; \ - for ( k = pic_old->dim-1; k >= 0; k-- ) \ - { \ - z2 = rest / ( mitkIpInt4_t )size[k] + z[k]; \ - rest = rest % ( mitkIpInt4_t )size[k]; \ - if ( z2 >= ( mitkIpInt4_t ) pic_old->n[k] || z2 < 0 ) out = mitkIpTrue; \ - } \ - \ - offset = ( mitkIpUInt4_t )( ( mitkIpInt4_t ) acpt[i] + off_vekt[j] ); \ - if ( ( !out ) && \ - (( type * )pic_new->data )[offset] != ( type ) region_label ) \ - { \ - diff = fabs ( ( mitkIpFloat8_t ) \ - (( type * )pic_old->data )[offset] - mean ); \ - if ( diff <= std_win ) \ - { \ - (( type * )pic_new->data )[offset] = ( type ) region_label;\ - next[next_len] = offset; \ - next_len++; \ - } \ - else \ - { \ - found = mitkIpFalse; \ - k = 0; \ - while ( ( !found ) && k < border_len ) \ - { \ - if ( border[k] == offset ) found = mitkIpTrue; \ - k++; \ - } \ - if ( !found ) \ - { \ - border[border_len] = offset; \ - border_len++; \ - } \ - } \ - } \ - } \ - } \ - acpt_len = next_len; \ - next_len = 0; \ - help = acpt; \ - acpt = next; \ - next = help; \ - } \ - if ( kind == 0 ) \ - { \ - mitkIpPicFree ( pic_new ); \ - pic_new = mitkIpPicClone ( pic_old ); \ - for ( i = 0; i < border_len; i++ ) \ - (( type * )pic_new->data )[border[i]] = border_label; \ - } \ -} -/* -------------------------------------------------------------------------- */ -/* -** mitkIpFuncRegGrow -*/ -/* -------------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncRegGrow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_seed, - mitkIpUInt4_t *beg_seed, - mitkIpUInt4_t *end_seed, - mitkIpUInt4_t border_label, - mitkIpUInt4_t region_label, - mitkIpFloat8_t std_fact, - mitkIpUInt4_t kind ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ - mitkIpInt4_t beg[_mitkIpPicNDIM]; /* beginning and end of seed region */ - mitkIpInt4_t end[_mitkIpPicNDIM]; /* for each dimension */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpInt4_t off[_mitkIpPicNDIM]; /* used to calculate offsets */ - mitkIpInt4_t offset_v; /* offset */ - mitkIpInt4_t *off_vekt; /* offsets of all neighbour pixels */ - mitkIpUInt4_t no_neigh; /* number of neighbour pixels */ - - /* parameters of seed region */ - - mitkIpFloat8_t mean; /* mean of greyvalues in seed region */ - /*mitkIpFloat8_t std_dev; */ /* standard deviation */ - mitkIpFloat8_t std_win; /* value for growing criteria */ - /*mitkIpFloat8_t sum; */ /* sum of greyvalues in seed region */ - /*mitkIpFloat8_t diff; */ /* difference between greyvalue, mean */ - /*mitkIpFloat8_t saq; */ /* sum of deviation squares */ - mitkIpUInt4_t size_seed; /* number of pixels in seed region */ - - /* variables for region growing */ - - mitkIpUInt4_t acpt_len; /* number of accepted pixels */ - mitkIpUInt4_t next_len; /* number of acc. pixels for next step */ - mitkIpUInt4_t border_len; /* number of border pixels */ - mitkIpUInt4_t *acpt; /* offsets of all accepted pixels */ - mitkIpUInt4_t *next; /* offsets of acc. pixels for next step*/ - mitkIpUInt4_t *help; /* */ - mitkIpUInt4_t *border; /* offsets of all border pixels */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check parameters */ - - if ( dim_seed > pic_old->dim ) return ( mitkIpFuncERROR ); - for ( i = 0; i < dim_seed; i++ ) - { - if ( end_seed[i] <= beg_seed[i] || end_seed[i] > pic_old->n[i] || - beg_seed[i] < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* allocate vectors */ - - no_neigh = ( mitkIpUInt4_t ) pow ( 3., pic_old->dim ); - - off_vekt = malloc ( no_neigh * sizeof ( mitkIpInt4_t ) ); - if ( off_vekt == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - acpt = malloc ( _mitkIpPicElements ( pic_old ) * sizeof ( mitkIpUInt4_t ) ); - if ( acpt == NULL ) - { - free ( off_vekt ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - next = malloc ( _mitkIpPicElements ( pic_old ) * sizeof ( mitkIpUInt4_t ) ); - if ( next == NULL ) - { - free ( off_vekt ); - free ( acpt ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* - help = malloc ( _mitkIpPicElements ( pic_old ) * sizeof ( mitkIpUInt4_t ) ); - if ( help == NULL ) - { - free ( off_vekt ); - free ( acpt ); - free ( next ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - border = malloc ( _mitkIpPicElements ( pic_old ) * sizeof ( mitkIpUInt4_t ) ); - if ( border == NULL ) - { - free ( off_vekt ); - free ( acpt ); - free ( next ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate pic_new and initialize it to zero */ - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - free ( off_vekt ); - free ( acpt ); - free ( next ); - free ( border ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_new->data = calloc ( _mitkIpPicElements (pic_new), pic_new->bpe / 8 ); - if ( pic_new->data == NULL ) - { - free ( off_vekt ); - free ( acpt ); - free ( next ); - free ( border ); - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialize variables and vectors */ - - size[0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - size[i] = 0; - - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - beg[i] = ( i < pic_old->n[i] ) ? -1 : 0 ; - end[i] = ( i < pic_old->n[i] ) ? 2 : 1 ; - } - - acpt_len = 0; - next_len = 0; - border_len = 0; - - /* calculate offset vector */ - - offset_v = 0; - for ( ind[7] = beg[7]; ind[7] < end[7]; ind[7]++ ) - { - off[7] = size[7] * ind[7]; - for ( ind[6] = beg[6]; ind[6] < end[6]; ind[6]++ ) - { - off[6] = size[6] * ind[6] + off[7]; - for ( ind[5] = beg[5]; ind[5] < end[5]; ind[5]++ ) - { - off[5] = size[5] * ind[5] + off[6]; - for ( ind[4] = beg[4]; ind[4] < end[4]; ind[4]++ ) - { - off[4] = size[4] * ind[4] + off[5]; - for ( ind[3] = beg[3]; ind[3] < end[3]; ind[3]++ ) - { - off[3] = size[3] * ind[3] + off[4]; - for ( ind[2] = beg[2]; ind[2] < end[2]; ind[2]++ ) - { - off[2] = size[2] * ind[2] + off[3]; - for ( ind[1] = beg[1]; ind[1] < end[1]; ind[1]++ ) - { - off[1] = size[1] * ind[1] + off[2]; - off[0] = off[1] + beg[0]; - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) - { - off_vekt[offset_v] = off[0]; - off[0]++; - offset_v++; - } - } - } - } - } - } - } - } - - /* calculate parameters of seed region */ - - size_seed = 1; - - for ( i = 0; i < dim_seed; i++ ) - { - beg[i] = beg_seed[i]; - end[i] = end_seed[i]; - size_seed = size_seed * ( end[i] - beg[i] ); - } - - for ( i = dim_seed; i < _mitkIpPicNDIM; i++ ) - { - beg[i] = 0; - end[i] = 1; - } - - mitkIpPicFORALL_6 ( STAT, pic_old, pic_new, mean, std_win, size_seed, beg, end ); - - /* find accepted pixels in seed region */ - - mitkIpPicFORALL_5 ( ACPT, pic_old, pic_new, acpt, acpt_len, region_label, std_win ); - - /* region growing */ - - mitkIpPicFORALL_6 ( REGGROW, pic_old, pic_new, acpt, acpt_len, - border, border_len, std_win ); - - /* free memory */ - - free ( off_vekt ); - free ( acpt ); - free ( next ); - /* free ( help );*/ - free ( border ); - - /* Copy Tags */ - - strncpy( pic_new->info->version, pic_old->info->version, _mitkIpPicTAGLEN ); - pic_new->info->tags_head = _mitkIpPicCloneTags( pic_old->info->tags_head ); - pic_new->info->write_protect = pic_old->info->write_protect; - - return ( pic_new ); - -} - -#endif - diff --git a/Utilities/IpFunc/Roberts.c b/Utilities/IpFunc/Roberts.c deleted file mode 100644 index b952142c151..00000000000 --- a/Utilities/IpFunc/Roberts.c +++ /dev/null @@ -1,256 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs an edge detection by the Roberts gradient - */ - -/** @brief performs an edge detection by the Roberts gradient - * - * This gradient uses a 2x2 or 2x2x2 mask and calculates the maximum - * of the difference of all diagonal elements - * - * @param pic_old pointer to original image - * @param dim_mask dimension of mask (2 or 3) - * @param border tells how the edge is handled - * @arg @c mitkIpFuncBorderOld : keep greyvalues - * @arg @c mitkIpFuncBorderZero : set greyvalues to zero - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncRoberts ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define ROBERTS( type, pic, msize, n, off, size ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t end; /* */ \ - mitkIpUInt4_t off_imag; /* offset of pixels */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - type help, help2; /* used to calculate new greyvalue */ \ - \ - end = msize / 2; \ - msize = msize - 1; \ - for ( ind[7] = 0; ind[7] < n[7]; ind[7]++ ) \ - for ( ind[6] = 0; ind[6] < n[6]; ind[6]++ ) \ - for ( ind[5] = 0; ind[5] < n[5]; ind[5]++ ) \ - for ( ind[4] = 0; ind[4] < n[4]; ind[4]++ ) \ - for ( ind[3] = 0; ind[3] < n[3]; ind[3]++ ) \ - for ( ind[2] = 0; ind[2] < n[2]; ind[2]++ ) \ - for ( ind[1] = 0; ind[1] < n[1]; ind[1]++ ) \ - for ( ind[0] = 0; ind[0] < n[0]; ind[0]++ ) \ - { \ - /* offset of actual pixel */ \ - \ - off_imag = 0; \ - for ( i = 0; i < pic->dim; i++ ) \ - off_imag = off_imag + ind[i] * size[i]; \ - \ - /* find out maximum of all diagonal differences */ \ - \ - help = 0; \ - for ( i = 0; i < end; i++ ) \ - { \ - help2 = ( type ) fabs ( ( mitkIpFloat8_t ) ( \ - ((type *)pic->data)[off_imag+off[i]] - \ - ((type *)pic->data)[off_imag+off[msize-i]])); \ - help = ( help > help2 ) ? help : help2; \ - } \ - (( type * )pic_new->data )[off_imag] = help; \ - } \ - \ -} \ - -/* --------------------------------------------------------------------- */ -/* -** function mitkIpFuncRoberts -*/ -/* --------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncRoberts ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to new image structure */ - mitkIpInt4_t *off_vekt; /* offsets for the image pixels that*/ - /* are needed for the operation */ - mitkIpInt4_t offset; /* used to calculate off_vekt */ - mitkIpUInt4_t off_mask; /* offset of mask elements */ - mitkIpUInt4_t mask_size; /* number of elements in mask */ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* size of each dimension */ - mitkIpUInt4_t i; /* loop index */ - - /* check data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( ( pic_old->dim < dim_mask ) || ( dim_mask < 1 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - for ( i = 0; i < dim_mask; i++ ) - n[i] = 2; - - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - size[0] = 1; - ind[0] = 0; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - { - ind[i] = 0; - size[i] = size[i-1] * pic_old->n[i-1]; - } - - /* calculate offset vector */ - - mask_size = ( mitkIpUInt4_t ) pow ( 2., ( mitkIpFloat8_t ) dim_mask ); - off_vekt = calloc ( mask_size, sizeof( mitkIpInt4_t ) ); - off_mask = 0; - if ( off_vekt == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - switch ( dim_mask ) - { - case 8: - for ( ind[7] = 0; ind[7] < n[7]; ind[7]++ ) - case 7: - for ( ind[6] = 0; ind[6] < n[6]; ind[6]++ ) - case 6: - for ( ind[5] = 0; ind[5] < n[5]; ind[5]++ ) - case 5: - for ( ind[4] = 0; ind[4] < n[4]; ind[4]++ ) - case 4: - for ( ind[3] = 0; ind[3] < n[3]; ind[3]++ ) - case 3: - for ( ind[2] = 0; ind[2] < n[2]; ind[2]++ ) - case 2: - for ( ind[1] = 0; ind[1] < n[1]; ind[1]++ ) - case 1: - for ( ind[0] = 0; ind[0] < n[0]; ind[0]++ ) - { - offset = 0; - for ( i = 0; i < dim_mask; i++ ) - offset = offset + ind[i] * size[i]; - off_vekt[off_mask] = offset; - off_mask++; - } - } - - /* allocate new image */ - - if ( border == mitkIpFuncBorderOld ) - pic_new = mitkIpPicClone ( pic_old ); - else if ( border == mitkIpFuncBorderZero ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - } - else - { - free ( off_vekt ); - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - free ( off_vekt ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new->data == NULL ) - { - free ( off_vekt ); - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro */ - - for ( i = 0; i < pic_old->dim; i++ ) - n[i] = pic_old->n[i] - 1; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - mitkIpPicFORALL_4 ( ROBERTS, pic_old, mask_size, n, off_vekt, size ); - - free ( off_vekt ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} - -#endif - diff --git a/Utilities/IpFunc/Rotate.c b/Utilities/IpFunc/Rotate.c deleted file mode 100644 index 469947f9d1b..00000000000 --- a/Utilities/IpFunc/Rotate.c +++ /dev/null @@ -1,298 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * Rotates image by a given angle - */ - -/** @brief Rotates image by a given angle. - * - * The angle has to be a multiple of 90 degrees. - * - * @param pic pointer to picture - * @param pic_old pointer to picture old, which is not used in this version - * @param grad angle array for every axes - * @param order order of the axes - * parameter example: grad: 90 270 90 - * order: 3 1 2 - * means: first step: the third axis is rotated with 90 degrees - * second step: the first axis is rotated with 90 degrees - * third step: the second axis is rotated with 270 degrees - * - * @return image - * - * @author Judith Dilo @date 5.5.1990 - * @author Ulrike Guennel @date 18.3.1994 - * - * - * This a total rewritten version of 'ipRot' written by Judith Dilo - * 7.6.1990 by J.D. (small improvements) - * 18.3.1994 by U.G. (new pic format) - * $Log$ - * Revision 1.3 2003/08/21 08:20:06 tobiask - * Removed warnings. - * - * Revision 1.2 2000/05/24 15:29:43 tobiask - * Changed the installation paths of the package. - * - * Revision 1.4 2000/05/04 12:52:11 ivo - * inserted BSD style license - * - * Revision 1.3 2000/03/06 17:02:45 ivo - * ipFunc now with doxygen documentation. - * - * Revision 1.2 2000/02/18 14:58:06 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 1998/07/16 12:04:49 antje - * initial import - * - * Revision 1.1 1995/03/07 16:42:15 uli - * Initial revision - */ - -/* -** ipFunc includefiles -*/ -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncRotate( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *grad, int *order ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncRotate\tGerman Cancer Research Center (DKFZ) $Revision$ "__DATE__ }; -#endif - - -/* -** private macros -*/ -#define COEFF_DEF( x,i ) (( (x) > (0)) ? ((x) - *p_index[i]) : (*p_index[i]) ) - - -/* -** the action starts here -*/ -mitkIpPicDescriptor *mitkIpFuncRotate( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *grad, int *order ) - -{ - mitkIpPicDescriptor *pic_return; - mitkIpUInt4_t *p_index[_mitkIpPicNDIM]; - mitkIpUInt4_t index[_mitkIpPicNDIM]; - mitkIpUInt4_t coeff_sum[_mitkIpPicNDIM]; - mitkIpUInt1_t coefficient[_mitkIpPicNDIM]; - mitkIpUInt4_t r_size[_mitkIpPicNDIM]; - mitkIpUInt4_t r_offset,i; - int order_alloc = 0; - - /* - ** - */ - if( !pic ) return( NULL ); - if( pic->dim < 2 || pic->dim > _mitkIpPicNDIM ) return( NULL ); - - /* take over image header structure and allocate memory */ - mitkIpPicFree( pic_old ); - pic_return = mitkIpPicCopyHeader( pic, NULL ); - if( !pic_return ) return( NULL ); - pic_return->data = malloc( _mitkIpPicSize(pic_return) ); - if( !pic_return->data ) - { - mitkIpPicFree( pic_return ); - return( NULL ); - } - - - /* - ** init pic_return->n, pointer to index and calculated_coeff - ** init coefficient matrix, r_size - */ - for( i = 0; i< _mitkIpPicNDIM; i++ ) - { - pic_return->n[i] = pic->n[i]; - p_index[i] = &index[i]; - coeff_sum[i] = 0; - coefficient[i] = 0; - r_size[i] = 0; - } - - /* - ** init the order array if NULL - */ - if( !order ) - { - order = (int *) malloc( pic->dim * sizeof( int ) ); - if( !order ) - { - mitkIpPicFree( pic_return ); - return( NULL ); - } - order_alloc = 1; - for( i=0; i<_mitkIpPicNDIM; i++ ) - order[i] = i+1; - } - else - { - /* - ** test if order correct - */ - int tt[_mitkIpPicNDIM]; - for( i=0; i<_mitkIpPicNDIM; i++ ) tt[i] = 0; - for( i=0; i< pic->dim; i++ ) - { - if( order[i] > 0 && order[i]<= (mitkIpInt4_t) pic->dim ) - tt[ order[i]-1 ]++; - else - i = _mitkIpPicNDIM + 1; - } - if( i == pic->dim ) - { - for( i=0; i< pic->dim; i++ ) - { - if( tt[i] != 1 ) - i = _mitkIpPicNDIM + 1; - } - } - if( i > _mitkIpPicNDIM ) - { - mitkIpPicFree( pic_return ); - return( NULL ); - } - } - - /* - ** fill of the coefficient array and change the p_index array - */ - for( i = 0; idim; i++ ) - { - int d1,d2; - mitkIpUInt4_t *tmp; - - d1 = order [i]-1; - d2 = (d1+1 >= (mitkIpInt4_t) pic->dim ) ? ( 0 ) : ( d1+1 ); - - switch( grad[d1] ) - { - case 0: - break; - case 90: - tmp = p_index[d2]; - p_index[d2] = p_index[d1]; - p_index[d1] = tmp; - - coefficient[ p_index[d2] - index ] = - (coefficient[ p_index[d2] - index ] == 1 ) ? 0 : 1; - break; - case 180: - coefficient[ p_index[d1] - index ] = - (coefficient[ p_index[d1] - index ] == 1 ) ? 0 : 1; - coefficient[ p_index[d2] - index ] = - (coefficient[ p_index[d2] - index ] == 1 ) ? 0 : 1; - break; - case 270: - tmp = p_index[d2]; - p_index[d2] = p_index[d1]; - p_index[d1] = tmp; - - coefficient[ p_index[d1] - index ] = - (coefficient[ p_index[d1] - index ] == 1 ) ? 0 : 1; - break; - default: - { - if( order_alloc == 1 ) - free( (void *) order ); - mitkIpPicFree( pic_return ); - return( NULL ); - break; - } - } - } - - - /* - ** calculate coefficient, and pic_return->n[i] - */ - for( i=0; idim; i++ ) - { - coeff_sum[ i ] = (pic->n[p_index[i] - index]-1) - * coefficient[ p_index[i] - index]; - pic_return->n[i] = pic->n[p_index[i] - index]; - } - - /* - ** calc multiplier for coefficients - */ - r_size[0] = 1; - for( i=1; idim; i++ ) - { - r_size[i] = r_size[i-1] * pic_return->n[i-1]; - } - - - /* - ** Makro for all for-loops and switches for all dimensions (1-8) - ** FOR ALL: dimensions, indizes, data types - */ - mitkIpPicFORALL_4( mitkIpFuncFORALL, pic, pic_return, index, r_offset, - for( r_offset = COEFF_DEF( coeff_sum[0],0) , i=1; idim; i++ ) - r_offset += COEFF_DEF( coeff_sum[i],i ) * r_size[i]; - ) - - /* - ** free allocated memory - */ - if( order_alloc == 1 ) - free( (void *) order ); - - /* Copy Tags */ - - strncpy( pic_return->info->version, pic->info->version, _mitkIpPicTAGLEN ); - pic_return->info->tags_head = _mitkIpPicCloneTags( pic->info->tags_head ); - pic_return->info->write_protect = pic->info->write_protect; - - return( pic_return ); -} -#endif diff --git a/Utilities/IpFunc/SDev.c b/Utilities/IpFunc/SDev.c deleted file mode 100644 index 2ed9ce8d3ff..00000000000 --- a/Utilities/IpFunc/SDev.c +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the standard deviation of all greyvalues - * in an image - */ - -/** this function calculates the standard deviation of all greyvalues - * in an image - * - * @param pic pointer to the image - * - * @return standard deviation - * - * USES - * function mitkIpFuncVar: to calculate the variance of an image - * - * AUTHOR - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - - mitkIpFloat8_t mitkIpFuncSDev ( mitkIpPicDescriptor *pic ); - -#ifndef DOXYGEN_IGNORE - -mitkIpFloat8_t mitkIpFuncSDev ( mitkIpPicDescriptor *pic ) -{ - - mitkIpFloat8_t s_der; /* standard deviation */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - s_der = sqrt ( mitkIpFuncVar ( pic ) ); - - return( s_der ); -} -#endif - diff --git a/Utilities/IpFunc/SDevC.c b/Utilities/IpFunc/SDevC.c deleted file mode 100644 index df9982879b3..00000000000 --- a/Utilities/IpFunc/SDevC.c +++ /dev/null @@ -1,99 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the standrad deviation of all grey- - * values included by a circle. This circle is described by - * its center and radius - */ - -/** this function calculates the standrad deviation of all grey- - * values included by a circle. This circle is described by - * its center and radius - * - * @param pic_old pointer to image structure - * @param center pointer to an array with the coordinates of - * the center of the circle - * @param radius radius of the circle - * - * @return standard deviation of all pixels included by a - * circle - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncSDevC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - - -/* -** mitkIpFuncSDevC -*/ -mitkIpFloat8_t mitkIpFuncSDevC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ) -{ - mitkIpFloat8_t s_dev; - mitkIpFloat8_t var; - - var = mitkIpFuncVarC ( pic_old, center, radius ); - - if ( var < 0 ) return ( mitkIpFuncERROR ); - - s_dev = sqrt ( var ); - - return ( s_dev ); -} -#endif diff --git a/Utilities/IpFunc/SDevR.c b/Utilities/IpFunc/SDevR.c deleted file mode 100644 index 9ec28db3698..00000000000 --- a/Utilities/IpFunc/SDevR.c +++ /dev/null @@ -1,91 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the standard deviation of all greyvalues included by a rectangle - */ - -/** calculates the standard deviation of all greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to original image - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return standard deviation in window - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncSDevR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -mitkIpFloat8_t mitkIpFuncSDevR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) -{ - mitkIpFloat8_t sder; /* standard deviation */ - - mitkIpPicDescriptor *pic_help; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - sder = mitkIpFuncSDev ( pic_help ); - - mitkIpPicFree ( pic_help ); - - return ( sder ); -} - -#endif - diff --git a/Utilities/IpFunc/SDevROI.c b/Utilities/IpFunc/SDevROI.c deleted file mode 100644 index fd9e337278e..00000000000 --- a/Utilities/IpFunc/SDevROI.c +++ /dev/null @@ -1,105 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the standard deviation of all pixels - * inside of a polygon - */ - -/** @brief calculates the standard deviation of all pixels - * inside of a polygon - * - * The polygon is described by a sequence of points - * - * @param pic_old pointer to original image - * @param pol_x vector with the x-coordinates of the points which form - * form the roi - * @param pol_y vector with the y-coordinates of the points which form - * form the roi - * @param no_pts number of points used to describe ROI - * - * REMARKS - * this function could just be used for 2D images - * - * @return standard deviation of all greyvalues in ROI - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncSDevROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncSDevROI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - - -/* -** mitkIpFuncSDevROI -*/ - -mitkIpFloat8_t mitkIpFuncSDevROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) -{ - mitkIpFloat8_t var; /* variance of greyvalues in ROI */ - mitkIpFloat8_t s_dev; /* standard dev.of greyvalues in ROI*/ - - var = mitkIpFuncVarROI ( pic_old, pol_x, pol_y, no_pts ); - - s_dev = sqrt ( var ); - - return ( s_dev ); - -} - -#endif - diff --git a/Utilities/IpFunc/ScBl.c b/Utilities/IpFunc/ScBl.c deleted file mode 100644 index 067270fae31..00000000000 --- a/Utilities/IpFunc/ScBl.c +++ /dev/null @@ -1,392 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* -* internal only. used by Scale.c -*/ - -/*@file - * this function scales the first image to the size of the second image - * using bilinear interpolation - */ - -/* @brief scales the first image to the size of the second image - * using bilinear interpolation - * - * @param pic_old pointer to the image that should be scaled - * @param pic_new pointer to the scaled image ( contains the information - * for the scaling in th header ) - * !!! All Header Information necessary when calling function !!! - * - * @return pointer to the scaled image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *_mitkIpFuncScBL( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ) ; - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SCBL4ALL( type, pic_old, pic_new, size, scale, n, shift, step, RND ) \ -{ \ - mitkIpFloat8_t factor[_mitkIpPicNDIM]; /* */\ - mitkIpFloat8_t help1[_mitkIpPicNDIM]; /* */\ - size_t help2[_mitkIpPicNDIM]; /* */\ - size_t offset[_mitkIpPicNDIM]; /* offset vector */\ - mitkIpFloat8_t weights[_mitkIpPicNDIM*2];/* */\ - size_t i; /* loop index */\ - size_t off_new; /* offset of scaled image */\ - size_t off_weights; /* offset of orig. image */\ - size_t ind_o[_mitkIpPicNDIM]; /* loop index (outer loops) */\ - size_t ind_i[_mitkIpPicNDIM]; /* loop index (inner loops) */\ - size_t n_i[_mitkIpPicNDIM]; /* loop index (inner loops) */\ - size_t pic_elements; /* number of elements of pic_old */ \ - type help; \ - /* initialize vectors */\ - \ - for ( i = 0; i < _mitkIpPicNDIM; i++ ) \ - { \ - ind_o[i] = 0; \ - ind_i[i] = 0; \ - factor[i] = 1.; \ - weights[i] = 1.; \ - weights[15-i] = 1.; \ - help2[i] = 0; \ - } \ - \ - for ( i = 0; i < pic_new->dim; i++ ) \ - n_i[i] = 2; \ - \ - for ( i = pic_new->dim; i < _mitkIpPicNDIM; i++ ) \ - n_i[i] = 1; \ - \ - pic_elements = _mitkIpPicElements(pic_old)*step; \ - off_new = 0; \ - switch ( pic_new->dim ) \ - { \ - default: printf ( " only 8 dimensions supported \n" ); \ - case 8: \ - for ( ind_o[7] = 0; ind_o[7] < n[7]; ind_o[7]++ ) \ - { \ - help1[7] = ( mitkIpFloat8_t ) ind_o[7] * scale[7]; \ - weights[7] = 1. - (help1 [7] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[7] )); \ - weights[15] = 1. - weights[7]; \ - help2[7] = ( size_t ) help1[7] * size[7]; \ - case 7: \ - for ( ind_o[6] = 0; ind_o[6] < n[6]; ind_o[6]++ ) \ - { \ - help1[6] = ( mitkIpFloat8_t ) ind_o[6] * scale[6]; \ - weights[6] = 1. - (help1 [6] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[6] )); \ - weights[14] = 1. - weights[6]; \ - help2[6] = ( size_t ) help1[6] * size[6]; \ - case 6: \ - for ( ind_o[5] = 0; ind_o[5] < n[5]; ind_o[5]++ ) \ - { \ - help1[5] = ( mitkIpFloat8_t ) ind_o[5] * scale[5]; \ - weights[5] = 1. - (help1 [5] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[5] )); \ - weights[13] = 1. - weights[5]; \ - help2[5] = ( size_t ) help1[5] * size[5]; \ - case 5: \ - for ( ind_o[4] = 0; ind_o[4] < n[4]; ind_o[4]++ ) \ - { \ - help1[4] = ( mitkIpFloat8_t ) ind_o[4] * scale[4]; \ - weights[4] = 1. - (help1 [4] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[4] )); \ - weights[12] = 1. - weights[4]; \ - help2[4] = ( size_t ) help1[4] * size[4]; \ - case 4: \ - for ( ind_o[3] = 0; ind_o[3] < n[3]; ind_o[3]++ ) \ - { \ - help1[3] = ( mitkIpFloat8_t ) ind_o[3] * scale[3]; \ - weights[3] = 1. - (help1 [3] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[3] )); \ - weights[11] = 1. - weights[3]; \ - help2[3] = ( size_t ) help1[3] * size[3]; \ - case 3: \ - for ( ind_o[2] = 0; ind_o[2] < n[2]; ind_o[2]++ ) \ - { \ - help1[2] = ( mitkIpFloat8_t ) ind_o[2] * scale[2]; \ - weights[2] = 1. - (help1 [2] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[2] )); \ - weights[10] = 1. - weights[2]; \ - help2[2] = ( size_t ) help1[2] * size[2]; \ - case 2: \ - for ( ind_o[1] = 0; ind_o[1] < n[1]; ind_o[1]++ ) \ - { \ - help1[1] = ( mitkIpFloat8_t ) ind_o[1] * scale[1]; \ - weights[1] = 1. - (help1 [1] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[1] )); \ - weights[9] = 1. - weights[1]; \ - help2[1] = ( size_t ) help1[1] * size[1]; \ - case 1: \ - for ( ind_o[0] = 0; ind_o[0] < n[0]; ind_o[0]++ ) \ - { \ - help1[0] = ( mitkIpFloat8_t ) ind_o[0] * scale[0]; \ - weights[0] = 1. - (help1 [0] - ( mitkIpFloat8_t ) \ - (( size_t ) help1[0] )); \ - weights[8] = 1. - weights[0]; \ - help2[0] = ( size_t ) help1[0] * size[0]; \ - \ - help = ( type ) 0; \ - \ - for ( ind_i[7] = 0; ind_i[7] < n_i[7]; ind_i[7]++)\ - { \ - factor[7] = weights[ind_i[7]*_mitkIpPicNDIM+7]; \ - offset[7] = ( size_t )help2[7] + \ - ind_i[7] * size[7]; \ - \ - for ( ind_i[6] = 0; ind_i[6] < n_i[6]; \ - ind_i[6]++ ) \ - { \ - factor[6] = weights[ind_i[6]*_mitkIpPicNDIM+6] * \ - factor[7]; \ - offset[6] = ( size_t )help2[6] + \ - ind_i[6] * size[6] + offset[7]; \ - \ - for ( ind_i[5] = 0; ind_i[5] < n_i[5]; \ - ind_i[5]++ ) \ - { \ - factor[5] = weights[ind_i[5]*_mitkIpPicNDIM+5] *\ - factor[6]; \ - offset[5] = ( size_t )help2[5] + \ - ind_i[5] * size[5] + offset[6]; \ - \ - for ( ind_i[4] = 0; ind_i[4] < n_i[4]; \ - ind_i[4]++ ) \ - { \ - factor[4] = weights[ind_i[4]*_mitkIpPicNDIM+4]*\ - factor[5]; \ - offset[4] = ( size_t )help2[4] + \ - ind_i[4] * size[4] + offset[5];\ - \ - for ( ind_i[3] = 0; ind_i[3] < n_i[3]; \ - ind_i[3]++ ) \ - { \ - factor[3] = weights[ind_i[3]*_mitkIpPicNDIM+3]*\ - factor[4]; \ - offset[3] = ( size_t )help2[3] + \ - ind_i[3] * size[3] + offset[4];\ - \ - for ( ind_i[2] = 0; ind_i[2] < n_i[2]; \ - ind_i[2]++ ) \ - { \ - factor[2] = weights[ind_i[2]*_mitkIpPicNDIM + 2]*\ - factor[3]; \ - offset[2] = ( size_t )help2[2] + \ - ind_i[2] * size[2] + \ - offset[3]; \ - \ - for ( ind_i[1] = 0; ind_i[1] < n_i[1];\ - ind_i[1]++ ) \ - { \ - factor[1] = weights[ind_i[1]*_mitkIpPicNDIM+1] *\ - factor[2]; \ - offset[1] = ( size_t )help2[1] + \ - ind_i[1] * size[1] + \ - offset[2]; \ - \ - for ( ind_i[0] = 0; ind_i[0] < n_i[0];\ - ind_i[0]++ ) \ - { \ - offset[0] = ( size_t )(help2[0]+\ - ind_i[0] * size[0] + \ - offset[1])*(( size_t )step)+shift;\ - if(pic_elements<=offset[0]) continue; \ - factor[0] = weights[ind_i[0]*_mitkIpPicNDIM] * \ - factor[1]; \ - help = help + factor[0] * \ - ((( type * ) pic_old->data )\ - [offset[0]]+RND); \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - off_new = 0; \ - for ( i = 0; i < pic_old->dim; i++ ) \ - off_new = off_new + ind_o[i] * sizeo[i]; \ - off_new = off_new*step+shift; \ - (( type * ) pic_new->data )[off_new] = help; \ - off_weights = 0; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} -#define SCBL( type, pic_old, pic_new, size, scale, n ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 0, 1, 0 ) -#define SCBLCOLOR( type, pic_old, pic_new, size, scale, n ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 0, 3, 0 ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 1, 3, 0 ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 2, 3, 0 ) - -#define SCBL_INT( type, pic_old, pic_new, size, scale, n ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 0, 1, 0.5 ) -#define SCBLCOLOR_INT( type, pic_old, pic_new, size, scale, n ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 0, 3, 0.5 ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 1, 3, 0.5 ) \ - SCBL4ALL( type, pic_old, pic_new, size, scale, n, 2, 3, 0.5 ) - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *_mitkIpFuncScBL( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ) -{ - - mitkIpUInt4_t i; /* loopindex */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* no. of pixels in each dimension*/ - mitkIpFloat8_t scale[_mitkIpPicNDIM]; /* scaling factors */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; - mitkIpUInt4_t sizeo[_mitkIpPicNDIM]; - char is_color=0; - - - /* check whether data are correct */ - - if(pic_old->bpe==24) - { - is_color=1; - pic_old->bpe=pic_new->bpe=8; - } - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_new ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim != pic_new->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - for ( i = 0; i < pic_new->dim; i++ ) -// if(pic_new->n[i]>=pic_old->n[i]) - n[i] = pic_new->n[i];//ivo - 2; -// else -// n[i] = pic_new->n[i]-1; - - for ( i = pic_new->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 0; - - sizeo[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - sizeo[i] = sizeo[i-1] * pic_new->n[i-1]; - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - /* calculate scaling factors */ - - for ( i = 0; i < pic_old->dim; i++ ) - scale[i] = ( mitkIpFloat8_t ) ( pic_old->n[i] - 1 ) / - ( mitkIpFloat8_t ) ( pic_new->n[i] - 1 ); - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - scale[i] = 1.; - - /* add header information for pic_new and allocate memory */ - - pic_new->bpe = pic_old->bpe*(is_color!=0?3:1); - pic_new->type = pic_old->type; - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to scale an image ( for all data types )s) */ - - if(pic_old->type==mitkIpPicFloat) - { - if(is_color==0) - { - mitkIpPicFORALL_4 ( SCBL, pic_old, pic_new, size, scale, n ); - } - else - { - mitkIpPicFORALL_4 ( SCBLCOLOR, pic_old, pic_new, size, scale, n ); - } - } - else - { - if(is_color==0) - { - mitkIpPicFORALL_4 ( SCBL_INT, pic_old, pic_new, size, scale, n ); - } - else - { - mitkIpPicFORALL_4 ( SCBLCOLOR_INT, pic_old, pic_new, size, scale, n ); - } - } - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/ScFact.c b/Utilities/IpFunc/ScFact.c deleted file mode 100644 index ddc1d855014..00000000000 --- a/Utilities/IpFunc/ScFact.c +++ /dev/null @@ -1,115 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function scales an image with a factor for all directions - */ - -/** this function scales an image with a factor for all directions - * - * @param pic_old pointer to the image - * @param sc_fact vector that contains the scaling factors - * @param sc_kind parameter for the kind of interpolation - * @arg @c mitkIpFuncScaleNN: next neighbour interpolation - * qarg @c mitkIpFuncScaleBl: bilinear interpolation - * - * @return pointer to the scaled image - * - * AUTHOR & DATE - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncScFact ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t factor, - mitkIpFuncFlagI_t sc_kind ) ; - -#ifndef DOXYGEN_IGNORE - -mitkIpPicDescriptor *mitkIpFuncScFact ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t factor, - mitkIpFuncFlagI_t sc_kind ) -{ - - mitkIpUInt4_t i; /* loop index */ - mitkIpPicDescriptor *pic_new; /* pointer to scaled image */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* allocate pic_new */ - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* copy scaling information to header of pic_new */ - - pic_new->dim = pic_old->dim; - for ( i = 0; i < pic_old->dim; i++ ) - pic_new->n[i] = pic_old->n[i] * factor; - - /* call scaling routines */ - - if ( sc_kind == mitkIpFuncScaleNN ) - pic_new = _mitkIpFuncScNN ( pic_old, pic_new ); - else if ( sc_kind == mitkIpFuncScaleBl ) - pic_new = _mitkIpFuncScBL ( pic_old, pic_new ); - else - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/ScNN.c b/Utilities/IpFunc/ScNN.c deleted file mode 100644 index 243ddb4af36..00000000000 --- a/Utilities/IpFunc/ScNN.c +++ /dev/null @@ -1,222 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* -* internal only. used by Scale.c -*/ -/*@file - * this function scales the first image to the size of the second image - * using next-neighbour interpolation - */ - -/* @brief scales the first image to the size of the second image - * using next-neighbour interpolation - * - * @param pic_old pointer to the image that should be scaled - * @param pic_new pointer to the scaled image ( contains the information - * for the scaling in th header ) - * !!! Header must contain all information when calling !!! - * !!! function !!! - * - * @return pointer to the scaled image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *_mitkIpFuncScNN( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ) ; - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SCNN4ALL( type, pic_old, pic_new, size, weights, n, shift, step )\ -{ \ - size_t ind[_mitkIpPicNDIM]; /* loop index vector */\ - size_t offset[_mitkIpPicNDIM]; /* offset vector */\ - size_t i; /* loop index */\ - size_t off_new; /* offset of scaled image */\ - size_t off_orig; /* offset of orig. image */\ - \ - \ - /* calculate offsets for scaling an image */ \ - \ - off_new = 0; \ - for ( ind[7] = 0; ind[7] < n[7]; ind[7]++ ) \ - { \ - offset[7] = ( mitkIpUInt4_t ) ( ( mitkIpFloat8_t ) ind[7] * \ - weights[7] + 0.5 ) * size[7]; \ - for ( ind[6] = 0; ind[6] < n[6]; ind[6]++ ) \ - { \ - offset[6] = ( mitkIpUInt4_t ) ( ( mitkIpFloat8_t ) ind[6] * \ - weights[6] + 0.5 ) * size[6]; \ - for ( ind[5] = 0; ind[5] < n[5]; ind[5]++ ) \ - { \ - offset[5] = ( mitkIpUInt4_t ) ( ( mitkIpFloat8_t ) ind[5] * \ - weights[5] + 0.5 ) * size[5]; \ - for ( ind[4] = 0; ind[4] < n[4]; ind[4]++ ) \ - { \ - offset[4] = ( mitkIpUInt4_t ) ( ( mitkIpFloat8_t ) ind[4] * \ - weights[4] + 0.5 ) * size[4]; \ - for ( ind[3] = 0; ind[3] < n[3]; ind[3]++ ) \ - { \ - offset[3] = ( mitkIpUInt4_t ) ( ( mitkIpFloat8_t ) ind[3]*\ - weights[3] + 0.5 ) * size[3]; \ - for ( ind[2] = 0; ind[2] < n[2]; ind[2]++ ) \ - { \ - offset[2] = ( mitkIpUInt4_t ) \ - ( ( mitkIpFloat8_t ) ind[2] * \ - weights[2] + 0.5 ) * size[2]; \ - for ( ind[1] = 0; ind[1] < n[1]; ind[1]++ ) \ - { \ - offset[1] = ( mitkIpUInt4_t ) \ - ( ( mitkIpFloat8_t ) ind[1] * \ - weights[1]+0.5 ) * size[1]; \ - for ( ind[0] = 0; ind[0] < n[0]; ind[0]++)\ - { \ - offset[0] = ( mitkIpUInt4_t ) \ - ( ( mitkIpFloat8_t ) ind[0] * \ - weights[0] + 0.5)*size[0];\ - off_orig = 0; \ - for ( i = 0; i < pic_old->dim; i++ ) \ - off_orig = off_orig + offset[i]; \ - \ - (( type * )pic_new->data)[off_new+shift]=\ - (( type * )pic_old->data)[off_orig+shift];\ - \ - off_new+=step; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - -#define SCNN( type, pic_old, pic_new, size, weights, n ) \ - SCNN4ALL( type, pic_old, pic_new, size, weights, n, 0, 1 ) -#define SCNNCOLOR( type, pic_old, pic_new, size, weights, n ) \ - SCNN4ALL( type, pic_old, pic_new, size, weights, n, 0, 3 ) \ - SCNN4ALL( type, pic_old, pic_new, size, weights, n, 1, 3 ) \ - SCNN4ALL( type, pic_old, pic_new, size, weights, n, 2, 3 ) -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *_mitkIpFuncScNN( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ) -{ - - mitkIpUInt4_t i; /* loopindex */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* no. of pixels in each dimension*/ - mitkIpFloat8_t weights[_mitkIpPicNDIM]; - mitkIpUInt4_t size[_mitkIpPicNDIM]; - char is_color=0; - - - /* check whether data are correct */ - - if(pic_old->bpe==24) - { - is_color=1; - pic_old->bpe=pic_new->bpe=8; - } - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_new ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim != pic_new->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - for ( i = 0; i < pic_new->dim; i++ ) - n[i] = pic_new->n[i]; - - for ( i = pic_new->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 1; - - size[0] = 1*(is_color!=0?3:1); - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - for ( i = 0; i < pic_old->dim; i++ ) - weights[i] = ( mitkIpFloat8_t ) ( pic_old->n[i] - 1 ) / - ( mitkIpFloat8_t ) ( pic_new->n[i] - 1 ); - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - weights[i] = 0.; - - /* add header information for pic_new and allocate memory */ - - pic_new->bpe = pic_old->bpe*(is_color!=0?3:1); - pic_new->type = pic_old->type; - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to scale an image */ - if(is_color==0) - { - mitkIpPicFORALL_4 ( SCNN, pic_old, pic_new, size, weights, n ); - } - else - { - mitkIpPicFORALL_4 ( SCNNCOLOR, pic_old, pic_new, size, weights, n ); - pic_old->bpe=pic_new->bpe=24; - } - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/Scale.c b/Utilities/IpFunc/Scale.c deleted file mode 100644 index 396aff12a4b..00000000000 --- a/Utilities/IpFunc/Scale.c +++ /dev/null @@ -1,133 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function scales an image - */ - -/** @brief this function scales an image - * - * @param pic_old pointer to the image - * @param sc_fact vector that contains the scaling factors for each dimension - * @param sc_kind parameter for the kind of interpolation - * @arg @c mitkIpFuncScaleNN: next neighbour interpolation - * @arg @c mitkIpFuncScaleBl: bilinear interpolation - * - * @return pointer to the scaled image - * - * AUTHOR AND DATE - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncScale ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t sc_fact[_mitkIpPicNDIM], - mitkIpFuncFlagI_t sc_kind ) ; -#ifndef DOXYGEN_IGNORE - -mitkIpPicDescriptor *mitkIpFuncScale ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t sc_fact[_mitkIpPicNDIM], - mitkIpFuncFlagI_t sc_kind ) -{ - - mitkIpUInt4_t i; /* loop index */ - mitkIpPicDescriptor *pic_new; /* pointer to scaled image */ - - char is_color=0; - - - /* check whether data are correct */ - - if(pic_old->bpe==24) - { - pic_old->bpe=8; - is_color=1; - } - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if(is_color) - pic_old->bpe=24; - - /* allocate pic_new */ - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* copy scaling information to header of pic_new */ - - pic_new->dim = pic_old->dim; - for ( i = 0; i < pic_old->dim; i++ ) - pic_new->n[i] = - ( sc_fact[i] == 0 ) ? - pic_old->n[i] : - ( mitkIpUInt4_t ) ( sc_fact[i] * pic_old->n[i] ); - - /* call scaling routines */ - - if ( sc_kind == mitkIpFuncScaleNN ) - pic_new = _mitkIpFuncScNN ( pic_old, pic_new ); - else if ( sc_kind == mitkIpFuncScaleBl ) { - pic_new = _mitkIpFuncScBL ( pic_old, pic_new ); - /*printf("using NN due to error in _mitkIpFuncScaleBL ... "); - pic_new = _mitkIpFuncScNN ( pic_old, pic_new );*/ - } - else - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/SelInv.c b/Utilities/IpFunc/SelInv.c deleted file mode 100644 index 46356356785..00000000000 --- a/Utilities/IpFunc/SelInv.c +++ /dev/null @@ -1,159 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function sets the greyvalues of all pixels @e inside a given - * range to a new greyvalue - */ - -/** @brief sets the greyvalues of all pixels @e inside a given - * range to a new greyvalue - * - * The greyvalues of all pixels which are included - * in [gv_low, gv_up] are set to a new greyvalue (gv). - * - * @param pic_old pointer to original image - * @param gv_low lower greyvalue of range - * @param gv_up upper greyvalue of range - * @param gv new greyvalue - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSelInv ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ) ; -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - -/* definition of macros */ - -#define SELECT( type, pic, gv_low, gv_up, gv ) \ -{ \ - mitkIpUInt4_t i; /* loopindex */\ - type help; /* element that should be transformed */\ - \ - /* transform greyvalues */\ - \ - for ( i = 0; i < _mitkIpPicElements ( pic ); i++ ) \ - { \ - help = (( type * )pic->data )[i]; \ - (( type * )pic_new->data )[i] = \ - ( help < ( type ) gv_low || help > ( type )gv_up ) ? \ - ( type ) help : gv; \ - } \ - \ -} \ - -/* ------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncSelInv ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ) -{ - mitkIpFloat8_t min_gv, max_gv; /* max and min posiible greyvalues */ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) == mitkIpFuncERROR ) - return ( mitkIpFuncERROR ); - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( gv_low > gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( min_gv > gv_low || max_gv < gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( min_gv > gv || max_gv < gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for the transformed image */ - - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to transform the image */ - - mitkIpPicFORALL_3 ( SELECT, pic_old, gv_low, gv_up, gv ); - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/SelMM.c b/Utilities/IpFunc/SelMM.c deleted file mode 100644 index 0c5a9942713..00000000000 --- a/Utilities/IpFunc/SelMM.c +++ /dev/null @@ -1,153 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function sets the greyvalues of all pixels outside a given - * range to the an extremal greyvalue - */ - -/** @brief sets the greyvalues of all pixels outside a given - * range to the an extremal greyvalue - - * Sets the greyvalue of pixels that are smaller than gv_low to this value and - * those larger than gv_up to that value. Very similar to - * and used by mitkIpFuncLevWin(). - * - * @param pic_old pointer to original image - * @param gv_low lower greyvalue of range - * @param gv_up upper greyvalue of range - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSelMM ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpPicDescriptor *pic_return ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define SELECT( type, pic, gv_low, gv_up, min_gv, max_gv ) \ -{ \ - mitkIpUInt4_t i; /* loopindex */\ - mitkIpUInt4_t no_elem; /* loopindex */\ - type help; /* element that should be transformed */\ - \ - /* transform greyvalues */\ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type * )pic->data )[i]; \ - (( type * )pic_new->data )[i] = \ - ( help < ( type ) gv_up ) ? \ - (( help > ( type ) gv_low ) ? help : ( type ) gv_low ) : \ - ( type ) gv_up ; \ - } \ -} - -/* ------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncSelMM ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpPicDescriptor *pic_return ) -{ - mitkIpFloat8_t min_gv, max_gv; /* max and min possible greyvalues */ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) == mitkIpFuncERROR ) - return ( mitkIpFuncERROR ); - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( gv_low >= gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( min_gv > gv_low || max_gv < gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for the transformed image */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to transform the image */ - - mitkIpPicFORALL_4 ( SELECT, pic_old, gv_low, gv_up, min_gv, max_gv ); - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Select.c b/Utilities/IpFunc/Select.c deleted file mode 100644 index c720c793d78..00000000000 --- a/Utilities/IpFunc/Select.c +++ /dev/null @@ -1,160 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function sets the greyvalues of all pixels @e outside a given - * range to a new greyvalue - */ - -/** @brief sets the greyvalues of all pixels @e outside a given - * range to a new greyvalue - * - * The greyvalues of all pixels which are @e not included - * in [gv_low, gv_up] are set to a new greyvalue (gv). - * - * @param pic_old pointer to original image - * @param gv_low lower greyvalue of range - * @param gv_up upper greyvalue of range - * @param gv new greyvalue - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to transformed image - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSelect ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - -#define SELECT( type, pic, gv_low, gv_up, gv ) \ -{ \ - mitkIpUInt4_t i; /* loopindex */\ - type help; /* element that should be transformed */\ - \ - /* transform greyvalues */\ - \ - for ( i = 0; i < _mitkIpPicElements ( pic ); i++ ) \ - { \ - help = (( type * )pic->data )[i]; \ - (( type * )pic_new->data )[i] = \ - ( help < gv_low || help > gv_up ) ? \ - /*( help < ( type ) gv_low || help > ( type )gv_up ) ? iw-3.8.2000*/ \ - ( type ) gv : help; \ - } \ - \ -} \ - -/* ------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncSelect ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ) -{ - mitkIpFloat8_t min_gv, max_gv; /* max and min possible greyvalues */ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - - - /* calculate max. and min. possible greyvalues */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) == mitkIpFuncERROR ) - return ( mitkIpFuncERROR ); - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( gv_low > gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } -/* iw - commented out on 3.8.2000 - if ( min_gv > gv_low || max_gv < gv_up ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } -*/ - if ( min_gv > gv || max_gv < gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for the transformed image */ - - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to transform the image */ - - mitkIpPicFORALL_3 ( SELECT, pic_old, gv_low, gv_up, gv ); - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} -#endif diff --git a/Utilities/IpFunc/SetErrno.c b/Utilities/IpFunc/SetErrno.c deleted file mode 100644 index a19276cd0e7..00000000000 --- a/Utilities/IpFunc/SetErrno.c +++ /dev/null @@ -1,138 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions sets a global error-number (mitkIpFuncErrno) if an error - * occured - */ - -/** this functions sets a global error-number (mitkIpFuncErrno) if an error - * occured - * - * @param error_no number which describes the error - * - * @return none - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)_mitkIpFuncSetErrno\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/* gloabal variables */ - -int mitkIpFuncErrno; - -/* ------------------------------------------------------------------- */ - -/* -** _mitkIpFuncSetErrno -*/ - -void _mitkIpFuncSetErrno ( int error_no ) -{ - mitkIpFuncErrno = error_no; - - return; -} - -/* ------------------------------------------------------------------- */ - -/* -** mitkIpFuncPError -*/ - - -void mitkIpFuncPError ( char *string ) -{ - char *err_string=NULL; - - switch ( mitkIpFuncErrno ) - { - case mitkIpFuncOK : - err_string = "ipFunc: no error occured"; - break; - case mitkIpFuncNOPIC_ERROR : - err_string = "no image"; - break; - case mitkIpFuncDIM_ERROR : - err_string = "ipFunc: incorrect dimension of image"; - break; - case mitkIpFuncSIZE_ERROR : - err_string = "ipFunc: incorrect image size"; - break; - case mitkIpFuncFLAG_ERROR : - err_string = "ipFunc: incorrect flag"; - break; - case mitkIpFuncMALLOC_ERROR : - err_string = "ipFunc: no memory allocated"; - break; - case mitkIpFuncPICNEW_ERROR : - err_string = "ipFunc: can't create pic_new"; - break; - case mitkIpFuncTYPE_ERROR : - err_string = "ipFunc: incorrect image data type "; - break; - case mitkIpFuncUNFIT_ERROR : - err_string = "ipFunc: image data sizeis don't correspond"; - break; - case mitkIpFuncDIMMASC_ERROR : - err_string = "ipFunc: incorrect mask dimension"; - break; - case mitkIpFuncDATA_ERROR : - err_string = "ipFunc: incorrect value of parameter"; - break; - default : - err_string = "ipFunc: unknown error"; - } - fprintf ( stderr, "error message: %s \n", err_string ); -} - -#endif - diff --git a/Utilities/IpFunc/SetTag.c b/Utilities/IpFunc/SetTag.c deleted file mode 100644 index 557f532d572..00000000000 --- a/Utilities/IpFunc/SetTag.c +++ /dev/null @@ -1,113 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * this function sets a tag into an image - */ - -/** @brief sets a tag into an image - * If the tag does not exist, it is created. Otherwise the existing - * tag is replaced by the new one. If type==mitkIpPicASCII and the last - * byte is not \0, a \0 is added. - * - * @param pic image into which the tag is set - * @param name name of this tag - * @param size size of the whole data - * @param el_size size of one element of the data - * @param data pointer to the data - * @return - * @arg 0 : error (pic==NULL or data==NULL) - * @arg 1 : new tag added - * @arg 2 : tag replaced - * - * @b Examples: - * @code - * mitkIpFuncSetTag(pic, "OUTSIDE_VALUE", mitkIpPicInt, sizeof(mitkIpInt4_t), 1, &outside_value); - * - * char startpoint[11]; - * memset(startpoint, 0, 11); - * sprintf(startpoint,"(%u/%u)",*x,*y); - * mitkIpFuncSetTag(p, "STARTPOINT", mitkIpPicASCII, 11, 1, startpoint); - * @endcode - * @warning not yet extensively tested. - * - * @author Ivo (based on Gerald's NewTag) - * @date 26.06.2000 - */ - -#include "mitkIpFuncP.h" - -int mitkIpFuncSetTag( mitkIpPicDescriptor *pic, char *name, int type, int size, - int el_size, void *data ) -{ - mitkIpPicTSV_t *tsv; - int alloc_size; - int add_new; - - if((pic==NULL) || (data==NULL)) return 0; - - alloc_size=size; - if((type==mitkIpPicASCII) && (((char*)data)[size-1]!=0)) alloc_size++; - - tsv = mitkIpPicQueryTag(pic, name); - if (tsv != NULL) - { - tsv->value = realloc(tsv->value, alloc_size * el_size ); - add_new = 0; - } - else - { - tsv = malloc( sizeof(mitkIpPicTSV_t) ); - tsv->value = malloc( alloc_size * el_size ); - strcpy( tsv->tag, name); - add_new = 1; - } - tsv->type = type; - tsv->bpe = 8*el_size; - tsv->dim = 1; - tsv->n[0] = alloc_size; - tsv->value = memmove( tsv->value, data, size * el_size ); - if(alloc_size!=size) ((char*)tsv->value)[size]=0; - - if(add_new==1) - mitkIpPicAddTag( pic, tsv ); - - return add_new+1; -} diff --git a/Utilities/IpFunc/ShapeInterpolation.c b/Utilities/IpFunc/ShapeInterpolation.c deleted file mode 100644 index eb8bbe11dae..00000000000 --- a/Utilities/IpFunc/ShapeInterpolation.c +++ /dev/null @@ -1,257 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -#include -#include -#include "mitkIpFuncP.h" - -/*! -The algorithm implements the shape-based interpolation technique. -Further detailed information can be found in: - -G.T. Herman, J. Zheng, C.A. Bucholtz: "Shape-based interpolation" -IEEE Computer Graphics & Applications, pp. 69-79,May 1992 -*/ - -#define MAX 2048 - -extern float truncf (float x); -static mitkIpPicDescriptor* setup (mitkIpPicDescriptor* pic_old, const mitkIpFloat4_t threshold); -static mitkIpInt2_t distance (const mitkIpInt2_t* const old_distance, const mitkIpInt2_t* mask_dist, const mitkIpInt2_t* mask_offset, const mitkIpUInt4_t mask_elements); - -#define INTERPOLATE(TYPE, RESULT, PIC0, PIC1) \ -{ \ - mitkIpInt4_t x, y; \ - mitkIpUInt4_t i; /* loop counters */ \ - mitkIpFloat4_t weight[] = {1.0f-ratio, ratio}; /* weights of the interpolants */ \ - mitkIpInt2_t mask_width = 1; /* mask width from center to border */ \ - mitkIpInt2_t mask_x[] = {0, -1, +1, 0, -1}; /* relativ position in x-axis of mask */ \ - mitkIpInt2_t mask_y[] = {0, 0, -1, -1, -1}; /* relativ position in y-axis of mask */ \ - /* mitkIpInt2_t mask_dist[] = {0, 3, 4, 3, 4}; */ \ - mitkIpInt2_t mask_dist[] = {0, 10, 14, 10, 14};/* distance to central element */ \ - mitkIpInt2_t mask_offset [5]; /* relative start position in given image */ \ - mitkIpUInt4_t mask_elements = 5; /* elements in distance mask */ \ - mitkIpInt2_t first_x, first_y; /* first pixel for distance calculation \ - in enlarged image version */ \ - mitkIpInt2_t last_x, last_y; /* last pixel for distance calculation \ - in enlarged image version */ \ - mitkIpInt2_t *pixel[2]; /* pointer to the current pixels */ \ - TYPE* pixel_out; \ - \ - /* apply the mask in both directions */ \ - for (i=0; i< mask_elements; i++) { \ - mask_offset [i] = mask_x[i] + mask_y[i]*(PIC0)->n[0]; \ - } \ - first_x = mask_width; \ - first_y = mask_width; \ - last_x = (PIC0)->n[0] - mask_width-1; \ - last_y = (PIC0)->n[1] - mask_width-1; \ - /* top-left to bottom-right, borders are neglected */ \ - for (y = first_y; y <= last_y; y++) { \ - pixel [0] = (mitkIpInt2_t *) (PIC0)->data + (first_x + y * (PIC0)->n [0]); \ - pixel [1] = (mitkIpInt2_t *) (PIC1)->data + (first_x + y * (PIC1)->n [0]); \ - for (x = first_x; x <= last_x; x++) { \ - *(pixel [0])++ = distance (pixel [0], mask_dist, mask_offset, mask_elements); \ - *(pixel [1])++ = distance (pixel [1], mask_dist, mask_offset, mask_elements); \ - } \ - } \ - /* bottom-right to top-left, borders are neglected */ \ - for (i=0; i< mask_elements; i++) { \ - mask_offset [i] = -mask_offset [i]; \ - } \ - pixel_out = (TYPE *) result->data + _mitkIpPicElements(result) - 1; \ - for (y = last_y; y >= first_y; y--) { \ - pixel [0] = (mitkIpInt2_t *) (PIC0)->data + (last_x + y * (PIC0)->n [0]); \ - pixel [1] = (mitkIpInt2_t *) (PIC1)->data + (last_x + y * (PIC1)->n [0]); \ - for (x = last_x; x >= first_x; x--) { \ - *(pixel [0]) = distance (pixel [0], mask_dist, mask_offset, mask_elements); \ - *(pixel [1]) = distance (pixel [1], mask_dist, mask_offset, mask_elements); \ - *pixel_out-- = (weight [0] * *(pixel [0]) + weight [1] * *(pixel[1]) > 0 ? 1 : 0); \ - pixel[0]--; \ - pixel[1]--; \ - } \ - } \ -} - -/*! -\brief Computes an intermediate image by linear shape-based interpolation. -@param pic1,pic2 the images which enclose the intermediate image -@param threshold the threshold which extracts the shape in the images -@param ratio the ratio the ratio specifies the weights for interpolation, i.e. the intermediate -image equals to pic1 or pic2 if the ratio is zero and one, respectively -@returns the intermediate image -*/ -mitkIpPicDescriptor* -mitkIpFuncShapeInterpolation (mitkIpPicDescriptor* pic1, mitkIpPicDescriptor* pic2, const mitkIpFloat4_t threshold, const mitkIpFloat4_t ratio, mitkIpPicDescriptor* result) -{ - mitkIpPicDescriptor *pic[2]; /* pointer to image data */ - - /* prepare the images */ - result = mitkIpPicCopyHeader(pic1, NULL); - if (result == NULL) { - return NULL; - } - result->data = malloc (_mitkIpPicSize (result)); - if (result->data == NULL) { - _mitkIpFuncSetErrno (mitkIpFuncMALLOC_ERROR); - mitkIpPicFree (result); - return NULL; - } - pic[0] = setup (pic1, threshold); - pic[1] = setup (pic2, threshold); - - mitkIpPicFORALL_2(INTERPOLATE, result, pic[0], pic[1]); - - mitkIpPicFree(pic [0]); - mitkIpPicFree(pic [1]); - return result; -} - -#define COPY(TYPE, SRC, DST, THRESH) \ -{ \ - TYPE* src; \ - mitkIpInt2_t* dst; \ - src = (TYPE *) (SRC)->data; \ - dst = (mitkIpInt2_t *) (DST)->data + (1 + (DST)->n[0]); \ - for (y = 0; y < (SRC)->n[1]; y++) { \ - for (x = 0; x < (SRC)->n[0]; x++) { \ - *dst++ = (*src++ > (THRESH) ? MAX : -MAX); \ - } \ - dst += 2; \ - } \ -} - -static mitkIpPicDescriptor* -setup (mitkIpPicDescriptor* pic_old, const mitkIpFloat4_t threshold) -{ - mitkIpPicDescriptor* pic; - mitkIpInt2_t* dst; - mitkIpUInt4_t x, y; - - /* Allocate new image for distance transform */ - - pic = mitkIpPicCopyHeader (pic_old, NULL); - pic->type = mitkIpPicInt; - pic->bpe = 16; - pic->n[0] += 2; - pic->n[1] += 2; - pic->data = malloc (_mitkIpPicSize (pic)); - - /* Set the frame to -1 */ - - dst = (mitkIpInt2_t *) pic->data; - for (x = 0; x < pic->n[0]; x++) { - *dst++ = -MAX; - } - dst = (mitkIpInt2_t *) pic->data + _mitkIpPicElements (pic) - pic->n[0]; - for (x = 0; x < pic->n[0]; x++) { - *dst++ = -MAX; - } - dst = (mitkIpInt2_t *) pic->data; - for (y = 0; y < pic->n[1]; y++) { - *dst = -MAX; - dst += pic->n[0]; - } - dst = (mitkIpInt2_t *) pic->data + (pic->n[0] - 1); - for (y = 0; y < pic->n[1]; y++) { - *dst = -MAX; - dst += pic->n[0]; - } - - /* Set the image data to initial values */ - - mitkIpPicFORALL_2(COPY, pic_old, pic, threshold); - dst = (mitkIpInt2_t *) pic->data + (1 + pic->n[0]); - for (y = 0; y < pic_old->n[1]; y++) { - for (x = 0; x < pic_old->n[0]; x++) { - if ((dst[0] < dst[1]) || (dst[0] < dst[pic->n[0]])) { - *dst = -5; - } else if ((dst[0] > dst[1]) || (dst[0] > dst[pic->n[0]])) { - *dst = 5; - } - dst++; - } - dst += 2; - } - dst -= 2; - for (y = 0; y < pic_old->n[1]; y++) { - for (x = 0; x < pic_old->n[0]; x++) { - dst--; - if (abs (dst[0]) > 5) { - if ((dst[0] < dst[-1]) || (dst[0] < dst[-pic->n[0]])) { - *dst = -5; - } else if ((dst[0] > dst[-1]) || (dst[0] > dst[-pic->n[0]])) { - *dst = 5; - } - } - } - } - return pic; -} - -static mitkIpInt2_t distance (const mitkIpInt2_t* const old_distance, const mitkIpInt2_t* mask_dist, const mitkIpInt2_t* mask_offset, const mitkIpUInt4_t mask_elements) -{ - mitkIpInt2_t cur_distance, new_distance; - mitkIpUInt4_t i; - - cur_distance = old_distance [0]; - if (abs (cur_distance) != 5) { - if (cur_distance > 0) { - for (i = 0; i < mask_elements; i++) { - new_distance = *mask_dist + old_distance [*mask_offset]; - if (new_distance < cur_distance) { - cur_distance = new_distance; - } - mask_dist++; - mask_offset++; - } - } else if (cur_distance < 0) { - for (i = 0; i < mask_elements; i++) { - new_distance = old_distance [*mask_offset] - *mask_dist; - if (new_distance > cur_distance) { - cur_distance = new_distance; - } - mask_dist++; - mask_offset++; - } - } - } - return cur_distance; -} diff --git a/Utilities/IpFunc/Shp.c b/Utilities/IpFunc/Shp.c deleted file mode 100644 index 7361bc744f0..00000000000 --- a/Utilities/IpFunc/Shp.c +++ /dev/null @@ -1,165 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a high pass filter using 2D or 3D filtering - * masks - */ - -/** @brief performs a high pass filter using 2D or 3D filtering - * masks - * - * @param pic_old pointer to the image that should be convolved - * @param dim_mask dimension of filtering mask - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to zero - * @param mask_nr tells which mask should be taken - * - * @return pointer to the tranformed image - * - * USES - * function mitkIpFuncConv: convolves image with mask - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncShp ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border, - mitkIpUInt4_t mask_nr ) ; -#ifndef DOXYGEN_IGNORE - -mitkIpPicDescriptor *mitkIpFuncShp ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border, - mitkIpUInt4_t mask_nr ) -{ - - mitkIpPicDescriptor *pic_new; /* convolved image */ - mitkIpPicDescriptor *pic_mask; /* high pass mask */ - mitkIpUInt4_t i; /* loop index */ - mitkIpInt2_t mask2[] = /* 2D masks */ - { 0, -1, 0, -1, 5, -1, 0, -1, 0, /* mask 0 */ - - 1, -2, 1, -2, 5, -2, 1, -2, 1, /* mask 1 */ - - -1, -1, -1, -1, 9, -1, -1, -1, -1 }; /* mask 2 */ - - mitkIpInt2_t mask3[] = /* 3D masks */ - { 0, 0, 0, 0, -1, 0, 0, 0, 0, /* mask 0 */ - 0, -1, 0, -1, 7, -1, 0, -1, 0, - 0, 0, 0, 0, -1, 0, 0, 0, 0, - - 1, 1, 1, 1, -4, 1, 1, 1, 1, /* mask 1 */ - 1, -4, 1, -4, 5, -4, 1, -4, 1, - 1, 1, 1, 1, -4, 1, 1, 1, 1, - - -1, -1, -1, -1, -1, -1, -1, -1, -1, /* mask 2 */ - -1, -1, -1, -1, 27, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim < dim_mask || dim_mask < 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( /* mask_nr < 0 || */ mask_nr > 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of pic_mask */ - - pic_mask = mitkIpPicNew (); - if ( pic_mask == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicInt; - pic_mask->bpe = 16; - pic_mask->dim = dim_mask; - for ( i = 0; i < dim_mask; i++ ) - pic_mask->n[i] = 3; - - if ( dim_mask == 3 ) - { - pic_mask->data = mask3 + mask_nr * 27; - } - else if ( dim_mask == 2 ) - { - pic_mask->data = mask2 + mask_nr * 9; - } - else - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* function to convolve image with mask */ - - pic_new = mitkIpFuncConv ( pic_old, pic_mask, border ); - - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Skewness.c b/Utilities/IpFunc/Skewness.c deleted file mode 100644 index e0ca5872c79..00000000000 --- a/Utilities/IpFunc/Skewness.c +++ /dev/null @@ -1,116 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the skewness (Schiefe) of all - * greyvalues in an image - */ - -/** @brief calculates the skewness (Schiefe) of all - * greyvalues in an image - * - * @param pic pointer to the image - * - * @return skewness of image - * - * @author Steffen Gundel - */ - - -/* include-files */ - -#include "mitkIpFuncP.h" - -/* definition of extreme value macro */ - -mitkIpFloat8_t mitkIpFuncSkewness ( mitkIpPicDescriptor *pic ); - -#ifndef DOXYGEN_IGNORE - -#define SKEWNESS( type, pic, mean, skew ) \ - { \ - mitkIpUInt4_t i, no_elem; \ - \ - skew = 0.; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - skew = ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) + \ - skew; \ - } \ - } - -/* ========================================================== */ -/* -** function picVar : calculates the mean value (mean) -** of an image (pic) -*/ -/* ========================================================== */ - -mitkIpFloat8_t mitkIpFuncSkewness ( mitkIpPicDescriptor *pic ) -{ - - mitkIpFloat8_t var; - mitkIpFloat8_t mean, std; - mitkIpFloat8_t skew; - - - /* check image data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpOK ) return ( mitkIpFuncERROR ); - - if ( _mitkIpPicElements ( pic ) == 1 ) var = 0; - else - { - - mean = mitkIpFuncMean ( pic ); - std = mitkIpFuncSDev( pic ); - - mitkIpPicFORALL_2( SKEWNESS, pic, mean, skew ); - - var = skew / (( mitkIpFloat8_t ) (( _mitkIpPicElements ( pic ) - 1 ) *std*std*std)); - } - - return( var ); -} -#endif diff --git a/Utilities/IpFunc/SkewnessR.c b/Utilities/IpFunc/SkewnessR.c deleted file mode 100644 index e132e6d9deb..00000000000 --- a/Utilities/IpFunc/SkewnessR.c +++ /dev/null @@ -1,87 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the skewness (Schiefe) of all - * greyvalues included by a rectangle - */ - -/** @brief calculates the skewness (Schiefe) of all - * greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to the image - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return skewness in window - * - * @author Steffen Gundel - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - - -/* ========================================================== */ -/* -** function picVar : calculates the mean value (mean) -** of an image (pic) -*/ -/* ========================================================== */ - -mitkIpFloat8_t mitkIpFuncSkewnessR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) { - - mitkIpFloat8_t var; - mitkIpPicDescriptor *pic_help; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - var = mitkIpFuncSkewness ( pic_help ); - - mitkIpPicFree ( pic_help ); - - return var ; -} diff --git a/Utilities/IpFunc/Sobel.c b/Utilities/IpFunc/Sobel.c deleted file mode 100644 index c54dc7b7fb6..00000000000 --- a/Utilities/IpFunc/Sobel.c +++ /dev/null @@ -1,348 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a 3*3 nonlinear edge enhancement operation - * using a sobel operator. The operator could be used with 2D and 3D - * filtering masks. - */ - -/** @brief performs a 3*3 nonlinear edge enhancement operation - * using a sobel operator. The operator could be used with 2D and 3D - * filtering masks. - * - * @param pic_old pointer to the image that should be convolved - * @param mask pointer to the mask that is used for convolution - * @param border tells how the edge is transformed - * @arg @c mitkIpFuncBorderOld : original greyvalues - * @arg @c mitkIpFuncBorderZero : edge is set to minimal greyvalue - * - * @return pointer to the transformed image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSobel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SOBEL( typ, pic, size, mask_anz, m ) \ -{ \ - mitkIpInt4_t ind[_mitkIpPicNDIM]; \ - mitkIpInt4_t n[_mitkIpPicNDIM]; \ - mitkIpUInt4_t i,j; \ - mitkIpInt4_t offset; \ - mitkIpInt4_t *beg; \ - mitkIpFloat8_t help, help2, min_gv, max_gv; \ - \ - /* calculate begin and end of the single masks */ \ - \ - beg = malloc ( ( mask_anz + 1 ) * sizeof ( mitkIpInt4_t ) ); \ - \ - beg[0] = 0; \ - for ( i = 1; i <= mask_anz; i++ ) \ - beg[i] = beg[i-1] + m->length / mask_anz; \ - \ - /* initialization of index vector */ \ - \ - for ( i = 0; i < pic->dim; i++ ) \ - n[i] = pic->n[i] - 1; \ - \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - n[i] = 2; \ - \ - /* calculate max. and min. possible greyvalues */ \ - \ - _mitkIpFuncExtT ( pic->type, pic->bpe, &min_gv, &max_gv ); \ - \ - /* convolve image with compressed mask */ \ - \ - for ( ind[7] = 1; ind[7] < n[7]; ind[7]++ ) \ - for ( ind[6] = 1; ind[6] < n[6]; ind[6]++ ) \ - for ( ind[5] = 1; ind[5] < n[5]; ind[5]++ ) \ - for ( ind[4] = 1; ind[4] < n[4]; ind[4]++ ) \ - for ( ind[3] = 1; ind[3] < n[3]; ind[3]++ ) \ - for ( ind[2] = 1; ind[2] < n[2]; ind[2]++ ) \ - for ( ind[1] = 1; ind[1] < n[1]; ind[1]++ ) \ - for ( ind[0] = 1; ind[0] < n[0]; ind[0]++ ) \ - { \ - offset = 0; \ - for ( i = 0; i < pic->dim; i++ ) \ - offset = offset + size[i] * ind[i]; \ - \ - help2 = 0.; \ - for ( j = 0; j < mask_anz; j++ ) \ - { \ - help = 0; \ - for ( i = beg[j]; i < beg[j+1] ; i++ ) \ - help = help + m->mask_vekt[i] * \ - (( typ * )pic->data)[offset+m->off_vekt[i]];\ - help2 = help2 + fabs ( help ); \ - } \ - \ - (( typ * )pic_new->data )[offset] = \ - ( help2 < max_gv )? \ - ( ( help2 < min_gv ) ? ( typ )min_gv : help2 ) : \ - ( typ ) max_gv; \ - } \ - free ( beg ); \ -} - -/* ------------------------------------------------------------------- */ -/* -** function mitkIpFuncSobel: -** -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncSobel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ) -{ - - mitkIpPicDescriptor *pic_new; /* convolved image */ - mitkIpPicDescriptor *pic_mask; /* sobel mask */ - mitkIpInt4_t offset, off_mask; - mitkIpUInt4_t i, j; /* loopindex */ - mitkIpUInt4_t pos; - mitkIpUInt1_t mask_anz; /* number of masks */ - mitkIpInt4_t n[_mitkIpPicNDIM]; - mitkIpInt4_t ind[_mitkIpPicNDIM]; /* vector of loop indices (image) */ - mitkIpFuncMasc_t *m; /* length of mask and offsets */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; - mitkIpInt2_t sobel2[] = /* 2D Sobel mask */ - { 1, 0, -1, 2, 0, -2, 1, 0, -1, - 1, 2, 1, 0, 0, 0, -1, -2, -1 }; - mitkIpInt2_t sobel3[] = /* 3D Sobel mask */ - { 1, 0, -1, 2, 0, -2, 1, 0, -1, - 1, 0, -1, 2, 0, -2, 1, 0, -1, - 1, 0, -1, 2, 0, -2, 1, 0, -1, - - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 2, 0, -2, 2, 0, -2, 2, 0, -2, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - - 1, 2, 1, 0, 0, 0, -1, -2, -1, - 1, 2, 1, 0, 0, 0, -1, -2, -1, - 1, 2, 1, 0, 0, 0, -1, -2, -1, - - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 2, 2, 2, 0, 0, 0, -2, -2, -2, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - - 1, 2, 1, 1, 2, 1, 1, 2, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -2, -1, -1, -2, -1, -1, -2, -1, - - 1, 1, 1, 2, 2, 2, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -2, -2, -2, -1, -1, -1 }; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( ( pic_old->dim < dim_mask ) || ( dim_mask < 1 ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIMMASC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of pic_mask */ - - pic_mask = mitkIpPicNew (); - if ( pic_mask == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_mask->type = mitkIpPicInt; - pic_mask->bpe = 16; - pic_mask->dim = dim_mask+1; - for ( i = 0; i < dim_mask; i++ ) - pic_mask->n[i] = 3; - - if ( dim_mask == 3 ) - { - mask_anz = 6; - pic_mask->n[dim_mask] = mask_anz; - pic_mask->data = sobel3; - } - else if ( dim_mask == 2 ) - { - mask_anz = 2; - pic_mask->n[dim_mask] = mask_anz; - pic_mask->data = sobel2; - } - else - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* initialisation of vectors */ - - for ( i = 0; i < dim_mask; i++ ) - n[i] = 2; - - for ( i = dim_mask; i < _mitkIpPicNDIM; i++ ) - n[i] = 0; - - /* allocate mask structure */ - - m = malloc ( sizeof ( mitkIpFuncMasc_t ) ); - if ( m == NULL ) - { - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return NULL; - } - m->off_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpInt4_t ) ); - if ( m->off_vekt == NULL ) - { - free ( m ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return NULL; - } - m->mask_vekt = malloc ( _mitkIpPicElements( pic_mask ) * sizeof ( mitkIpFloat8_t ) ); - if ( m->mask_vekt == NULL ) - { - free ( m->off_vekt ); - free ( m ); - mitkIpPicFree ( pic_mask ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return NULL; - } - - /* create a new picture, copy the header, allocate memory */ - - if ( border == mitkIpFuncBorderOld ) - pic_new = mitkIpPicClone ( pic_old ); - else if ( border == mitkIpFuncBorderZero ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - free ( m->off_vekt ); - free ( m ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - free ( m->off_vekt ); - free ( m ); - return ( mitkIpFuncERROR ); - } - - /* calculate offset vector for the compressed mask */ - - m->length = 0; - size[0] = 1; - for ( i = 1; i < pic_old->dim; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - off_mask = 0; - for ( i = 0; i < mask_anz; i++ ) - for ( ind[2] = -1; ind[2] < n[2]; ind[2]++ ) - for ( ind[1] = -1; ind[1] < n[1]; ind[1]++ ) - for ( ind[0] = -1; ind[0] < n[0]; ind[0]++ ) - { - if ( (( mitkIpInt2_t * )pic_mask->data)[off_mask] != 0 ) - { - offset = 0; - for ( j = 0; j < dim_mask; j++ ) - offset = offset + ind[j] * size[j]; - m->off_vekt[m->length] = offset; - m->length++; - } - off_mask++; - } - - /* remove elements that are zero from mask */ - - pos = 0; - for ( i = 0; i < m->length; i++ ) - { - while ( (( mitkIpInt2_t * )pic_mask->data)[pos] == 0 ) pos++; - m->mask_vekt[i] = ( mitkIpFloat8_t )(( mitkIpInt2_t * )pic_mask->data)[pos]; - pos++; - } - - - /* macro for the sobel operator */ - - mitkIpPicFORALL_3 ( SOBEL, pic_old, size, mask_anz, m ); - - pic_mask->data = NULL; - mitkIpPicFree ( pic_mask ); - free ( m->off_vekt ); - free ( m->mask_vekt ); - free ( m ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/Sqrt.c b/Utilities/IpFunc/Sqrt.c deleted file mode 100644 index 2cc5b7d7c77..00000000000 --- a/Utilities/IpFunc/Sqrt.c +++ /dev/null @@ -1,166 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this functions calculates the square root of all pixels - */ - -/** @brief calculates the square root of all pixels - * - * @param pic_1 pointer to the first image - * @param keep tells whether the image type could be changed to mitkIpPicFloat - * keep = : image data type could be changed - * keep = : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSqrt ( mitkIpPicDescriptor *pic_1, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SQRT1( type_1, pic_1, pic_new ) \ -{ \ - mitkIpPicFORALL_2 ( SQRT2, pic_new, pic_1, type_1 ); \ -} \ - - -#define SQRT2( type_n, pic_new, pic_1, type_1 ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - mitkIpFloat8_t help; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = ( mitkIpFloat8_t ) (( type_1 * ) pic_1->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( help < 0. ) ? 0 : ( type_n ) sqrt ( help ); \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncSqrt ( mitkIpPicDescriptor *pic_1, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. and min. possible greyvalues for data type of images*/ - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - pic_new = mitkIpPicNew (); - pic_new->dim = pic_1->dim; - pic_new->bpe = 64; - pic_new->type = mitkIpPicFloat; - for ( i = 0; i < pic_new->dim; i++ ) - pic_new->n[i] = pic_1->n[i]; - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL_1 ( SQRT1, pic_1, pic_new ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/SubC.c b/Utilities/IpFunc/SubC.c deleted file mode 100644 index 79bb2c42ae2..00000000000 --- a/Utilities/IpFunc/SubC.c +++ /dev/null @@ -1,254 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function subtracts an constant from an image - */ - -/** @brief subtracts an constant from an image - * - * @param pic_1 pointer to the first image - * @param value constant which is subtracted from the image - * @param keep tells whether the image type could be changed when - * necessary - * @arg @c iFuncNoKeep : image data type could be changed - * @arg @c iFuncKeep : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory which could be used for pic_new. If - * pic_retrun == NULL new memory is allocated - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSubC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SUBC( type_1, pic_1, pic_new, value ) \ -{ \ - mitkIpPicFORALL_3 ( SUBC2, pic_new, pic_1, type_1, value ); \ -} \ - -#define SUBC2( type_n, pic_new, pic_1, type_1, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = ( type_n ) \ - ( ( mitkIpFloat8_t ) (( type_1 * ) pic_1->data ) [i] - \ - value ); \ - } \ -} - -#define SUBC3( type_n, pic_1, pic_new, value ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_n help; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help - value ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help - value ) ? \ - ( (type_n)help - (type_n)value ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncSubC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check value */ - - if ( value == 0. ) return ( pic_old ); - /* - else if ( value == 0. ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_old, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 - value; - smin = min1 - value; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_old->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_old->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( SUBC, pic_old, pic_new, value ) - if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( SUBC3, pic_old, pic_new, value ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/SubI.c b/Utilities/IpFunc/SubI.c deleted file mode 100644 index 3912d08d91c..00000000000 --- a/Utilities/IpFunc/SubI.c +++ /dev/null @@ -1,269 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function subtracts two images - */ - -/** @brief subtracts two images - * - * @param pic_1 pointer to the first image - * @param pic_2 pointer to the second image - * @param keep tells whether the image type could be changed when - * necessary - * keep = : image data type could be changed - * keep = : image data type of original pictures is - * kept (if there will be an over-/underflow - * the max. or min. possible greyvalue is taken) - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the new image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncSubI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define SUBI( type_1, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpPicFORALL_3 ( SUBI2, pic_new, pic_1, pic_2, type_1 ); \ -} \ - -#define SUBI2( type_n, pic_new, pic_1, pic_2, type_1 ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type_n * ) pic_new->data ) [i] = \ - (( type_1 * ) pic_1->data ) [i] - \ - (( type_1 * ) pic_2->data ) [i]; \ - } \ -} - -#define SUBI3( type_n, pic_1, pic_2, pic_new ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - type_n help; \ - type_n help2; \ - \ - no_elem = _mitkIpPicElements ( pic_1 ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - help = (( type_n * ) pic_1->data ) [i]; \ - help2 = (( type_n * ) pic_2->data ) [i]; \ - (( type_n * ) pic_new->data ) [i] = \ - ( max_gv > ( mitkIpFloat8_t ) help - ( mitkIpFloat8_t ) help2 ) ? \ - (( min_gv < ( mitkIpFloat8_t ) help - ( mitkIpFloat8_t ) help2 ) ? \ - ( (type_n)help - (type_n)help2 ) : ( type_n ) min_gv ) :\ - ( type_n ) max_gv; \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncSubI ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* pointer to new image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - mitkIpFloat8_t min1, max1; /* extreme greyvalues of 1. image */ - mitkIpFloat8_t min2, max2; /* extreme greyvalues of 2. image */ - mitkIpFloat8_t smin, smax; /* product of extreme greyvalues */ - - - /* ckeck whether data are correct */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* check whether images have the same size */ - - if ( ( pic_1->type != pic_2->type ) || ( pic_1->bpe != pic_2->bpe ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - if ( pic_1->dim == pic_2->dim ) - for ( i = 0; i < _mitkIpPicNDIM; i++ ) - { - if ( pic_1->n[i] != pic_2->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncUNFIT_ERROR ); - return NULL; - } - - /* calculate max. and min. possible greyvalues for data type of images*/ - - if ( _mitkIpFuncExtT ( pic_1->type, pic_1->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - return ( mitkIpFuncERROR ); - - /* find out data type of new iamge */ - - if ( keep == mitkIpFuncKeep ) - { - pic_new = _mitkIpFuncMalloc ( pic_1, pic_return, mitkIpOVERWRITE ); - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - } - else if ( keep == mitkIpFuncNoKeep ) - { - /* calculate max. and min. greyvalues of both images */ - - if ( mitkIpFuncExtr ( pic_1, &min1, &max1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( mitkIpFuncExtr ( pic_2, &min2, &max2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - smax = max1 - max2; - smin = min1 - min2; - - /* change image type of images of type mitkIpPicInt */ - - if ( pic_1->type == mitkIpPicInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicUInt ) - { - if ( smax < max_gv && smin > min_gv ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - pic_new->type = mitkIpPicInt; - pic_new->bpe = 16; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - if ( smax > max_gv || smin < min_gv ) - { - pic_new->type = mitkIpPicFloat; - pic_new->bpe = 64; - _mitkIpFuncExtT ( pic_new->type, pic_new->bpe, &min_gv, &max_gv ); - } - } - } - - /* change image type of images of type mitkIpPicUInt */ - - else if ( pic_1->type == mitkIpPicFloat ) - { - pic_new = mitkIpPicCopyHeader ( pic_1, NULL ); - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - } - else - { - _mitkIpFuncSetErrno ( mitkIpFuncFLAG_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - if ( keep == mitkIpFuncNoKeep ) - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* macro to invert the picture (for all data types) */ - - if ( keep == mitkIpFuncNoKeep ) - mitkIpPicFORALL_2 ( SUBI, pic_1, pic_2, pic_new ) - else if ( keep == mitkIpFuncKeep ) - mitkIpPicFORALL_2 ( SUBI3, pic_1, pic_2, pic_new ) - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/Thresh.c b/Utilities/IpFunc/Thresh.c deleted file mode 100644 index c2edfc4f9e5..00000000000 --- a/Utilities/IpFunc/Thresh.c +++ /dev/null @@ -1,138 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function performs a thresholding operation with a single theshold - */ - -/** @brief performs a thresholding operation with a single theshold - - * All greyvalues above the threshold are set to the maximal possible - * greyvalue and all greyvalues below this threshold to the minimal greyvalue. - * @param pic_old pointer to the image that should be transformed - * @param threshold threshold - * @param pic_return memory used to store return image ( if pic_return == NULL - * new memory is allocated ) - * - * @return pointer to the transformed image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncThresh ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t threshold, - mitkIpPicDescriptor *pic_return ); - -#ifndef DOXYGEN_IGNORE - -/* definition of macro for normalisation */ - -#define THRESH( type, pic ) \ -{ \ - mitkIpUInt4_t i, no_elem; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - (( type * ) pic_new->data ) [i] = \ - ( (( type * ) pic->data ) [i] > ( type ) threshold ) ? \ - ( type ) 1 : ( type ) 0; \ - } \ -} - - -/* ------------------------------------------------------------------- */ -/* -** function picThresh: -** -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncThresh ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t threshold, - mitkIpPicDescriptor *pic_return ) -{ - - mitkIpPicDescriptor *pic_new; /* inverted picture */ - mitkIpFloat8_t max_gv; /* max. possible greyvalue */ - mitkIpFloat8_t min_gv; /* min. possible greyvalue */ - - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* calculate max. or min possible greyvalue for datatype */ - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) == mitkIpFuncERROR ) - return ( mitkIpFuncERROR ); - - /* test whether threshold is ok */ - - if ( threshold < min_gv || threshold > max_gv ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* create a new picture, copy the header, allocate memory */ - - pic_new = _mitkIpFuncMalloc ( pic_old, pic_return, mitkIpOVERWRITE ); - - if ( pic_new == NULL ) return ( mitkIpFuncERROR ); - - /* macro to invert the picture (for all data types) */ - - mitkIpPicFORALL( THRESH, pic_old ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return pic_new; -} -#endif - diff --git a/Utilities/IpFunc/Transpose.c b/Utilities/IpFunc/Transpose.c deleted file mode 100644 index 2eefa02b818..00000000000 --- a/Utilities/IpFunc/Transpose.c +++ /dev/null @@ -1,244 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this funtion transposes the image - */ - -/** @brief transposes the image, i.e. a permutation of the axes is performed - * - * - * @param pic pointer to picture - * @param pic_old pointer to old picture, which is not used in this version - * @param permutations_vector indicates the permutation - * @par Example 3 1 2 - * @arg third axis will be the first axis - * @arg first axis will be the second - * @arg second axis will be the third - * - * @return transposed image - * - * $Log$ - * Revision 1.3 2003/01/30 14:30:53 mark - * in Scale.c _mitkIpFuncScaleBL auskommentiert, wegen Fehler - * - * Revision 1.2 2000/05/24 15:29:43 tobiask - * Changed the installation paths of the package. - * - * Revision 1.4 2000/05/04 12:52:11 ivo - * inserted BSD style license - * - * Revision 1.3 2000/03/06 17:02:48 ivo - * ipFunc now with doxygen documentation. - * - * Revision 1.2 2000/02/18 14:58:08 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 1998/07/16 12:04:50 antje - * initial import - * - * Revision 1.1 1995/04/06 12:04:30 uli - * Initial revision - */ - -/* -** ipFunc includefiles -*/ -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncTranspose( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *permutations_vector ) -; -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncTranspose\tGerman Cancer Research Center (DKFZ) $Revision$ "__DATE__ }; -#endif - - - - -/* -** the action starts here -*/ -mitkIpPicDescriptor *mitkIpFuncTranspose( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *permutations_vector ) - -{ - mitkIpPicDescriptor *pic_return; - mitkIpUInt4_t size [_mitkIpPicNDIM]; - mitkIpUInt4_t r_size[_mitkIpPicNDIM]; - mitkIpUInt4_t index [_mitkIpPicNDIM]; - mitkIpUInt4_t **r_index; - mitkIpUInt4_t i; - mitkIpUInt4_t r_offset; - int default_perm = 0; - - - /* - ** - */ - if( !pic ) return( NULL ); - if ( pic->dim < 1 || pic->dim > _mitkIpPicNDIM) - return (NULL); - - - /* - ** create and initialize help vectors - */ - - /* - ** permutations_vector == NULL - ** default permutation (1234 -> 4321) - */ - if( permutations_vector == NULL ) - { - permutations_vector = (int *) malloc( - pic->dim * sizeof( int )); - if (!permutations_vector) - return (0); - - for(i=0; idim; i++ ) - permutations_vector[i] = pic->dim - i; - } - else - { - - int tmp[8]; - int error = 0; - for (i = 0; i < pic->dim; i++) - tmp[i] = 0; - for (i = 0; error == 0 && i < pic->dim; i++) - { - if( permutations_vector[i] > 0 ) - tmp[permutations_vector[i] - 1]++; - else - error = 1; - } - for (i = 0; error == 0 && i < pic->dim; i++) - if (tmp[i] != 1) - error = 1; - if (error == 1) - return (0); - } - - - /* - ** take over image header structure and allocate memory - */ - mitkIpPicFree( pic_old ); - pic_return = mitkIpPicCopyHeader( pic, NULL ); - if (!pic_return) - { - if (default_perm) - free ((void *) permutations_vector); - return (0); - } - - pic_return->data = malloc( _mitkIpPicSize(pic_return) ); - if (!pic_return->data) - { - if (default_perm) - free ((void *) permutations_vector); - mitkIpPicFree (pic_return); - return (0); - } - - - - /* - ** fill new dimension to pic_return - */ - for( i=0; idim; i++ ) - pic_return->n[i] = pic->n[ ( permutations_vector[i] - 1 ) ]; - - /* - ** fill size vectors for multiplication - */ - for( i=0; i<_mitkIpPicNDIM; i++) - { - size[i] = 0; - r_size[i] = 0; - } - r_size[0] = 1; - size[0] = 1; - for( i=1; idim; i++ ) - { - size[i] = size[i-1] * pic->n[i-1]; - r_size[i] = r_size[i-1] * pic_return->n[i-1]; - } - - - /* - ** index vectors - */ - r_index = (mitkIpUInt4_t **) malloc( _mitkIpPicNDIM * sizeof( mitkIpUInt4_t * ) ); - for( i=0; i<_mitkIpPicNDIM; i++) - r_index[i] = &( index[i] ); - for( i=0; idim; i++ ) - r_index[i] = &( index[ ( permutations_vector[i] - 1 ) ]); - - - /* - ** Makro for all for-loops and switches for all dimensions (1-8) - ** FOR ALL: dimensions, indizes, data types - */ - mitkIpPicFORALL_4( mitkIpFuncFORALL, pic, pic_return, index, r_offset, - for( r_offset = *(r_index[0]), i=1; idim; i++ ) - r_offset += *(r_index[i]) * r_size[i]; - ) - - - - - free( (void *) r_index ); - if (default_perm) free ((void *) permutations_vector); - - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_return, pic); - - return( pic_return ); -} -#endif diff --git a/Utilities/IpFunc/Var.c b/Utilities/IpFunc/Var.c deleted file mode 100644 index 229ccd7089c..00000000000 --- a/Utilities/IpFunc/Var.c +++ /dev/null @@ -1,116 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the variance of all greyvalues - * in an image - */ - -/** this function calculates the variance of all greyvalues - * in an image - * - * @param pic pointer to the image - * @param &max result variable: mean greyvalue - * - * @return mitkIpFuncERROR - if an error occured - * @return mitkIpFuncOK - if no error occures - * - * AUTHOR & DATE - */ - -/* include-files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic ); - -#ifndef DOXYGEN_IGNORE - -/* definition of extreme value macro */ - -#define MEAN_2( type, pic, mean, mean_2 ) \ - { \ - mitkIpUInt4_t i, no_elem; \ - \ - mean_2 = 0.; \ - \ - no_elem = _mitkIpPicElements ( pic ); \ - for ( i = 0; i < no_elem; i++ ) \ - { \ - mean_2 = ( ( ( type * ) pic->data ) [i] - mean ) * \ - ( ( ( type * ) pic->data ) [i] - mean ) + \ - mean_2; \ - } \ - } - -/* ========================================================== */ -/* -** function picVar : calculates the mean value (mean) -** of an image (pic) -*/ -/* ========================================================== */ - -mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic ) -{ - - mitkIpFloat8_t var; - mitkIpFloat8_t mean; - mitkIpFloat8_t mean_2; - - /* check image data */ - - if ( _mitkIpFuncError ( pic ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( _mitkIpPicElements ( pic ) == 1 ) - var = 0; - else - { - /* calculate mean value */ - - mean = mitkIpFuncMean ( pic ); - - mitkIpPicFORALL_2( MEAN_2, pic, mean, mean_2 ); - - var = mean_2 / ( mitkIpFloat8_t ) ( _mitkIpPicElements ( pic ) - 1 ); - } - - return( var ); -} -#endif diff --git a/Utilities/IpFunc/VarC.c b/Utilities/IpFunc/VarC.c deleted file mode 100644 index 959bd1c19c8..00000000000 --- a/Utilities/IpFunc/VarC.c +++ /dev/null @@ -1,217 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the variance of all greyvalues which are in - * a circle - */ - -/** @brief calculates the variance of all greyvalues which are in - * a circle - * - * @param pic_old pointer to the original image - * @param center pointer to an array that contains the coordinates of the center - * of the circle - * @param radius radius of the circle - * - * @return variance of the greyvalues which are included by the circle - * - * AUTHOR & DATE - */ -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncVarC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - - -#define VAR( type, pic, beg, end, size, center, radius ) \ -{ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - mitkIpUInt4_t dist[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - for ( ind[7] = beg[7] ; ind[7] < end[7]; ind[7]++ ) \ - { \ - dist[7] = ( ind[7] - center[7] ) * ( ind[7] - center[7] ); \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6] ; ind[6] < end[6]; ind[6]++ ) \ - { \ - dist[6] = ( ind[6] - center[6] ) * ( ind[6] - center[6] ) + dist[7]; \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5] ; ind[5] < end[5]; ind[5]++ ) \ - { \ - dist[5] = ( ind[5] - center[5] ) * ( ind[5] - center[5] ) + dist[6]; \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4] ; ind[4] < end[4]; ind[4]++ ) \ - { \ - dist[4] = ( ind[4] - center[4] ) * ( ind[4] - center[4] ) + dist[5]; \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3] ; ind[3] < end[3]; ind[3]++ ) \ - { \ - dist[3] = ( ind[3] - center[3] ) * ( ind[3] - center[3] ) + dist[4]; \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2] ; ind[2] < end[2]; ind[2]++ ) \ - { \ - dist[2] = ( ind[2] - center[2] ) * ( ind[2] - center[2] ) + dist[3]; \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1] ; ind[1] < end[1]; ind[1]++ ) \ - { \ - dist[1] = ( ind[1] - center[1] ) * ( ind[1] - center[1] ) +dist[2];\ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1]+beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - dist[0] = ( ind[0] - center[0] ) * ( ind[0] - center[0] )+dist[1];\ - if ( sqrt ( ( mitkIpFloat8_t ) dist[0] ) <= radius ) \ - { \ - mean2 = ( ( mitkIpFloat8_t )(( type * )pic->data )[off[0]] - mean ) *\ - ( ( mitkIpFloat8_t )(( type * )pic->data )[off[0]] - mean ) +\ - mean2; \ - count++; \ - } \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpFloat8_t mitkIpFuncVarC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ) -{ - mitkIpInt4_t help; - mitkIpUInt4_t i; /* loop index */ - mitkIpFloat8_t mean; - mitkIpFloat8_t mean2; - mitkIpFloat8_t var; - mitkIpUInt4_t count; - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of window */ - mitkIpUInt4_t begin[_mitkIpPicNDIM]; /* beginning of window */ - mitkIpUInt4_t centr[_mitkIpPicNDIM]; /* beginning of window */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( radius <= 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - help = center[i] - radius; - if ( help < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - else begin[i] = help; - - help = center[i] + radius; - if ( (mitkIpUInt4_t) help > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - else end[i] = help + 1; - - centr[i] = center[i]; - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - { - centr[i] = 0; - begin[i] = 0; - end[i] = 1; - } - - /* allocate image structure */ - - mean = mitkIpFuncMeanC ( pic_old, centr, radius ); - mean2 = 0; - count = 0; - - mitkIpPicFORALL_5 ( VAR, pic_old, begin, end, size, centr, radius ); - - if ( count == 1 ) - var = 0; - else - var = mean2 / ( count - 1 ); - - return ( var ); -} - -#endif diff --git a/Utilities/IpFunc/VarR.c b/Utilities/IpFunc/VarR.c deleted file mode 100644 index 796aa715427..00000000000 --- a/Utilities/IpFunc/VarR.c +++ /dev/null @@ -1,88 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the variance of all greyvalues included by a rectangle - */ - -/** @brief calculates the variance of all greyvalues included by a rectangle - * - * The rectangle is described by a vector with the coordinates of the - * upper left corner and a vector of its length in each direction - * - * @param pic_old pointer to original image - * @param begin vector with the beginning coordinates of the window - * @param length vector with the length of the window in each direction - * - * @return variance in window - * - * AUTHOR & DATE - */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncVarR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -mitkIpFloat8_t mitkIpFuncVarR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) -{ - - mitkIpFloat8_t var; /* variance */ - mitkIpPicDescriptor *pic_help; - - pic_help = mitkIpFuncWindow ( pic_old, begin, length ); - - var = mitkIpFuncVar ( pic_help ); - - mitkIpPicFree ( pic_help ); - - return ( var ); -} -#endif - diff --git a/Utilities/IpFunc/VarROI.c b/Utilities/IpFunc/VarROI.c deleted file mode 100644 index 2e7b087d3c3..00000000000 --- a/Utilities/IpFunc/VarROI.c +++ /dev/null @@ -1,263 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function calculates the variance of all pixels inside of a polygon - */ - -/** @brief calculates the variance of all pixels inside of a polygon - * - * The polygon is described by a sequence of points - * - * @param pic_old pointer to original image - * @param pol_x vector with the x-coordinates of the points which form - * form the roi - * @param pol_y vector with the y-coordinates of the points which form - * form the roi - * @param no_pts number of points used to describe ROI - * - * REMARKS - * this function could just be used for 2D images - * - * @return variance of all greyvalues in ROI - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpFloat8_t mitkIpFuncVarROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) ; - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncVarROI\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - -/*definition of macros */ - -#define MAX( x, y ) ( x > y ) ? x : y -#define MIN( x, y ) ( x < y ) ? x : y -#define ROI( type, pic, pic_help, sum, sum2, count ) \ -{ \ - mitkIpBool_t in; \ - mitkIpUInt4_t i, j; \ - mitkIpUInt4_t offset; \ - \ - for ( i = min_y; i <= max_y; i++ ) \ - { \ - in = mitkIpFalse; \ - offset = i * pic->n[0] + min_x; \ - for ( j = min_x; j <= max_x; j++ ) \ - { \ - if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( !in ) ) \ - in = mitkIpTrue; \ - else if ( (( mitkIpUInt1_t * )pic_help->data )[offset] && ( in ) ) \ - { \ - in = mitkIpFalse; \ - sum2 = sum2 + ((( type * )pic->data )[offset] - sum) *\ - ((( type * )pic->data )[offset] - sum); \ - count++; \ - } \ - \ - if ( in ) \ - { \ - sum2 = sum2 + ((( type * )pic->data )[offset] - sum) *\ - ((( type * )pic->data )[offset] - sum) +\ - count++; \ - } \ - offset++; \ - } \ - } \ -} - -/* -** mitkIpFuncMeanROI -*/ - -mitkIpFloat8_t mitkIpFuncVarROI ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ) -{ - mitkIpFloat8_t var; /* variance of greyvalues in ROI */ - mitkIpFloat8_t sum=0; /* sum of greyvalues in ROI */ - mitkIpFloat8_t sum2=0; /* sum of squared greyvalues in ROI*/ - mitkIpFloat8_t *a, *b; /* Gerade y = ax+b */ - mitkIpPicDescriptor *pic_help; /* contains edge of ROI */ - mitkIpUInt4_t min_x, max_x; /* min, max x-coordinate of ROI */ - mitkIpUInt4_t min_y, max_y; /* min, max y-coordinate of ROI */ - mitkIpUInt4_t i; /* loop variable */ - mitkIpUInt4_t count=0; /* number of pixels in ROI */ - mitkIpFloat8_t diff; /* difference between two points */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( pic_old->dim > 2 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* calculate min. and max. coordiantes of ROI */ - - min_x = pol_x[0]; - min_y = pol_y[0]; - max_x = pol_x[0]; - max_y = pol_y[0]; - for ( i = 1; i < no_pts; i++ ) - { - min_x = MIN ( min_x, pol_x[i] ); - min_y = MIN ( min_y, pol_y[i] ); - max_x = MAX ( max_x, pol_x[i] ); - max_y = MAX ( max_y, pol_y[i] ); - } - - /* check whether ROI is in image */ - - /* Expression is always false. - if ( min_x < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_x > pic_old->n[0] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Expression is always false. - if ( min_y < 0 ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - */ - - if ( max_y > pic_old->n[1] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* allocate memory for a and b */ - - a = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - if ( !a ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - b = ( mitkIpFloat8_t * ) malloc ( no_pts * sizeof ( mitkIpFloat8_t ) ); - if ( !b ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* Geraden zwischen zwei benachbarten Punkten berechnen */ - - for ( i = 0; i < no_pts-1; i++ ) - { - diff = ( mitkIpFloat8_t ) pol_x[i+1] - ( mitkIpFloat8_t ) pol_x[i]; - if ( diff ) - { - a[i] = ( ( mitkIpFloat8_t ) pol_y[i+1] - ( mitkIpFloat8_t ) pol_y[i] ) / diff; - b[i] = ( ( mitkIpFloat8_t ) pol_y[i] - a[i] * ( mitkIpFloat8_t )pol_x[i] ); - } - else - { - b[i] = 0.; - a[i] = 0.; - } - } - diff = ( mitkIpFloat8_t ) pol_x[no_pts-1] - ( mitkIpFloat8_t ) pol_x[0]; - if ( diff ) - { - a[no_pts-1] = ( ( mitkIpFloat8_t ) pol_y[no_pts-1] - ( mitkIpFloat8_t ) pol_y[0] ) / diff; - b[no_pts-1] = ( pol_y[no_pts-1] - a[no_pts-1] * pol_x[no_pts-1] ); - } - else - { - b[no_pts-1] = 0.; - a[no_pts-1] = 0.; - } - - /* Function to calculate mean */ - - sum = mitkIpFuncMeanROI ( pic_old, pol_x, pol_y, no_pts ); - - /* draw polygon to image */ - - pic_help = _mitkIpFuncDrawPoly ( pic_old, pol_x, pol_y, no_pts, a, b ); - if ( !pic_help ) - { - free ( a ); - free ( b ); - return ( mitkIpFuncERROR ); - } - - mitkIpPicFORALL_4 ( ROI, pic_old, pic_help, sum, sum2, count ); - - if ( count == 1 ) - var = 0; - else - var = sum2 / ( count - 1 ); - - free ( a ); - free ( b ); - mitkIpPicFree ( pic_help ); - - return ( var ); - -} - -#endif - diff --git a/Utilities/IpFunc/Window.c b/Utilities/IpFunc/Window.c deleted file mode 100644 index 7266665371f..00000000000 --- a/Utilities/IpFunc/Window.c +++ /dev/null @@ -1,204 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function copies a rectangular section of an image to a new one - */ - -/** @brief copies a rectangular section of an image to a new one - * - * @param pic_old pointer to the original image - * @param begin pointer to an array that contains the beginning of the - * section in each direction - * @param length pointer to an array that contains the length of the section - * in each direction - * - * @return pointer to the iamge with the section of the iamge - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncWindow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* definition of macros */ - - -#define WIND( type, pic, beg, end, size ) \ -{ \ - mitkIpUInt4_t offset; /* offset of pixels in pic_new */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - offset = 0; \ - for ( ind[7] = beg[7] ; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6] ; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5] ; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4] ; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3] ; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2] ; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1] ; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1]+beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[offset] = \ - (( type * ) pic->data ) [off[0]]; \ - off[0]++; \ - offset++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncWindow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of image */ - mitkIpUInt4_t beg[_mitkIpPicNDIM]; /* end of image */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - for ( i = 0; i < pic_old->dim; i++ ) - { - if ( begin[i] < 0 || begin[i] > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - beg[i] = begin[i]; - end[i] = begin[i] + length[i]; - if ( length[i] < 0 || end[i] > pic_old->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - size[pic_old->dim] = 0; - - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - { - beg[i] = 0; - end[i] = 1; - } - - /* allocate image structure */ - - pic_new = mitkIpPicNew ( ); - - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - - pic_new->dim = pic_old->dim; - pic_new->type = pic_old->type; - pic_new->bpe = pic_old->bpe; - for ( i = 0; i < pic_new->dim; i++ ) - pic_new->n[i] = length[i]; - pic_new->data = malloc ( _mitkIpPicSize ( pic_new ) ); - if ( pic_new->data == NULL ) - { - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - mitkIpPicFORALL_3 ( WIND, pic_old, beg, end, size ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - return ( pic_new ); -} - -#endif - diff --git a/Utilities/IpFunc/WindowR.c b/Utilities/IpFunc/WindowR.c deleted file mode 100644 index 6857acca5ce..00000000000 --- a/Utilities/IpFunc/WindowR.c +++ /dev/null @@ -1,204 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function copies an image to a specified position in another image - */ - -/** @brief copies an image to a specified position in another image - * - * @param pic_1 pointer to the image into which @a pic_2 should be inserted - * @param pic_2 pointer to image that should be inserted - * @param begin pointer to an array that contains the position at which - * @a pic_2 ist inserted to @a pic_1 - * - * @return pointer to the new iamge - * - * AUTHOR & DATE - */ - -/* include files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncWindowR ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpUInt4_t *begin, - mitkIpFuncFlagI_t keep ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - - - -/* definition of macros */ - - -#define WINDR( type, pic, beg, end, size ) \ -{ \ - mitkIpUInt4_t offset; /* offset of pixels in pic_new */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - offset = 0; \ - for ( ind[7] = beg[7] ; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = beg[6] ; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = beg[5] ; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = beg[4] ; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = beg[3] ; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = beg[2] ; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = beg[1] ; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1]+beg[0]; \ - for ( ind[0] = beg[0]; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[0]] = \ - (( type * ) pic->data ) [offset]; \ - off[0]++; \ - offset++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ -} - - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *mitkIpFuncWindowR ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpUInt4_t *begin, - mitkIpFuncFlagI_t keep ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpInt4_t i; /* loop index */ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of image */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_1 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - if ( _mitkIpFuncError ( pic_2 ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - if ( pic_1->dim != pic_2->dim ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDIM_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( pic_1->type != pic_2->type ) - { - _mitkIpFuncSetErrno ( mitkIpFuncTYPE_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( pic_1->bpe != pic_2->bpe ) - { - _mitkIpFuncSetErrno ( mitkIpFuncSIZE_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_1->dim; i++ ) - { - if ( begin[i] < 0 || begin[i] > pic_1->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - end[i] = begin[i] + pic_2->n[i]; - if ( end[i] > pic_1->n[i] ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - } - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_1->n[i-1]; - size[pic_1->dim] = 0; - - - for ( i = pic_1->dim; i < _mitkIpPicNDIM; i++ ) - { - begin[i] = 0; - end[i] = 1; - } - - /* allocate image structure */ - - if ( keep == mitkIpFuncKeep ) - pic_new = mitkIpPicClone ( pic_1 ); - else - pic_new = pic_1; - - mitkIpPicFORALL_3 ( WINDR, pic_2, begin, end, size ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_1); - - return ( pic_new ); -} -#endif - diff --git a/Utilities/IpFunc/Xchange.c b/Utilities/IpFunc/Xchange.c deleted file mode 100644 index 954529c7ee7..00000000000 --- a/Utilities/IpFunc/Xchange.c +++ /dev/null @@ -1,116 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * exchange of two image buffers - */ - -/** exchange of two image buffers - * - * @param pic1 pointer to pic descriptor - * @param pic2 pointer to pic descriptor - * - * - * @author Ulrike Guennel @date 07.7.1995 - * - * $Log$ - * Revision 1.3 2003/08/21 08:44:44 tobiask - * Removed warnings. - * - * Revision 1.2 2000/05/24 15:29:43 tobiask - * Changed the installation paths of the package. - * - * Revision 1.4 2000/05/04 12:52:11 ivo - * inserted BSD style license - * - * Revision 1.3 2000/04/04 11:57:10 ivo - * no message - * - * Revision 1.2 2000/02/18 14:58:09 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 1998/07/16 12:04:50 antje - * initial import - * - * Revision 1.1 1995/03/07 17:01:02 uli - * Initial revision - * - */ - - - /* -** ipFunc includefiles -*/ -#include "mitkIpFuncP.h" - -void mitkIpFuncXchange( mitkIpPicDescriptor **pic1, - mitkIpPicDescriptor **pic2 ); - -#ifndef DOXYGEN_IGNORE - -#ifndef lint - static char *what = { "@(#)mitkIpFuncXchange\tGerman Cancer Research Center (DKFZ) $Revision$ "__DATE__ }; -#endif - - -/* -** private macros -*/ - - -/* -** the action starts here -*/ -void mitkIpFuncXchange( mitkIpPicDescriptor **pic1, - mitkIpPicDescriptor **pic2 ) - -{ - - mitkIpPicDescriptor *tmp_pic; - - tmp_pic = *pic1; - *pic1 = *pic2; - *pic2 = tmp_pic; - - return; -} -#endif - diff --git a/Utilities/IpFunc/ZeroCr.c b/Utilities/IpFunc/ZeroCr.c deleted file mode 100644 index 16cbe59f437..00000000000 --- a/Utilities/IpFunc/ZeroCr.c +++ /dev/null @@ -1,201 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/**@file - * this function detects zero-crossings - */ - -/** @brief detects zero-crossings - * - * @param pic_old pointer to the image that should be transformed - * - * @return pointer to the transformed image - * - * AUTHOR & DATE - */ - -/* include-Files */ - -#include "mitkIpFuncP.h" - -mitkIpPicDescriptor *mitkIpFuncZeroCr ( mitkIpPicDescriptor *pic_old ) ; - -#ifndef DOXYGEN_IGNORE - -/* definition of macros */ - -#define ZERO( type, pic, size, off, n ) \ -{ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; \ - mitkIpUInt4_t i, j; \ - mitkIpInt4_t offset; \ - type help1, help2, help3, help; \ - \ - /* test whether there is a zero crossing in each direction */ \ - \ - for ( ind[7] = 1; ind[7] < n[7]; ind[7]++ ) \ - for ( ind[6] = 1; ind[6] < n[6]; ind[6]++ ) \ - for ( ind[5] = 1; ind[5] < n[5]; ind[5]++ ) \ - for ( ind[4] = 1; ind[4] < n[4]; ind[4]++ ) \ - for ( ind[3] = 1; ind[3] < n[3]; ind[3]++ ) \ - for ( ind[2] = 1; ind[2] < n[2]; ind[2]++ ) \ - for ( ind[1] = 1; ind[1] < n[1]; ind[1]++ ) \ - for ( ind[0] = 1; ind[0] < n[0]; ind[0]++ ) \ - { \ - offset = 0; \ - for ( i = 0; i < pic->dim; i++ ) \ - offset = offset + size[i] * ind[i]; \ - \ - i = 0; \ - help = (( type * )pic_new->data )[offset]; \ - help2 = ((type *)pic->data)[offset]; \ - while ( help == 0 && i < pic->dim ) \ - { \ - j = 2 * i; \ - help1 = ((type *)pic->data)[offset + off[j]];\ - help3 = ((type *)pic->data)[offset+off[j+1]];\ - \ - if ( help1 < 0 && help3 > 0 ) \ - { \ - if ( help2 > 0 && (help1 + help2) <=0 ) \ - help = ( type ) 1; \ - else if ( help2<=0 && (help2+help3) >0 )\ - help = ( type ) 1; \ - } \ - else if ( help1 > 0 && help3 < 0 ) \ - { \ - if ( help2 >= 0 && (help2 + help3) <0 ) \ - help = ( type ) 1; \ - else if ( help2<0 && (help1+help2) >=0 )\ - help = ( type ) 1; \ - } \ - i++; \ - } \ - (( type * )pic_new->data )[offset] = help; \ - \ - } \ -} - - - -/* ------------------------------------------------------------------- */ -/* -*/ -/* ------------------------------------------------------------------- */ - -mitkIpPicDescriptor *mitkIpFuncZeroCr ( mitkIpPicDescriptor *pic_old ) -{ - - mitkIpPicDescriptor *pic_new; /* convoluted image */ - mitkIpUInt4_t i, j; /* loopindex */ - mitkIpInt4_t size[_mitkIpPicNDIM]; - mitkIpUInt4_t n[_mitkIpPicNDIM]; - mitkIpInt4_t *off_vekt; /* offset vector */ - - /* check image data */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - /* initialisation of vectors */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_old->n[i-1]; - - for ( i = 0; i < pic_old->dim; i++ ) - n[i] = pic_old->n[i] - 1; - - for ( i = pic_old->dim; i < _mitkIpPicNDIM; i++ ) - n[i] = 2; - - /* allocate and calculate offset vector */ - - off_vekt = malloc ( 2 * pic_old->dim * sizeof ( mitkIpInt4_t ) ); - if ( off_vekt == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - for ( i = 0; i < pic_old->dim; i++ ) - { - j = 2 * i; - off_vekt[j] = - size[i]; - off_vekt[j+1] = size[i]; - } - - - /* create a new picture, copy the header, allocate memory */ - - pic_new = mitkIpPicCopyHeader ( pic_old, 0 ); - if ( pic_new == NULL ) - { - free ( off_vekt ); - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - free ( off_vekt ); - return ( mitkIpFuncERROR ); - } - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - if ( pic_new->data == NULL ) - { - free ( off_vekt ); - mitkIpPicFree ( pic_new ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - free ( off_vekt ); - return ( mitkIpFuncERROR ); - } - - - /* macro to convolute an image (for all data types) */ - - mitkIpPicFORALL_3 ( ZERO, pic_old, size, off_vekt, n ); - - free ( off_vekt ); - - /* Copy Tags */ - - mitkIpFuncCopyTags(pic_new, pic_old); - - - - - return pic_new; -} -#endif diff --git a/Utilities/IpFunc/_BorderX.c b/Utilities/IpFunc/_BorderX.c deleted file mode 100644 index a797a3f39f3..00000000000 --- a/Utilities/IpFunc/_BorderX.c +++ /dev/null @@ -1,258 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * mitkIpFuncBorder - *--------------------------------------------------------------------- - * DESCRIPTION - * - * FUNCTION DECLARATION - * - * PARAMETERS - * - * RETURN VALUES - * - * AUTHOR & DATE - * Antje Schroeder 27.07.95 - * - * UPDATES - * $Log$ - * Revision 1.4 2000/08/02 20:09:05 tobiask - * Made some corrections in _BorderX.c - * - * Revision 1.3 2000/07/24 13:06:26 ivo - * June 26, 2000 - * iw - function mitkIpFuncSetTag added. - * - * July 8, 2000 - * iw - Visual C++ 6.0 SP3 compiler crashes at "static char *what..." lines. - * Workaround: "lint" defined in project files for all configurations. - * - * July 11, 2000 - * iw - ipFunc.exe Scale crashed, if last parameter was missing. Corrected. - * - * Revision 1.2 2000/05/24 15:29:44 tobiask - * Changed the installation paths of the package. - * - * Revision 1.3 2000/05/04 12:52:11 ivo - * inserted BSD style license - * - * Revision 1.2 2000/02/18 14:58:09 ivo - * Tags are now copied into newly allocated images. - * Bugs fixed in mitkIpFuncFrame, mitkIpFuncRegGrow, _mitkIpFuncBorderX and mitkIpFuncHitMiss. - * - * Revision 1.1.1.1 2000/02/18 15:40:34 ivo - * the dimension sizes n[i] that are not used must be set to zero, - * otherwise the macro BORDER may crash. This is now done in the else- - * part of "if ( pic_new == NULL )" (first two rows). - * - *--------------------------------------------------------------------- - */ -#ifndef lint - static char *what = { "@(#)????????\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - -/* definition of macros */ - - -#define BORDER( type, pic, size, value ) \ -{ \ - mitkIpUInt4_t i; /* loop index */ \ - mitkIpUInt4_t anf[_mitkIpPicNDIM]; /* */ \ - mitkIpUInt4_t ind[_mitkIpPicNDIM]; /* loop index vector */ \ - mitkIpUInt4_t off[_mitkIpPicNDIM]; /* used to calculate offset of image pixels */ \ - \ - \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = pic->n[i]; \ - } \ - for ( i = pic->dim; i < _mitkIpPicNDIM; i++ ) \ - { \ - anf[i] = 0; \ - end[i] = 1; \ - pic->n[i] = 1; \ - } \ - for ( i = 0; i < pic->dim; i++ ) \ - { \ - anf[i] = pic->n[i] - edge[i]; \ - end[i] = edge[i]; \ - for ( ind[7] = 0; ind[7] < end[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = 0; ind[6] < end[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = 0; ind[5] < end[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = 0; ind[4] < end[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = 0; ind[3] < end[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = 0; ind[2] < end[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = 0; ind[1] < end[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - for ( ind[0] = 0; ind[0] < end[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[1]] = ( type ) value; \ - off[1]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - for ( ind[7] = anf[7]; ind[7] < pic->n[7]; ind[7]++ ) \ - { \ - off[7] = size[7] * ind[7]; \ - for ( ind[6] = anf[6]; ind[6] < pic->n[6]; ind[6]++ ) \ - { \ - off[6] = size[6] * ind[6] + off[7]; \ - for ( ind[5] = anf[5]; ind[5] < pic->n[5]; ind[5]++ ) \ - { \ - off[5] = size[5] * ind[5] + off[6]; \ - for ( ind[4] = anf[4]; ind[4] < pic->n[4]; ind[4]++ ) \ - { \ - off[4] = size[4] * ind[4] + off[5]; \ - for ( ind[3] = anf[3]; ind[3] < pic->n[3]; ind[3]++ ) \ - { \ - off[3] = size[3] * ind[3] + off[4]; \ - for ( ind[2] = anf[2]; ind[2] < pic->n[2]; ind[2]++ ) \ - { \ - off[2] = size[2] * ind[2] + off[3]; \ - for ( ind[1] = anf[1]; ind[1] < pic->n[1]; ind[1]++ ) \ - { \ - off[1] = size[1] * ind[1] + off[2]; \ - off[0] = off[1] + anf[0]; \ - for ( ind[0] = anf[0]; ind[0] < pic->n[0]; ind[0]++ ) \ - { \ - (( type * ) pic_new->data )[off[0]] = ( type ) value; \ - off[0]++; \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - end[i] = pic->n[i]; \ - anf[i] = 0; \ - } \ -} - -/* ------------------------------------------------------------------------------ */ -/* -*/ -/* ------------------------------------------------------------------------------ */ - -mitkIpPicDescriptor *_mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ) -{ - mitkIpPicDescriptor *pic_new; /* pointer to transformed image */ - mitkIpUInt4_t i; /* loop index */ - mitkIpUInt4_t end[_mitkIpPicNDIM]; /* end of image */ - mitkIpUInt4_t size[_mitkIpPicNDIM]; /* */ - mitkIpFloat8_t max_gv, min_gv; - - /* check whether data are correct */ - - if ( _mitkIpFuncError ( pic_old ) != mitkIpFuncOK ) return ( mitkIpFuncERROR ); - - pic_new = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_new == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - else - { - for ( i = pic_new->dim; i < _mitkIpPicNDIM; i++ ) - pic_new->n[i] = 0; - - for ( i = 0; i < pic_old->dim; i++ ) - pic_new->n[i] = pic_old->n[i] + 2 * edge[i]; - pic_new->data = calloc ( _mitkIpPicElements ( pic_new ), pic_new->bpe/8 ); - if ( pic_new->data == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - mitkIpPicFree ( pic_new ); - return ( mitkIpFuncERROR ); - } - } - - - if ( _mitkIpFuncExtT ( pic_old->type, pic_old->bpe, &min_gv, &max_gv ) != mitkIpFuncOK ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - if ( ( value > max_gv ) || ( value < min_gv ) ) - { - _mitkIpFuncSetErrno ( mitkIpFuncDATA_ERROR ); - return ( mitkIpFuncERROR ); - } - - - /* initialize vectors and variables */ - - size[0] = 1; - for ( i = 1; i < _mitkIpPicNDIM; i++ ) - size[i] = size[i-1] * pic_new->n[i-1]; - size[pic_new->dim] = 0; - - mitkIpPicFORALL_2 ( BORDER, pic_new, size, value ) - - return ( pic_new ); -} diff --git a/Utilities/IpFunc/_DrawPoly.c b/Utilities/IpFunc/_DrawPoly.c deleted file mode 100644 index dedc848416d..00000000000 --- a/Utilities/IpFunc/_DrawPoly.c +++ /dev/null @@ -1,278 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * - *--------------------------------------------------------------------- - * DESCRIPTION - * this function draws the edge of an ROI to an image - * - * FUNCTION DECLARATION - * mitkIpPicDescriptor *_mitkIpFuncDrawPoly( mitkIpPicDescriptor *pic_old, - * mitkIpUInt4_t *pol_x, - * mitkIpUInt4_t *pol_y, - * mitkIpUInt4_t no_pts, - * mitkIpFloat8_t *a, - * mitkIpFloat8_t *b); - * - * PARAMETERS - * pic_old - pointer to original image - * pol_x - vector with the x-coordinates of the points which form - * form the roi - * pol_y - vector with the y-coordinates of the points which form - * form the roi - * no_pts - number of points used to describe ROI - * a - - * b - - * - * REMARKS - * this function could just be used for 2D images - * - * RETURN VALUES - * pic_help - image with roi - * - * AUTHOR & DATE - * Antje Schroeder 08.11.95 - * - * UPDATES - * a short history of the file - * - *--------------------------------------------------------------------- - */ -#ifndef lint - static char *what = { "@(#)_mitkIpFuncDrawPoly\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__ }; -#endif - -/* include files */ - -#include "mitkIpFuncP.h" - - -/* -------------------------------------------------------------------- */ - -/* -** mitkIpFuncDrawPoly -*/ - -mitkIpPicDescriptor *_mitkIpFuncDrawPoly ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts, - mitkIpFloat8_t *a, - mitkIpFloat8_t *b ) -{ - - mitkIpPicDescriptor *pic_help; - mitkIpUInt4_t i, j; - mitkIpUInt4_t y; - mitkIpUInt4_t beg, end; - - /* allocate memory for pic help */ - - pic_help = mitkIpPicCopyHeader ( pic_old, NULL ); - if ( pic_help == NULL ) - { - _mitkIpFuncSetErrno ( mitkIpFuncPICNEW_ERROR ); - return ( mitkIpFuncERROR ); - } - pic_help->type = mitkIpPicUInt; - pic_help->bpe = 8; - pic_help->data = calloc ( _mitkIpPicElements ( pic_help ), pic_help->bpe / 8 ); - if ( pic_help->data == NULL ) - { - mitkIpPicFree ( pic_help ); - _mitkIpFuncSetErrno ( mitkIpFuncMALLOC_ERROR ); - return ( mitkIpFuncERROR ); - } - - /* draw polygon to pic_help */ - - for ( i = 0; i < no_pts-1; i++ ) - { - if ( pol_x[i] == pol_x[i+1] ) - { - if ( pol_y[i] < pol_y[i+1] ) - { - beg = pol_y[i]; - end = pol_y[i+1]; - } - else - { - end = pol_y[i]; - beg = pol_y[i+1]; - } - for ( j = beg; j < end; j++ ) - (( mitkIpUInt1_t * )pic_help->data )[ j * pic_help->n[1] + pol_x[i]] = 100; - } - else - { - if ( pol_x[i] < pol_x[i+1] ) - { - beg = pol_x[i]; - end = pol_x[i+1]; - } - else - { - end = pol_x[i]; - beg = pol_x[i+1]; - } - if ( pol_y[i] == pol_y[i+1] ) end = beg -1; - - for ( j = beg; j <= end; j++ ) - { - y = a[i] * j + b[i]; - (( mitkIpUInt1_t * )pic_help->data )[ y * pic_help->n[1] + j ] = 100; - } - } - - if ( pol_y[i] == pol_y[i+1] ) - { - if ( pol_x[i] < pol_x[i+1] ) - { - beg = pol_x[i]; - end = pol_x[i+1]; - } - else - { - end = pol_x[i]; - beg = pol_x[i+1]; - } - - for ( j = beg; j < end; j++ ) - (( mitkIpUInt1_t * )pic_help->data )[ j + pic_help->n[1] * pol_y[i]] = 100; - } - else - { - if ( pol_y[i] < pol_y[i+1] ) - { - beg = pol_y[i]; - end = pol_y[i+1]; - } - else - { - end = pol_y[i+1]; - beg = pol_y[i]; - } - if ( pol_x[i] == pol_x[i+1] ) end = beg - 1; - - for ( j = beg; j <= end; j++ ) - { - y = ( j - b[i] ) / a[i]; - (( mitkIpUInt1_t * )pic_help->data )[ j * pic_help->n[1] + y ] = 100; - } - } - } - - if ( pol_x[no_pts-1] == pol_x[0] ) - { - if ( pol_y[no_pts-1] < pol_y[0] ) - { - beg = pol_y[no_pts-1]; - end = pol_y[0]; - } - else - { - end = pol_y[no_pts-1]; - beg = pol_y[0]; - } - - for ( j = beg; j < end; j++ ) - (( mitkIpUInt1_t * )pic_help->data )[ j * pic_help->n[1] + pol_x[no_pts-1]] = 100; - } - else - { - if ( pol_x[no_pts-1] < pol_x[0] ) - { - beg = pol_x[no_pts-1]; - end = pol_x[0]; - } - else - { - end = pol_x[no_pts-1]; - beg = pol_x[0]; - } - if ( pol_y[no_pts-1] == pol_y[0] ) end = beg -1; - - for ( j = beg; j <= end; j++ ) - { - y = a[no_pts-1] * j + b[no_pts-1]; - (( mitkIpUInt1_t * )pic_help->data )[ y * pic_help->n[1] + j ] = 100; - } - } - - if ( pol_y[no_pts-1] == pol_y[0] ) - { - if ( pol_x[no_pts-1] < pol_x[0] ) - { - beg = pol_x[no_pts-1]; - end = pol_x[0]; - } - else - { - end = pol_x[no_pts-1]; - beg = pol_x[0]; - } - - for ( j = beg; j < end; j++ ) - (( mitkIpUInt1_t * )pic_help->data )[ j + pic_help->n[1] * pol_y[no_pts-1]] = 100; - } - else - { - if ( pol_y[no_pts-1] < pol_y[0] ) - { - beg = pol_y[no_pts-1]; - end = pol_y[0]; - } - else - { - end = pol_y[no_pts-1]; - beg = pol_y[0]; - } - if ( pol_x[no_pts-1] == pol_x[0] ) end = beg - 1; - - for ( j = beg; j <= end; j++ ) - { - y = ( j - b[no_pts-1] ) / a[no_pts-1]; - (( mitkIpUInt1_t * )pic_help->data )[ j * pic_help->n[1] + y ] = 100; - } - } - - return ( pic_help ); -} diff --git a/Utilities/IpFunc/files.cmake b/Utilities/IpFunc/files.cmake deleted file mode 100644 index 72153f8becf..00000000000 --- a/Utilities/IpFunc/files.cmake +++ /dev/null @@ -1,105 +0,0 @@ -set(CPP_FILES - AddC.c - AddI.c - AddSl.c - And.c - Border.c - BorderX.c - Box.c - Box2d.c - Box3d.c - Canny.c - Close.c - CompressM.c - Conv.c - Convert.c - CopyTags.c - Curtosis.c - CurtosisR.c - Dila.c - DivC.c - DivI.c - DrawPoly.c - Equal.c - Ero.c - Error.c - Exp.c - ExtT.c - ExtrC.c - ExtrR.c - ExtrROI.c - Extrema.c - FillArea.c - Frame.c - GaussF.c - Grad.c - Grav.c - Hist.c - Histo.c - HitMiss.c - HitMissI.c - Inertia.c - Inv.c - LN.c - Label.c - Laplace.c - LevWind.c - Log.c - MakePicName.c - Malloc.c - Mean.c - MeanC.c - MeanF.c - MeanR.c - MeanROI.c - Median.c - Morph.c - MultC.c - MultI.c - Norm.c - NormXY.c - Not.c - OpCl.c - Open.c - Or.c - Pot.c - Range.c - Rank.c - Refl.c - RegGrow.c - Roberts.c - Rotate.c - SDev.c - SDevC.c - SDevR.c - SDevROI.c - ScBl.c - ScFact.c - ScNN.c - Scale.c - SelInv.c - SelMM.c - Select.c - SetErrno.c - SetTag.c - Shp.c - Skewness.c - SkewnessR.c - Sobel.c - Sqrt.c - SubC.c - SubI.c - Thresh.c - Transpose.c - Var.c - VarC.c - VarR.c - VarROI.c - Window.c - WindowR.c - Xchange.c - ZeroCr.c - _BorderX.c - _DrawPoly.c - ipGetANew.c -) diff --git a/Utilities/IpFunc/gradient.h b/Utilities/IpFunc/gradient.h deleted file mode 100644 index a4e348bfda7..00000000000 --- a/Utilities/IpFunc/gradient.h +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - mitkIpInt2_t mask2[] = - { 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1 }; - - mitkIpInt2_t mask3[] = - { 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - -mitkIpInt2_t mask4[] = - { 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - 1, 1, 1, 0, 0, 0, -1, -1, -1, - - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - 1, 0, -1, 1, 0, -1, 1, 0, -1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1 }; diff --git a/Utilities/IpFunc/ipAdministrative.h b/Utilities/IpFunc/ipAdministrative.h deleted file mode 100644 index e6b4eb3921a..00000000000 --- a/Utilities/IpFunc/ipAdministrative.h +++ /dev/null @@ -1,80 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Administrative Functions - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -char *mitkIpFuncMakePicName ( char *pic_name, char *extension ); - -void mitkIpFuncCopyTags(mitkIpPicDescriptor *pic_new, mitkIpPicDescriptor *pic_old); - -mitkIpPicDescriptor *mitkIpFuncConvert( mitkIpPicDescriptor *pic_old, - mitkIpPicType_t type, - mitkIpUInt4_t bpe ); - -void mitkIpFuncXchange ( mitkIpPicDescriptor **pic1, - mitkIpPicDescriptor **pic2 ); - -void mitkIpFuncPError ( char *string ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipArithmeticAndLogical.h b/Utilities/IpFunc/ipArithmeticAndLogical.h deleted file mode 100644 index d4a8cb41cd9..00000000000 --- a/Utilities/IpFunc/ipArithmeticAndLogical.h +++ /dev/null @@ -1,128 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Arithmetic and Logical Operators. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpPicDescriptor *mitkIpFuncInv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncEqual ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSubC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncMultC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncDivC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncMultI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncDivI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddSl ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t keep ); - -mitkIpPicDescriptor *mitkIpFuncSubI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAnd ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncOr ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncNot ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipFunc.c b/Utilities/IpFunc/ipFunc.c deleted file mode 100644 index df281b7aa0d..00000000000 --- a/Utilities/IpFunc/ipFunc.c +++ /dev/null @@ -1,1366 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* include files */ - -#include "mitkIpFuncP.h" - -#ifdef _WIN32 -#define strcasecmp _stricmp -#define PATH_MAX 255 -#endif - -/* main function */ - -int -main (int argc, char **argv) -{ - /* variables */ - - mitkIpPicDescriptor *pic_new=NULL; /* image descriptors */ - mitkIpPicDescriptor *pic_ret=NULL; /* image descriptors */ - mitkIpPicDescriptor *pic_hlp=NULL; /* image descriptors */ - mitkIpPicDescriptor *pic_old=NULL; /* image descriptors */ - mitkIpPicDescriptor *pic_mask=NULL; /* convolution mask */ - mitkIpPicDescriptor *mask_1=NULL, *mask_2=NULL; /* convolution mask */ - char operation[PATH_MAX]; /* image processing operation */ - char pic_name[PATH_MAX]; /* file name of original image */ - char pic_name_t[PATH_MAX]; /* file name of transformed im. */ - char mask_name[PATH_MAX]; /* file name of transformed im. */ - char error_nr[PATH_MAX]; /* file name of transformed im. */ - mitkIpPicType_t type; - mitkIpUInt4_t range; /* result of range function */ - mitkIpUInt4_t no_label; - mitkIpUInt4_t border; /* handling of the borders */ - mitkIpUInt4_t rank; /* */ - mitkIpUInt4_t keep; /* */ - mitkIpUInt4_t radius; /* */ - mitkIpUInt4_t *begin; /* start of window */ - mitkIpUInt4_t *length; /* length of window */ - mitkIpUInt4_t len_mask; /* length of mask */ - mitkIpUInt4_t dim_mask; /* dimension of mask */ - mitkIpInt4_t axis; /* reflection axis */ - mitkIpUInt4_t i; - mitkIpFloat8_t min, max; /* extreme greyvalues */ - mitkIpFloat8_t min_gv, max_gv; /* extreme greyvalues */ - mitkIpFloat8_t gv_low, gv_up; /* */ - mitkIpFloat8_t threshold; - mitkIpFloat8_t value; /* value that is added to image */ - mitkIpFloat8_t mean; /* mean greyvalue */ - mitkIpFloat8_t var; /* variance of greyvalues */ - mitkIpFloat8_t gv; /* new greyvalue */ - mitkIpFloat8_t s_der; /* standard derivation */ - mitkIpFloat8_t *sc; /* standard derivation */ - int *perm; /* permutation vector for transpose */ - mitkIpFloat8_t *grav; /* center of gravity */ - mitkIpFloat8_t *inertia, *ev; - mitkIpUInt4_t *hist; /* greylevel histogram */ - mitkIpUInt4_t size_hist; /* no. of elements in histogram */ - mitkIpUInt4_t mask_size; /* size of transformation mask */ - mitkIpBool_t picput_flag=mitkIpTrue; /* */ - int *grad, *order; - - /* input of operation and image file name */ - - - if ( ((unsigned int) argc == 1) || ( ((unsigned int) argc == 2 ) && (strcasecmp (argv[1], "-h") == 0))) - { - printf("Usage: ipFunc operation infile outfile parameterlist\n"); - printf(" Arithmetic: AddC, AddI, DivC, DivI, MultC, MultI, SubC, SubI\n"); - printf(" Logic: And, Not, Or\n"); - printf(" Geometric: Refl, Rotate, Scale, Transpose, Window, WindowR\n"); - printf(" Point: Equal, Exp, Inv, LevWin, LN, Log, Norm, NormY\n"); - printf(" Pot, Select, SelInv, SelMM, Sqrt, Thresh, ZeroCr\n"); - printf(" Locale: Canny, Conv, GaussF, Grad, Laplace, Mean\n"); - printf(" Rank, Roberts, Shp, Sobel\n"); - printf(" Morpho: Close, Dila, Ero, Open\n"); - printf(" Statistic: Extr, ExtrC, ExtrR, ExtrROI, Mean, MeanC, MeanR\n"); - printf(" MeanROI, Median, SDev, SDevC, SDevR, SDevROI\n"); - printf(" Var, VarC, VarR, VarROI\n"); - printf(" Segmentation: Label, RegGrow\n"); - printf(" Misc: Border, BorderX, DrawPoly, Frame, Convert, MakeMorphSquareMask\n"); - exit(1); - } - - strcpy ( operation , argv[1]); - if( ((unsigned int) argc != 2) && (strcasecmp (argv[2], "-h") != 0)) - { - strcpy ( pic_name, argv[2]); - pic_old = mitkIpPicGet ( pic_name, NULL ); - pic_ret = pic_old; - if ( pic_old == NULL ) - { - printf("could not open file\n"); - exit(1); - } - } - if ( strcasecmp ( operation, "Inv" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " usage: ipFunc Inv infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncInv ( pic_old, pic_ret ); - } - else if ( strcasecmp ( operation, "Label" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Label infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncLabel ( pic_old, &no_label ); - printf ("Number of Labels: %d \n", no_label ); - } - else if ( strcasecmp ( operation, "RegGrow" ) == 0 ) - { - mitkIpUInt4_t blabel, rlabel, kind; - - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim * 2 + 8 ) ) - { - printf ( " usage: ipFunc RegGrow infile outfile beg_seed1...beg_seedn end_seed1...end_seedn border_label region_label std_dev_factor(double!!) kind(0=show border,1=show region)\n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - printf ( " %d %d %d %d %d %d \n", begin[0], begin[1], begin[2], length[0], length[1], length[2] ); - - sscanf ( argv[4+pic_old->dim*2], "%d", &blabel ); - sscanf ( argv[5+pic_old->dim*2], "%d", &rlabel ); - s_der=atof(argv[6+pic_old->dim*2]); - sscanf ( argv[7+pic_old->dim*2], "%d", &kind ); - - pic_new = mitkIpFuncRegGrow ( pic_old, pic_old->dim, begin, length, blabel, rlabel, s_der, kind ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "Convert" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc convert infile outfile type bpe \n"); - printf("type must be given as number\n"); - printf("type: mitkIpPicInt = 3\n"); - printf(" mitkIpPicUInt = 4\n"); - printf(" mitkIpPicFloat = 5\n"); - exit(1); - } - sscanf ( argv[4],"%d", &rank ); - sscanf ( argv[5],"%d", &range ); - type = rank; - pic_new = mitkIpFuncConvert ( pic_old, rank, range ); - } - else if ( strcasecmp ( operation, "Refl" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Refl infile outfile axis \n"); - printf("axis must be given as number\n"); - printf(" x-axis = 0\n"); - printf(" y-axis = 1\n"); - printf(" z-axis = 2\n"); - exit(1); - } - sscanf ( argv[4], "%d", &axis ); - pic_new = mitkIpFuncRefl ( pic_old, axis ); - } - else if ( strcasecmp ( operation, "Sqrt" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Sqrt infile outfile \n" ); - exit ( 1 ); - } - keep = mitkIpFuncKeep; - pic_new = mitkIpFuncSqrt ( pic_old, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "Pot" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Pot infile outfile exponent \n"); - exit(1); - } - keep = mitkIpFuncKeep; - sscanf ( argv[4], "%lf", &value ); - pic_new = mitkIpFuncPot ( pic_old, value, keep, pic_ret ); - printf ( " Fehler : %d \n", mitkIpFuncErrno ); - } - else if ( strcasecmp ( operation, "DivC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc DivC infile outfile value \n"); - exit(1); - } - keep = mitkIpFuncKeep; - sscanf ( argv[4], "%lf", &value ); - pic_new = mitkIpFuncDivC ( pic_old, value, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "MultC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc MultC infile outfile value \n"); - exit(1); - } - keep = mitkIpFuncKeep; - sscanf ( argv[4], "%lf", &value ); - pic_new = mitkIpFuncMultC ( pic_old, value, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "SubC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc SubC infile outfile value \n"); - exit(1); - } - keep = mitkIpFuncKeep; - sscanf ( argv[4], "%lf", &value ); - pic_new = mitkIpFuncSubC ( pic_old, value, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "AddC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc AddC infile outfile value \n"); - exit(1); - } - keep = mitkIpFuncKeep; - sscanf ( argv[4], "%lf", &value ); - pic_new = mitkIpFuncAddC ( pic_old, value, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "AddSl" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 ) ) - { - printf("Usage: ipFunc AddSl infile outfile \n"); - exit(1); - } - keep = mitkIpFuncKeep; - pic_new = mitkIpFuncAddSl ( pic_old, keep ); - } - else if ( strcasecmp ( operation, "DivI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc DivI infile outfile image \n"); - exit(1); - } - keep = mitkIpFuncKeep; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncDivI ( pic_old, pic_hlp, keep, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "MultI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc MultI infile outfile image \n"); - exit(1); - } - keep = mitkIpFuncKeep; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncMultI ( pic_old, pic_hlp, keep, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "AddI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc AddI infile outfile image \n"); - exit(1); - } - keep = mitkIpFuncKeep; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncAddI ( pic_old, pic_hlp, keep, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "SubI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc SubI infile outfile image \n"); - exit(1); - } - keep = mitkIpFuncKeep; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncSubI ( pic_old, pic_hlp, keep, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "Or" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Or infile outfile image \n"); - exit(1); - } - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncOr ( pic_old, pic_hlp, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "And" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc And infile outfile image \n"); - exit(1); - } - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - if ( pic_hlp != NULL ) - pic_new = mitkIpFuncAnd ( pic_old, pic_hlp, pic_ret ); - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "Not" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Not infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncNot ( pic_old, NULL ); - } - else if ( strcasecmp ( operation, "Close" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Close infile outfile mask \n"); - printf(" mask must be the name of a PIC-file containing the mask \n" ); - exit(1); - } - border = mitkIpFuncBorderZero; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_mask = mitkIpPicGet ( mask_name, NULL ); - mitkIpPicPut ( "Test.mask", pic_mask ); - if ( pic_mask != NULL ) - { - pic_new = mitkIpFuncClose( pic_old, pic_mask, border ); - mitkIpPicFree ( pic_mask ); - } - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "Open" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Open infile outfile mask \n"); - printf(" mask must be the name of a PIC-file containing the mask \n" ); - exit(1); - } - border = mitkIpFuncBorderZero; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_mask = mitkIpPicGet ( mask_name, NULL ); - if ( pic_mask != NULL ) - { - pic_new = mitkIpFuncOpen ( pic_old, pic_mask, border ); - mitkIpPicFree ( pic_mask ); - } - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "Dila" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Dila infile outfile mask \n"); - printf(" mask must be the name of a PIC-file containing the mask \n" ); - exit(1); - } - border = mitkIpFuncBorderZero; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_mask = mitkIpPicGet ( mask_name, NULL ); - if ( pic_mask != NULL ) - { - pic_new = mitkIpFuncDila ( pic_old, pic_mask, border ); - mitkIpPicFree ( pic_mask ); - } - else - printf ( " iamge doesn't exist \n" ); - } - else if ( strcasecmp ( operation, "Ero" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Ero infile outfile mask \n"); - printf(" mask must be the name of a PIC-file containing the mask \n" ); - exit(1); - } - border = mitkIpFuncBorderZero; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_mask = mitkIpPicGet ( mask_name, NULL ); - if ( pic_mask != NULL ) - { - pic_new = mitkIpFuncEro ( pic_old, pic_mask, border ); - mitkIpPicFree ( pic_mask ); - } - else - printf ( " iamge doesn't exist \n" ); - } - /* else if ( strcasecmp ( operation, "hitmiss" ) == 0 ) - { - strcpy ( mask_name, "" ); - printf ( " mask name 1 : " ); - scanf ( "%s", mask_name ); - mask_1 = mitkIpPicGet ( mask_name, NULL ); - if ( mask_1 != NULL ) - { - pic_new = mitkIpFuncHitMissI( pic_old, mask_1, mitkIpFuncBorderZero ); - mitkIpPicFree ( mask_1 ); - } - else - printf ( " iamge doesn't exist \n" ); - }*/ - else if ( strcasecmp ( operation, "Scale" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim + 5 ) ) - { - printf("Usage: ipFunc Scale infile outfile sc_fact1 ... sc_factn kind \n"); - printf(" sc_factx must contain a positive float number \n" ); - printf(" kind describes the interpolation used to scale :\n" ); - printf(" next neighbour : 7 \n" ); - printf(" bilinear : 6 \n" ); - exit(1); - } - sc = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpFloat8_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - { - sscanf ( argv[4+i], "%lf", &sc[i] ); - } - sscanf ( argv[4+pic_old->dim], "%d", &keep ); - pic_new = mitkIpFuncScale ( pic_old, sc, keep ); - pic_ret = NULL; - free(sc); - } - else if ( strcasecmp ( operation, "Transpose" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim + 4 ) ) - { - printf("Usage: ipFunc Transpose infile outfile perm_1 ... perm_n \n"); - printf(" perm_1 ... perm_n must be a permutation vector, e.g., 4 2 1 3 \n" ); - exit(1); - } - perm = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpFloat8_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - { - sscanf ( argv[4+i], "%d", &perm[i] ); - } - pic_new = mitkIpFuncTranspose ( pic_old, NULL, perm ); - pic_ret = NULL; - free(perm); - } - else if ( strcasecmp ( operation, "Roberts" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Roberts infile outfile dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncRoberts ( pic_old, dim_mask, border ); - } - else if ( strcasecmp ( operation, "GaussF" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc GaussF infile outfile len_mask dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &len_mask ); - sscanf ( argv[5], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncGausF ( pic_old, len_mask, dim_mask, border ); - } - else if ( strcasecmp ( operation, "Canny" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 7 ) ) - { - printf("Usage: ipFunc Canny infile outfile len_mask dim_mask threshold \n"); - exit(1); - } - sscanf ( argv[4], "%d", &len_mask ); - sscanf ( argv[5], "%d", &dim_mask ); - sscanf ( argv[6], "%lf", &threshold ); - border = 3; - if ( pic_new != NULL ) mitkIpPicFree ( pic_new ); - pic_new = mitkIpFuncCanny ( pic_old, dim_mask, len_mask, - threshold, border ); - } - else if ( strcasecmp ( operation, "Rank" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 7 ) ) - { - printf("Usage: ipFunc Rank infile outfile len_mask dim_mask rank \n"); - exit(1); - } - sscanf ( argv[4], "%d", &len_mask ); - sscanf ( argv[5], "%d", &dim_mask ); - sscanf ( argv[6], "%d", &rank ); - border = 3; - pic_new = mitkIpFuncRank ( pic_old, rank, dim_mask, len_mask, border ); - } - else if ( strcasecmp ( operation, "MeanF" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc MeanF infile outfile len_mask dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &len_mask ); - sscanf ( argv[5], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncMeanF ( pic_old, len_mask, dim_mask, border ); - } - else if ( strcasecmp ( operation, "Shp" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc Shp infile outfile len_mask dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &len_mask ); - sscanf ( argv[5], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncShp ( pic_old, dim_mask, border, len_mask ); - } - else if ( strcasecmp ( operation, "Laplace" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Laplace infile outfile dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncLaplace ( pic_old, dim_mask, border ); - } - else if ( strcasecmp ( operation, "Sobel" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Sobel infile outfile dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncSobel ( pic_old, dim_mask, border ); - } - else if ( strcasecmp ( operation, "Grad" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Grad infile outfile dim_mask \n"); - exit(1); - } - sscanf ( argv[4], "%d", &dim_mask ); - border = 3; - pic_new = mitkIpFuncGrad ( pic_old, dim_mask, border ); - } - else if ( strcasecmp ( operation, "Thresh" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Thresh infile outfile threshold \n"); - exit(1); - } - sscanf ( argv[4], "%lf", &threshold ); - pic_new = mitkIpFuncThresh ( pic_old, threshold, pic_ret ); - } - else if ( strcasecmp ( operation, "Conv" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 5 ) ) - { - printf("Usage: ipFunc Conv infile outfile mask \n"); - printf(" mask must be the name of a PIC-file containing the mask \n" ); - exit(1); - } - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - border = mitkIpFuncBorderZero; - - pic_mask = mitkIpPicGet ( mask_name, NULL ); - if ( pic_mask != NULL ) - { - pic_new = mitkIpFuncConv ( pic_old, pic_mask, border ); - mitkIpPicFree ( pic_mask ); - } - } - else if ( strcasecmp ( operation, "ZeroCr" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc ZeroCr infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncZeroCr ( pic_old ); - } - else if ( strcasecmp ( operation, "Exp" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Exp infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncExp ( pic_old, mitkIpFuncMinMax, pic_ret ); - } - else if ( strcasecmp ( operation, "Log" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Log infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncLog ( pic_old ); - } - else if ( strcasecmp ( operation, "LN" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc LN infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncLN ( pic_old ); - } - else if ( strcasecmp ( operation, "Norm" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Norm infile outfile \n" ); - exit ( 1 ); - } - pic_new = mitkIpFuncNorm ( pic_old, pic_ret ); - } - else if ( strcasecmp ( operation, "NormXY" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc NormXY infile outfile lower_value upper_value\n"); - exit(1); - } - sscanf ( argv[4],"%lf", &min_gv ); - sscanf ( argv[5],"%lf", &max_gv ); - pic_new = mitkIpFuncNormXY ( pic_old, min_gv, max_gv, pic_ret ); - } - else if ( strcasecmp ( operation, "Equal" ) == 0 ) - { - if ( (unsigned int) argc != 4 ) - { - printf ( " ipFunc Equal infile outfile \n" ); - exit ( 1 ); - } - keep = mitkIpFuncMinMax; - pic_new = mitkIpFuncEqual ( pic_old, keep, pic_ret ); - } - else if ( strcasecmp ( operation, "Extr" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Extr infile \n" ); - exit ( 1 ); - } - mitkIpFuncExtr ( pic_old, &min, &max ); - picput_flag = mitkIpFalse; - printf ( " min: %12.2lf max: %12.2lf \n", min, max ); - } -#ifdef MESCHACH - else if ( strcasecmp ( operation, "Inertia" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Inertia infile \n" ); - exit ( 1 ); - } - mitkIpFuncInertia ( pic_old, &inertia, &ev ); - picput_flag = mitkIpFalse; - for ( i = 0; i < pic_old->dim; i++ ) - printf ( " eigenvalue[%d] = %lf \n", i, ev[i] ); - for ( i = 0; i < pic_old->dim * pic_old->dim; i++ ) - printf ( " inertia[%d] = %lf \n", i, inertia[i] ); - } -#endif - else if ( strcasecmp ( operation, "Grav" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Grav infile \n" ); - exit ( 1 ); - } - grav = mitkIpFuncGrav ( pic_old ); - picput_flag = mitkIpFalse; - for ( i = 0; i < pic_old->dim; i++ ) - printf ( " center of gravity[%d] = %lf \n", i, grav[i] ); - } - else if ( strcasecmp ( operation, "Median" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Median infile \n" ); - exit ( 1 ); - } - mean = mitkIpFuncMedI ( pic_old ); - printf ( " median: %lf\n", mean ); - } - else if ( strcasecmp ( operation, "Mean" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Mean infile \n" ); - exit ( 1 ); - } - mean = mitkIpFuncMean ( pic_old ); - printf ( " mean: %lf\n", mean ); - } - else if ( strcasecmp ( operation, "Var" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc Var infile \n" ); - exit ( 1 ); - } - var = mitkIpFuncVar ( pic_old ); - printf ( " variance : %lf\n", var ); - } - else if ( strcasecmp ( operation, "SDev" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " ipFunc SDev infile \n" ); - exit ( 1 ); - } - s_der = mitkIpFuncSDev ( pic_old ); - printf ( " standard derivation : %lf\n", s_der ); - } - else if ( strcasecmp ( operation, "SelMM" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc SelMM infile outfile lower_value upper_value \n"); - exit(1); - } - sscanf ( argv[4], "%lf", &gv_low ); - sscanf ( argv[5], "%lf", &gv_up ); - pic_new = mitkIpFuncSelMM ( pic_old, gv_low, gv_up, pic_ret ); - } - /* - else if ( strcasecmp ( operation, "sel_mm_inv" ) == 0 ) - { - printf ( " lower greyvalue : " ); - scanf ( "%lf", &gv_low ); - printf ( " upper greyvalue : " ); - scanf ( "%lf", &gv_up ); - printf ( " lower greyvalue (new): " ); - scanf ( "%lf", &gv_new_low ); - printf ( " upper greyvalue (new): " ); - scanf ( "%lf", &gv_new_up ); - pic_new = mitkIpFuncSelMM_Inv ( pic_old, gv_low, gv_up, gv_new_low, gv_new_up, pic_ret ); - } - */ - else if ( strcasecmp ( operation, "Select" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 7 ) ) - { - printf("Usage: ipFunc Select infile outfile lower_value upper_value new_value\n"); - exit(1); - } - sscanf ( argv[4], "%lf", &gv_low ); - sscanf ( argv[5], "%lf", &gv_up ); - sscanf ( argv[6], "%lf", &gv ); - pic_new = mitkIpFuncSelect ( pic_old, gv_low, gv_up, gv, pic_ret ); - } - else if ( strcasecmp ( operation, "SelInv" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 7 ) ) - { - printf("Usage: ipFunc SelInv infile outfile lower_value upper_value new_value\n"); - exit(1); - } - sscanf ( argv[4], "%lf", &gv_low ); - sscanf ( argv[5], "%lf", &gv_up ); - sscanf ( argv[6], "%lf", &gv ); - pic_new = mitkIpFuncSelInv ( pic_old, gv_low, gv_up, gv, pic_ret ); - } - else if ( strcasecmp ( operation, "LevWin" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf("Usage: ipFunc LevWin infile outfile level window \n" ); - exit(1); - } - sscanf ( argv[4], "%lf", &gv_low ); - sscanf ( argv[5], "%lf", &gv_up ); - pic_new = mitkIpFuncLevWin ( pic_old, gv_low, gv_up, pic_ret ); - } - else if ( strcasecmp ( operation, "Box" ) == 0 ) - { - if ( ( (unsigned int) argc != 3 ) || ( strcasecmp (argv[2], "-h") == 0 ) ) - { - printf ( " usage: ipFunc Box infile \n" ); - exit ( 1 ); - } - picput_flag = mitkIpFalse; length=NULL; - mitkIpFuncBox ( pic_old, &begin, &length ); - for ( i =0; i < pic_old->dim; i++ ) - printf ( " [%d]\t links oben %d \t\t rechts unten: %d \n", i, begin[i], length[i] ); - } - else if ( strcasecmp ( operation, "BorderX" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim + 5 ) ) - { - printf ( " usage: ipFunc BorderX infile outfile edge1...edgen value\n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - { - sscanf ( argv[4+i], "%d", &begin[i] ); - } - sscanf ( argv[4+pic_old->dim], "%lf", &value ); - pic_mask = mitkIpPicNew (); - pic_mask->type = 3; - pic_mask->bpe = 16; - pic_mask->dim = pic_old->dim; - for ( i = 0; i < pic_old->dim; i++ ) - pic_mask->n[i] = begin[i] *2 + 1; - pic_new = mitkIpFuncBorderX ( pic_old, pic_mask, value, NULL ); - mitkIpPicFree ( pic_mask ); - free ( begin ); - } - else if ( strcasecmp ( operation, "Frame" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim + 5 ) ) - { - printf ( " usage: ipFunc Edge infile outfile edge1...edgen value\n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - { - sscanf ( argv[4+i], "%d", &begin[i] ); - } - sscanf ( argv[4+pic_old->dim], "%lf", &value ); - pic_new = mitkIpFuncFrame ( pic_old, begin, value ); - free ( begin ); - } - else if ( strcasecmp ( operation, "WindowR" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim + 5 ) ) - { - printf ( " usage: ipFunc WindowR infile outfile image beg1...begn \n" ); - exit ( 1 ); - } - keep = mitkIpFuncKeep; - strcpy ( mask_name, "" ); - sscanf ( argv[4], "%s", mask_name ); - pic_hlp = mitkIpPicGet ( mask_name, NULL ); - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - { - sscanf ( argv[5+i], "%d", &begin[i] ); - } - pic_new = mitkIpFuncWindowR ( pic_old, pic_hlp, begin, mitkIpFuncNoKeep ); - free ( begin ); - } - else if ( strcasecmp ( operation, "Rotate" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim * 2 + 4 ) ) - { - printf ( " usage: ipFunc Rotate infile outfile grad1...gradn order1...ordern \n" ); - exit ( 1 ); - } - grad = malloc ( _mitkIpPicNDIM * sizeof ( int ) ); - order = malloc ( _mitkIpPicNDIM * sizeof ( int ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &grad[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &order[i] ); - pic_new = mitkIpFuncRotate ( pic_old, NULL, grad, order ); - free ( grad ); - free ( order ); - } - else if ( strcasecmp ( operation, "Window" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != pic_old->dim * 2 + 4 ) ) - { - printf ( " usage: ipFunc Window infile outfile beg1...begn length1...lengthn \n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - printf ( " %d %d %d %d %d %d \n", begin[0], begin[1], begin[2], length[0], length[1], length[2] ); - pic_new = mitkIpFuncWindow ( pic_old, begin, length ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "DrawPoly" ) == 0 ) - { - /* - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 2 * pic_old->dim + 5 ) ) - */ - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) ) - { - printf ( " usage: ipFunc Window infile outfile nr_points x1...xn y1...yn \n" ); - exit ( 1 ); - } - sscanf ( argv[4], "%d", &radius ); - begin = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < radius; i++ ) - sscanf ( argv[5+i], "%d", &begin[i] ); - for ( i = 0; i < radius; i++ ) - sscanf ( argv[5+radius+i], "%d", &length[i] ); - pic_new = mitkIpFuncDrawPoly ( pic_old, begin, length, radius ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "MeanROI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim * 2 ) ) - { - printf ( " usage: ipFunc MeanROI infile nr_points x1...xn y1...yn \n" ); - exit ( 1 ); - } - sscanf ( argv[3], "%d", &radius ); - begin = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - mean = mitkIpFuncMeanROI ( pic_old, begin, length, radius ); - printf ( " mean: %lf \n", mean ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "VarROI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim * 2 ) ) - { - printf ( " usage: ipFunc VarROI infile nr_points x1...xn y1...yn \n" ); - exit ( 1 ); - } - sscanf ( argv[3], "%d", &radius ); - begin = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncVarROI ( pic_old, begin, length, radius ); - printf ( " var: %lf \n", var ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "SDevROI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim * 2 ) ) - { - printf ( " usage: ipFunc SDevROI infile nr_points x1...xn y1...yn \n" ); - exit ( 1 ); - } - sscanf ( argv[3], "%d", &radius ); - begin = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncSDevROI ( pic_old, begin, length, radius ); - printf ( " var: %lf \n", var ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "ExtrROI" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim * 2 ) ) - { - printf ( " usage: ipFunc ExtrROI infile nr_points x1...xn y1...yn \n" ); - exit ( 1 ); - } - sscanf ( argv[3], "%d", &radius ); - begin = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( radius * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+pic_old->dim+i], "%d", &length[i] ); - mitkIpFuncExtrROI ( pic_old, &min, &max, begin, length, radius ); - printf ( " min: %lf max: %lf\n", min, max ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "VarR" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 3 + 2 * pic_old->dim ) ) - { - printf ( " usage: ipFunc VarR infile beg1...begn length1...lengthn \n" ); - exit ( 1 ); - } - begin = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncVarR ( pic_old, begin, length ); - printf ( " var: %lf \n", var ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "SDevR" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 3 + 2 * pic_old->dim ) ) - { - printf ( " usage: ipFunc SDevR infile beg1...begn length1...lengthn \n" ); - exit ( 1 ); - } - begin = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncVarR ( pic_old, begin, length ); - s_der = mitkIpFuncSDevR ( pic_old, begin, length ); - printf ( " s_der: %lf \n", s_der ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "MeanR" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 3 + 2 * pic_old->dim ) ) - { - printf ( " usage: ipFunc MeanR infile beg1...begn length1...lengthn \n" ); - exit ( 1 ); - } - begin = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncVarR ( pic_old, begin, length ); - mean = mitkIpFuncMeanR ( pic_old, begin, length ); - printf ( " mean: %lf \n", mean ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "ExtrR" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 3 + 2 * pic_old->dim ) ) - { - printf ( " usage: ipFunc ExtrR infile beg1...begn length1...lengthn \n" ); - exit ( 1 ); - } - begin = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - length = malloc ( pic_old->dim * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+i], "%d", &begin[i] ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[3+pic_old->dim+i], "%d", &length[i] ); - var = mitkIpFuncVarR ( pic_old, begin, length ); - mitkIpFuncExtrR ( pic_old, &min, &max, begin, length ); - printf ( " min: %lf max: %lf \n", min, max ); - free ( begin ); - free ( length ); - } - else if ( strcasecmp ( operation, "SDevC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim ) ) - { - printf ( " usage: ipFunc SDevR infile radius begin1...beginn \n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - sscanf ( argv[3], "%d", &radius ); - s_der = mitkIpFuncSDevC ( pic_old, begin, radius ); - printf ( " s_dev: %lf \n", s_der ); - free ( begin ); - } - else if ( strcasecmp ( operation, "VarC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim ) ) - { - printf ( " usage: ipFunc VarC infile radius begin1...beginn \n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - sscanf ( argv[3], "%d", &radius ); - var = mitkIpFuncVarC ( pic_old, begin, radius ); - printf ( " var: %lf \n", var ); - free ( begin ); - } - else if ( strcasecmp ( operation, "MeanC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim ) ) - { - printf ( " usage: ipFunc MeanC infile radius begin1...beginn \n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - sscanf ( argv[4+i], "%d", &begin[i] ); - sscanf ( argv[3], "%d", &radius ); - mean = mitkIpFuncMeanC ( pic_old, begin, radius ); - printf ( " mean: %lf \n", mean ); - free ( begin ); - } - else if ( strcasecmp ( operation, "ExtrC" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 4 + pic_old->dim ) ) - { - printf ( " usage: ipFunc ExtrC infile radius begin1...beginn \n" ); - exit ( 1 ); - } - begin = malloc ( _mitkIpPicNDIM * sizeof ( mitkIpUInt4_t ) ); - for ( i = 0; i < pic_old->dim; i++ ) - scanf ( argv[4+i], "%d", &begin[i] ); - sscanf ( argv[3], "%d", &radius ); - mitkIpFuncExtrC ( pic_old, &min, &max, begin, radius ); - printf ( " min: %lf max: %lf \n", min, max ); - free ( begin ); - } - else if ( strcasecmp ( operation, "MakeMorphSquareMask" ) == 0 ) - { - if ( ( (unsigned int) argc == 2 ) || - ( ( (unsigned int) argc == 3 ) && ( strcasecmp (argv[2], "-h") == 0 ) ) || - ( (unsigned int) argc != 6 ) ) - { - printf ( " usage: ipFunc MakeMorphSquareMask infile outfile dim size\n" ); - exit ( 1 ); - } - sscanf ( argv[4], "%d", &dim_mask ); - sscanf ( argv[5], "%d", &mask_size ); - - pic_new=mitkIpPicCopyHeader(pic_old,NULL); - pic_new->dim=dim_mask; - for ( i = 0; i < pic_old->dim; i++ ) - pic_new->n[i]=mask_size; - pic_new->data = calloc ( _mitkIpPicSize(pic_new), 1 ); - mitkIpFuncAddC(pic_new, 1.0, mitkIpFuncKeep, pic_new); - } - else - printf ( " illegal operation \n" ); - - - if ( mitkIpFuncErrno > mitkIpOK ) - { - mitkIpFuncPError ( error_nr ); - exit ( 1 ); - } - if ( ( pic_new != 0 ) && ( picput_flag ) ) - { - strcpy ( pic_name_t, argv[3] ); - mitkIpPicPut ( pic_name_t, pic_new ); - picput_flag = mitkIpTrue; - } - - - if ( pic_ret ) - { - mitkIpPicFree ( pic_ret ); - pic_old = NULL; - pic_ret = NULL; - pic_new = NULL; - } - else - { - if ( pic_old != NULL ) mitkIpPicFree ( pic_old ); - pic_old = NULL; - if ( pic_new != NULL ) mitkIpPicFree ( pic_new ); - pic_new = NULL; - if ( pic_hlp != NULL ) mitkIpPicFree ( pic_hlp ); - pic_hlp = NULL; - } - - return 0; -} - diff --git a/Utilities/IpFunc/ipFunc.dox b/Utilities/IpFunc/ipFunc.dox deleted file mode 100644 index fb21dbba852..00000000000 --- a/Utilities/IpFunc/ipFunc.dox +++ /dev/null @@ -1,408 +0,0 @@ -# Doxyfile 0.49-990829 - -# This file describes the settings to be used by doxygen for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of word surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = ipFunc - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.6.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ../doc - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Dutch, French, Italian, Czech, Swedish, German and Japanese - -OUTPUT_LANGUAGE = English - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# If the EXTRACT_ALL tag is set to YES all classes and functions will be -# included in the documentation, even if no documentation was available. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members inside documented classes or files. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all -# undocumented classes. - -HIDE_UNDOC_CLASSES = YES - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# If the FULL_PATH_NAMES tag is set to YES Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. - -STRIP_FROM_PATH = - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a class diagram (in Html and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. - -CLASS_DIAGRAMS = YES - -# If the SOURCE_BROWSER tag is set to YES than the body of a member or -# function will be appended as a block of code to the documentation of. -# that member or function. - -SOURCE_BROWSER = NO - -# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen -# will only generate file names in lower case letters. If set to -# YES upper case letters are also allowed. This is useful if you have -# classes or files whose names only differ in case and if your file system -# supports case sensitive file names. - -CASE_SENSE_NAMES = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -# If the JAVADOC_NO_AUTOBRIEF is set to YES (the default) then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the Javadoc-style will -# behave just like the Qt-style comments. - -JAVADOC_AUTOBRIEF = YES - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . mitkIpFunc.h ipArithmeticAndLogical.h ipGeometrical.h ipLocal.h ipStatistical.h ipMorphological.h ipPointOperators.h ipAdministrative.h - - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -FILE_PATTERNS = *.c - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -GENERATE_RTF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. - -MACRO_EXPANSION = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = DOXYGEN_IGNORE - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED tag. - -EXPAND_ONLY_PREDEF = NO - -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES tag can be used to specify one or more tagfiles. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO - -# The CGI_NAME tag should be the name of the CGI script that -# starts the search engine (doxysearch) with the correct parameters. -# A script with this name will be generated by doxygen. - -CGI_NAME = search.cgi - -# The CGI_URL tag should be the absolute URL to the directory where the -# cgi binaries are located. See the documentation of your http daemon for -# details. - -CGI_URL = - -# The DOC_URL tag should be the absolute URL to the directory where the -# documentation is located. If left blank the absolute path to the -# documentation, with file:// prepended to it, will be used. - -DOC_URL = - -# The DOC_ABSPATH tag should be the absolute path to the directory where the -# documentation is located. If left blank the directory on the local machine -# will be used. - -DOC_ABSPATH = - -# The BIN_ABSPATH tag must point to the directory where the doxysearch binary -# is installed. - -BIN_ABSPATH = /usr/local/bin/ - -# The EXT_DOC_PATHS tag can be used to specify one or more paths to -# documentation generated for other projects. This allows doxysearch to search -# the documentation for these projects as well. - -EXT_DOC_PATHS = - diff --git a/Utilities/IpFunc/ipGeometrical.h b/Utilities/IpFunc/ipGeometrical.h deleted file mode 100644 index 2ce7016844d..00000000000 --- a/Utilities/IpFunc/ipGeometrical.h +++ /dev/null @@ -1,117 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Geometrical Operators. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpUInt4_t mitkIpFuncBox ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ); - -mitkIpPicDescriptor *mitkIpFuncRefl ( mitkIpPicDescriptor *pic_old, - mitkIpInt4_t axis ); - -mitkIpPicDescriptor *mitkIpFuncFrame ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ); - -mitkIpPicDescriptor *mitkIpFuncBorder ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpFloat8_t value, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncScale ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t sc_fact[_mitkIpPicNDIM], - mitkIpFuncFlagI_t sc_kind ); - -mitkIpPicDescriptor *mitkIpFuncScFact ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t factor, - mitkIpFuncFlagI_t sc_kind ); - -mitkIpPicDescriptor *mitkIpFuncWindow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpPicDescriptor *mitkIpFuncWindowR( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpUInt4_t *begin, - mitkIpFuncFlagI_t keep ); - -mitkIpPicDescriptor *mitkIpFuncRotate ( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *grad, int *order ); - -mitkIpPicDescriptor *mitkIpFuncTranspose( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *permutations_vector); - -mitkIpPicDescriptor *mitkIpFuncDrawPoly( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipGetANew.c b/Utilities/IpFunc/ipGetANew.c deleted file mode 100644 index 4bb0c2b504b..00000000000 --- a/Utilities/IpFunc/ipGetANew.c +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -#include "mitkIpFuncP.h" - -mitkIpUInt4_t _ipGetANew( mitkIpUInt4_t aNew[], mitkIpUInt4_t Index) -{ -mitkIpUInt4_t NewIndex; - - /* return original Index */ - if (aNew[Index] == Index) return (Index); - - for (;;) - { - NewIndex = aNew[Index]; - if (NewIndex == aNew[NewIndex]) return(NewIndex); - Index = NewIndex; - } -} diff --git a/Utilities/IpFunc/ipLocal.h b/Utilities/IpFunc/ipLocal.h deleted file mode 100644 index 3c778e7398c..00000000000 --- a/Utilities/IpFunc/ipLocal.h +++ /dev/null @@ -1,114 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Local Operators. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpPicDescriptor *mitkIpFuncConv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncGausF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncCanny ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFloat8_t threshold, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncRank ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t rank, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncMeanF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncShp ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border, - mitkIpUInt4_t mask_nr ); - -mitkIpPicDescriptor *mitkIpFuncLaplace( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncSobel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncGrad ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncRoberts( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipMorphological.h b/Utilities/IpFunc/ipMorphological.h deleted file mode 100644 index 697d84cf8c5..00000000000 --- a/Utilities/IpFunc/ipMorphological.h +++ /dev/null @@ -1,104 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Morphological Operators. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpPicDescriptor *mitkIpFuncEro ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncDila ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncOpen ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncClose ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncHitMiss( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncLabel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *no_label ); - -mitkIpPicDescriptor *mitkIpFuncRegGrow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_seed, - mitkIpUInt4_t *beg_seed, - mitkIpUInt4_t *end_seed, - mitkIpUInt4_t border_label, - mitkIpUInt4_t region_label, - mitkIpFloat8_t std_fact, - mitkIpUInt4_t kind ); - -mitkIpPicDescriptor *mitkIpFuncDrawPoly( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipPointOperators.h b/Utilities/IpFunc/ipPointOperators.h deleted file mode 100644 index 6971f809ad6..00000000000 --- a/Utilities/IpFunc/ipPointOperators.h +++ /dev/null @@ -1,135 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Point-Operators. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpPicDescriptor *mitkIpFuncInv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncEqual ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - - -mitkIpPicDescriptor *mitkIpFuncPot ( mitkIpPicDescriptor *pic_1, - mitkIpFloat8_t exponent, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSqrt ( mitkIpPicDescriptor *pic_1, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncThresh ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t threshold, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncZeroCr ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncExp ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncLN ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncLog ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncNorm ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncNormXY ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSelInv ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSelect ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSelMM ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncLevWin ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t level, - mitkIpFloat8_t window, - mitkIpPicDescriptor *pic_return ); - -void mitkIpFuncXchange ( mitkIpPicDescriptor **pic1, - mitkIpPicDescriptor **pic2 ); - -mitkIpPicDescriptor *mitkIpFuncConvert( mitkIpPicDescriptor *pic_old, - mitkIpPicType_t type, - mitkIpUInt4_t bpe ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/ipStatistical.h b/Utilities/IpFunc/ipStatistical.h deleted file mode 100644 index 847d51a9a8f..00000000000 --- a/Utilities/IpFunc/ipStatistical.h +++ /dev/null @@ -1,169 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * Operators to calculate statistical values. - * This header is for grouping purposes for the - * documentation only. Don't use it, use mitkIpFunc.h instead. - */ - -#ifndef DOXYGEN_IGNORE -#include -#endif - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* function prototypes */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -mitkIpUInt4_t mitkIpFuncBox ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ); - -mitkIpFloat8_t mitkIpFuncMedI ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncMean ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncSDev ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t *mitkIpFuncGrav ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncMeanC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpFloat8_t mitkIpFuncVarC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpFloat8_t mitkIpFuncSDevC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpUInt4_t mitkIpFuncExtrC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -mitkIpFloat8_t mitkIpFuncMeanROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncVarROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncSDevROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncSkewness ( mitkIpPicDescriptor *pic ); - -mitkIpFloat8_t mitkIpFuncCurtosis ( mitkIpPicDescriptor *pic ); - -mitkIpFloat8_t mitkIpFuncSkewnessR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -double mitkIpFuncCurtosisR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpUInt4_t mitkIpFuncExtrROI( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncMeanR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpFloat8_t mitkIpFuncVarR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpFloat8_t mitkIpFuncSDevR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpUInt4_t mitkIpFuncExtrR ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpUInt4_t mitkIpFuncRange ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up ); - -mitkIpInt4_t mitkIpFuncExtr ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max ); - -mitkIpInt4_t mitkIpFuncInertia ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t **eigen_vect, - mitkIpFloat8_t **eigen_val ); - -mitkIpInt4_t mitkIpFuncHist ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/mitkIpFunc.h b/Utilities/IpFunc/mitkIpFunc.h deleted file mode 100644 index cec8e1266c3..00000000000 --- a/Utilities/IpFunc/mitkIpFunc.h +++ /dev/null @@ -1,581 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * contains the function prototypes, type definitions and - * includes for the image processing functions - */ - -/** @mainpage - * @section QuickReference Quick Reference - * - * @link mitkIpFunc.h List of all functions @endlink - * - * @link ipArithmeticAndLogical.h Arithmetic and Logical Operators @endlink - * - * @link ipGeometrical.h Geometrical Operators @endlink - * - * @link ipLocal.h Local Operators @endlink - * - * @link ipStatistical.h Operators to calculate statistical values @endlink - * - * @link ipMorphological.h Morphological Operators @endlink - * - * @link ipPointOperators.h Point-Operators @endlink - * - * @link ipAdministrative.h Administrative Functions @endlink - - * @section Introduction Introduction - * - * This library contains a huge set of image processing functions. It includes - * operators of the following classes: - * @arg Arithmetical and logical operators. This class contains as well functions - * to add, subtract, divide or multiply two images or images and constants - * as functions to connect two images using the logical "and" or "or" operator. - * @arg Operators to transform the greyvalue of each pixel indepently of its surrounding - * pixels. In this class operators for brightness correction, contrast - * correction or to fade out single greyvalues are included - * @arg Local operators which use the surrounding pixel for the transformation. - * This could be a convolution or a filtering operation to detect edges or to - * perform a smoothing. - * @arg Geometrical functions which change the geometrie of the image like a - * rotation, a reflection, a transposition or a scaling. - * @arg Operators to calculate statistical values. The extreme greyvalues, the - * mean, the variance or the standard deviation of all greyvalues in an image - * or a region of interest (rectangle, circle or an area included by a polygon) - * are calculated. - * @arg Segmentation functions to find objects in an image. - * @arg Morphological operators which change the shape of the the objects - * shown in an image. This could be a dilation, an erosion, an opening or a - * closing. - * All images and convolution masks needed in theses functions have to be stored - * in the PIC image format. Because this image format allows to handle images of - * different datatypes and images of up to eight dimensions, the functions could - * be used to transform all these different kind of images. - * - * There's also an executable included to invoke the image processing functions from the - * command line. - * - * @section Installation Installation - * @subsection PlatformIndependent Platform Independent - * There is a platform independent tmake-makefile called ipFunc.pro. You need to get - * the free tmake-utility to use it from @htmlonly ftp://ftp.troll.no/freebies/tmake/ @endhtmlonly. - * - * @subsection Windows Windows - * The library as well as the executable are precomiled using the Microsoft Developer Studio 6.0: - * libipFuncD.lib and ipFunc.exe. The corresponding project file is ipFunc.dsw. - * - * @subsection Unix Unix - * There is a makefile, which should work on most unix platforms. There is also a special - * makefile for Sun Solaris. -*/ - -#ifndef _mitkIpFunc_h -#define _mitkIpFunc_h - -/* include files */ - -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#include -#else -#include -#include -#include -#endif -#include -/* - Diese Datei wird in der mitkIpFuncP.h includet - #include -*/ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -/* definition of constants */ - -#define mitkIpFuncERROR 0 -#define mitkIpFuncOK 1 -#define mitkIpFuncNOPIC_ERROR 2 -#define mitkIpFuncDIM_ERROR 3 -#define mitkIpFuncSIZE_ERROR 4 -#define mitkIpFuncFLAG_ERROR 5 -#define mitkIpFuncMALLOC_ERROR 6 -#define mitkIpFuncPICNEW_ERROR 7 -#define mitkIpFuncTYPE_ERROR 8 -#define mitkIpFuncUNFIT_ERROR 9 -#define mitkIpFuncDIMMASC_ERROR 10 -#define mitkIpFuncDATA_ERROR 11 -#define mitkIpFunc_ERROR 12 -#define mitkIpERO 0 -#define mitkIpDILA 1 -#define mitkIpOPEN 0 -#define mitkIpCLOSE 1 -#define mitkIpREFLECT 0 -#define mitkIpNOREFLECT 1 -#define mitkIpOVERWRITE 1 - -/* type definitions */ - -typedef enum /* mitkIpFuncFlagI_t */ - { - mitkIpFuncReflect = 0, - mitkIpFuncNoReflect = 1, - mitkIpFuncBorderZero = 2, - mitkIpFuncBorderOld = 3, - mitkIpFuncKeep = 4, - mitkIpFuncNoKeep = 5, - mitkIpFuncScaleBl = 6, - mitkIpFuncScaleNN = 7, - mitkIpFuncTotal = 8, - mitkIpFuncMinMax = 9, - mitkIpFuncAbove = 10, - mitkIpFuncBeneath = 11, - mitkIpFuncFlagI_MAX - } mitkIpFuncFlagI_t; - -typedef struct - { - mitkIpUInt4_t x0; - mitkIpUInt4_t x1; - mitkIpUInt4_t y0; - mitkIpUInt4_t y1; - mitkIpUInt4_t z0; - mitkIpUInt4_t z1; - } mitkIpFuncBox_t; - - -/* macros */ -#define IPFUNCMAX( x, y ) ( ( (x) > (y) ) ? (x) : (y) ) -#define IPFUNCMIN( x, y ) ( ( (x) < (y) ) ? (x) : (y) ) - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif -/* extern gloabal variables */ - -extern int mitkIpFuncErrno; - - -/* function prototypes */ - -mitkIpUInt4_t mitkIpFuncBox ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ); - -mitkIpPicDescriptor *mitkIpFuncConvert( mitkIpPicDescriptor *pic_old, - mitkIpPicType_t type, - mitkIpUInt4_t bpe ); - -void mitkIpFuncCopyTags(mitkIpPicDescriptor *pic_new, mitkIpPicDescriptor *pic_old); - -int mitkIpFuncSetTag( mitkIpPicDescriptor *pic, char *name, int type, int size, - int el_size, void *data ); - -mitkIpPicDescriptor *mitkIpFuncInv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncEqual ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncRefl ( mitkIpPicDescriptor *pic_old, - mitkIpInt4_t axis ); - -mitkIpFloat8_t mitkIpFuncMedI ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncMean ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncSDev ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t *mitkIpFuncGrav ( mitkIpPicDescriptor *pic_old ); - -mitkIpFloat8_t mitkIpFuncMeanC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpFloat8_t mitkIpFuncVarC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpFloat8_t mitkIpFuncSDevC ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t radius ); - -mitkIpUInt4_t mitkIpFuncExtrC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *center, - mitkIpUInt4_t radius ); - -mitkIpPicDescriptor *mitkIpFuncDrawPoly( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncMeanROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncVarROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncSDevROI( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpUInt4_t mitkIpFuncExtrROI( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts ); - -mitkIpFloat8_t mitkIpFuncMeanR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpFloat8_t mitkIpFuncVarR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpFloat8_t mitkIpFuncSDevR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpUInt4_t mitkIpFuncExtrR ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpPicDescriptor *mitkIpFuncFrame ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ); - -mitkIpPicDescriptor *mitkIpFuncBorder ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *mask, - mitkIpFloat8_t value, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSubC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncMultC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncDivC ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncMultI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncDivI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAddSl ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t keep ); - -mitkIpPicDescriptor *mitkIpFuncSubI ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncPot ( mitkIpPicDescriptor *pic_1, - mitkIpFloat8_t exponent, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSqrt ( mitkIpPicDescriptor *pic_1, - mitkIpFuncFlagI_t keep, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncAnd ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncOr ( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncNot ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncLabel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *no_label ); - -mitkIpPicDescriptor *mitkIpFuncThresh ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t threshold, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncConv ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncEro ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncDila ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncOpen ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncClose ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncHitMiss( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncScale ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t sc_fact[_mitkIpPicNDIM], - mitkIpFuncFlagI_t sc_kind ); - -mitkIpPicDescriptor *mitkIpFuncScFact ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t factor, - mitkIpFuncFlagI_t sc_kind ); - -mitkIpPicDescriptor *mitkIpFuncGausF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncCanny ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFloat8_t threshold, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncRank ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t rank, - mitkIpUInt4_t dim_mask, - mitkIpUInt4_t len_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncMeanF ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t len_mask, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncShp ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border, - mitkIpUInt4_t mask_nr ); - -mitkIpPicDescriptor *mitkIpFuncLaplace( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncSobel ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncGrad ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncRoberts( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_mask, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *mitkIpFuncZeroCr ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncExp ( mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncLN ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncLog ( mitkIpPicDescriptor *pic_old ); - -mitkIpPicDescriptor *mitkIpFuncNorm ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncNormXY ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpUInt4_t mitkIpFuncRange ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up ); - -mitkIpInt4_t mitkIpFuncExtr ( mitkIpPicDescriptor *pic, - mitkIpFloat8_t *min, - mitkIpFloat8_t *max ); - -mitkIpInt4_t mitkIpFuncInertia ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t **eigen_vect, - mitkIpFloat8_t **eigen_val ); - -mitkIpInt4_t mitkIpFuncHist ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t min_gv, - mitkIpFloat8_t max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ); - -mitkIpInt4_t mitkIpFuncHisto ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv, - mitkIpUInt4_t **hist, - mitkIpUInt4_t *size_hist ); - -mitkIpPicDescriptor *mitkIpFuncSelInv ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSelect ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpFloat8_t gv, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncSelMM ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t gv_low, - mitkIpFloat8_t gv_up, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncLevWin ( mitkIpPicDescriptor *pic_old, - mitkIpFloat8_t level, - mitkIpFloat8_t window, - mitkIpPicDescriptor *pic_return ); - -mitkIpPicDescriptor *mitkIpFuncWindow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpPicDescriptor *mitkIpFuncWindowR( mitkIpPicDescriptor *pic_1, - mitkIpPicDescriptor *pic_2, - mitkIpUInt4_t *begin, - mitkIpFuncFlagI_t keep ); - - -mitkIpPicDescriptor *mitkIpFuncRegGrow ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t dim_seed, - mitkIpUInt4_t *beg_seed, - mitkIpUInt4_t *end_seed, - mitkIpUInt4_t border_label, - mitkIpUInt4_t region_label, - mitkIpFloat8_t std_fact, - mitkIpUInt4_t kind ); - -void mitkIpFuncPError ( char *string ); - -mitkIpPicDescriptor *mitkIpFuncRotate ( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *grad, int *order ); - -mitkIpPicDescriptor *mitkIpFuncTranspose( mitkIpPicDescriptor *pic, - mitkIpPicDescriptor *pic_old, - int *permutations_vector); - -void mitkIpFuncXchange ( mitkIpPicDescriptor **pic1, - mitkIpPicDescriptor **pic2 ); - -mitkIpFloat8_t mitkIpFuncSkewness ( mitkIpPicDescriptor *pic ); -mitkIpFloat8_t mitkIpFuncCurtosis ( mitkIpPicDescriptor *pic ); - -mitkIpFloat8_t mitkIpFuncSkewnessR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -double mitkIpFuncCurtosisR ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *begin, - mitkIpUInt4_t *length ); - -mitkIpPicDescriptor *mitkIpFuncFillArea ( mitkIpPicDescriptor *pic_old, - mitkIpFuncBox_t box, - mitkIpFloat8_t value, - mitkIpFuncFlagI_t over, - mitkIpPicDescriptor *pic_return ); - -char *mitkIpFuncMakePicName ( char *pic_name, char *extension ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpFunc_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpFunc/mitkIpFuncP.h b/Utilities/IpFunc/mitkIpFuncP.h deleted file mode 100644 index 63f5a57a7a1..00000000000 --- a/Utilities/IpFunc/mitkIpFuncP.h +++ /dev/null @@ -1,191 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * mitkIpFuncP.h - *--------------------------------------------------------------- - * DESCRIPTION - * contains the function prototypes, type definitions and - * includes for the image processing functions - * - * AUTHOR - * Antje Schroeder - * - * UPDATES - * - *--------------------------------------------------------------- - * - */ - - -#ifndef _mitkIpFuncP_h -#define _mitkIpFuncP_h - -/* include files */ - -#include "mitkIpFunc.h" - -/* type definitions */ - -typedef enum - { - mitkIpFuncEroF = 0, - mitkIpFuncDilaF = 1, - mitkIpFuncOpenF = 2, - mitkIpFuncCloseF = 3, - mitkIpFuncFlagF_MAX - } _mitkIpFuncFlagF_t; - -typedef struct - { - mitkIpUInt4_t length; - mitkIpInt4_t *off_vekt; - mitkIpFloat8_t *mask_vekt; - } mitkIpFuncMasc_t; - -/* definition of macros */ - -#define mitkIpFuncCASE_FOR( pic, dim, mitkIpFuncSourceIndex )\ - case dim: for( mitkIpFuncSourceIndex[dim-1]=0; \ - mitkIpFuncSourceIndex[dim-1] < pic->n[dim-1]; \ - mitkIpFuncSourceIndex[dim-1]++ \ - ) - -#define mitkIpFuncFORALL( type, pic, pic_return, \ - mitkIpFuncSourceIndex, mitkIpFuncResultOffset, mitkIpFuncResultFunction )\ - {\ - mitkIpUInt4_t mitkIpFuncSourceOffset=0;\ - mitkIpUInt4_t i;\ - for( i=0; i<_mitkIpPicNDIM; i++) index[i] = 0;\ - for( i=pic->dim; i<_mitkIpPicNDIM; i++) pic->n[i] = 0;\ - for( i=pic_return->dim; i<_mitkIpPicNDIM; i++) pic_return->n[i] = 0;\ - switch( pic->dim )\ - {\ - default:\ - { \ - fprintf( stderr,\ - "sorry, only 1 to 8 dimensional data are supported.\n"); \ - pic_return = NULL;\ - break;\ - }\ - mitkIpFuncCASE_FOR( pic, 8, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 7, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 6, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 5, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 4, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 3, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 2, mitkIpFuncSourceIndex )\ - mitkIpFuncCASE_FOR( pic, 1, mitkIpFuncSourceIndex )\ - {\ - mitkIpFuncResultFunction;\ - ((type *)pic_return->data)[ mitkIpFuncResultOffset ] \ - = ((type *)pic->data)[ mitkIpFuncSourceOffset ] ; \ - mitkIpFuncSourceOffset++;\ - }\ - }\ - } - - -/* function prototypes */ - - -mitkIpUInt4_t _mitkIpFuncBox2d ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ); - -mitkIpUInt4_t _mitkIpFuncBox3d ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t **beg, - mitkIpUInt4_t **end ); - -mitkIpUInt4_t _mitkIpFuncError ( mitkIpPicDescriptor *pic ); - -mitkIpPicDescriptor *_mitkIpFuncDrawPoly( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *pol_x, - mitkIpUInt4_t *pol_y, - mitkIpUInt4_t no_pts, - mitkIpFloat8_t *a, - mitkIpFloat8_t *b ); - -mitkIpPicDescriptor *_mitkIpFuncOpCl ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *_mitkIpFuncMorph ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_mask, - _mitkIpFuncFlagF_t kind, - mitkIpFuncFlagI_t border ); - -mitkIpFuncMasc_t *_mitkIpFuncCompressM ( mitkIpPicDescriptor *mask, - mitkIpPicDescriptor *pic_old, - mitkIpFuncFlagI_t kind, - mitkIpInt4_t beg[_mitkIpPicNDIM], - mitkIpInt4_t end[_mitkIpPicNDIM] ); - -mitkIpInt4_t _mitkIpFuncExtT ( mitkIpPicType_t type, - mitkIpUInt4_t bpe, - mitkIpFloat8_t *min_gv, - mitkIpFloat8_t *max_gv ); - - -mitkIpPicDescriptor *_mitkIpFuncScNN ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ); - -mitkIpPicDescriptor *_mitkIpFuncScBL ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new ); - -mitkIpPicDescriptor *_mitkIpFuncHitMissI( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_masks, - mitkIpFuncFlagI_t border ); - -mitkIpPicDescriptor *_mitkIpFuncBorderX ( mitkIpPicDescriptor *pic_old, - mitkIpUInt4_t *edge, - mitkIpFloat8_t value ); - -void _mitkIpFuncSetErrno( int error_no ); - -mitkIpUInt4_t _ipGetANew( mitkIpUInt4_t aNew[], mitkIpUInt4_t Index ); - -mitkIpPicDescriptor *_mitkIpFuncMalloc ( mitkIpPicDescriptor *pic_old, - mitkIpPicDescriptor *pic_new, - mitkIpBool_t over_write ); -#endif /* _mitkIpFuncP_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/CMakeLists.txt b/Utilities/IpPic/CMakeLists.txt deleted file mode 100644 index 718ec78ce8e..00000000000 --- a/Utilities/IpPic/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(_options NO_INIT GCC_DEFAULT_VISIBILITY) - -if(MITK_WIN32_FORCE_STATIC) - list(APPEND _options FORCE_STATIC) -endif() - -mitk_create_module( - C_MODULE - WARNINGS_NO_ERRORS - ${_options} - PACKAGE_DEPENDS PRIVATE ITK|ZLIB -) - -target_compile_definitions(${MODULE_TARGET} PRIVATE -DMITK_IPPIC_COMPILE) diff --git a/Utilities/IpPic/ChangeLog b/Utilities/IpPic/ChangeLog deleted file mode 100755 index 6a887158eb7..00000000000 --- a/Utilities/IpPic/ChangeLog +++ /dev/null @@ -1,23 +0,0 @@ -Tue Sep 16 09:03:36 1997 Andre Schroeter - - * ipPic: - moved encryption to sepperate branch - -Fri Sep 12 09:02:34 1997 Andre Schroeter - - * mitkIpPicClone.c: - now can also clone if pic->data is NULL - -Sat Sep 6 21:28:48 1997 Andre Schroeter - - * mitkIpPicPut.c (mitkIpPicPut): - now with return value - - * mitkIpPicGet.c (_mitkIpPicReadTags): - new parameter: encryption_type - - * mitkIpPicPut.c (_mitkIpPicWriteTags): - new parameter: encryption_type - - * mitkIpPic.h (mitkIpPicVersionEncryption): - new macro to check for encryption type diff --git a/Utilities/IpPic/annotation/Annotation.c b/Utilities/IpPic/annotation/Annotation.c deleted file mode 100755 index be51797736e..00000000000 --- a/Utilities/IpPic/annotation/Annotation.c +++ /dev/null @@ -1,418 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * Annotation.c - *--------------------------------------------------------------- - * DESCRIPTION - * the annotation widget methods - * - * Author - * a.schroeter - * - *--------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)XipAnnotationWidget\tGerman Cancer Research Center (DKFZ)\t1993/09/17" }; -#endif - - -#include -#include - -#include "AnnotationP.h" -#include "icon_text.xbm" - -#ifdef SHAPE -#include -#endif - -static void Initialize(); -static void Realize(); -static void Redisplay(); -static void Resize(); -static XtGeometryResult QueryGeometry(); -static void Destroy(); -static Boolean SetValues(); - -static void activate(); - -static void getDrawGC(); - - -static XtResource resources[] = -{ - { XipNactivateCallback, XtCCallback, XtRCallback, - sizeof(XtPointer), - XtOffset (XipAnnotationWidget, annotation.activate_CB), - XtRCallback, NULL }, - - /* change parent class defaults */ - { XmNtopShadowColor, XmCTopShadowColor, XmRPixel, - sizeof(Pixel), - XtOffset(XipAnnotationWidget, primitive.top_shadow_color), - XtRString, "black" }, - - { XmNbottomShadowColor, XmCBottomShadowColor, XmRPixel, - sizeof(Pixel), - XtOffset(XipAnnotationWidget, primitive.bottom_shadow_color), - XtRString, "black" }, - - { XmNbackground, XmCBackground, XmRPixel, - sizeof(Pixel), - XtOffset(XipAnnotationWidget, core.background_pixel), - XtRString, "Yellow" }, - - { XmNtraversalOn, XmCTraversalOn, XmRBoolean, - sizeof(Boolean), - XtOffset (XipAnnotationWidget, primitive.traversal_on), - XmRImmediate, (XtPointer)False }, -}; - -static char defaultTranslations[] = -" : activate()\n\ -"; - -static XtActionsRec actions[] = -{ - { "activate", (XtActionProc)activate }, -}; - -XipAnnotationClassRec xipAnnotationClassRec = -{ - { /* core_class fields */ - (WidgetClass)&xmPrimitiveClassRec, /* superclass */ - "XipAnnotation", /* class_name */ - sizeof(XipAnnotationRec), /* widget_size */ - NULL, /* class_initialize */ - NULL, /* class_part_initialize */ - False, /* class_inited */ - Initialize, /* initialize */ - NULL, /* initialize_hook */ - Realize, /* realize */ - /*XtInheritRealize, /* realize */ - actions, /* actions */ - XtNumber(actions), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* num_resources */ - NULLQUARK, /* xrm_class */ - True, /* compress_motion */ - False, /* compress_exposure */ - True, /* compress_enterleave */ - False, /* visible_interest */ - Destroy, /* destroy */ - Resize, /* resize */ - Redisplay, /* expose */ - SetValues, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback private */ - defaultTranslations, /* tm_table */ - QueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL, /* extension */ - }, - { /* primitive_class fields */ - (XtWidgetProc)_XtInherit, /* border highlight */ - (XtWidgetProc)_XtInherit, /* border unhiglight */ - XtInheritTranslations, /* translations */ - NULL, /* arm_and_activate */ - NULL, /* syn resources */ - 0, /* num_sysresources */ - NULL, /* extensions */ - }, - { /* annotation_class fields */ - 0, /* extension */ - }, -}; - -WidgetClass xipAnnotationWidgetClass = (WidgetClass) &xipAnnotationClassRec; - - -static void Initialize( request, new, args, num_args ) - XipAnnotationWidget request, new; - ArgList args; - Cardinal *num_args; -{ - /*printf( "init\n" );*/ - - getDrawGC( new ); - - new->annotation.cursor = XCreateFontCursor( XtDisplay(new), - XC_hand1 ); - - new->annotation.icon_text = 0; - - if( request->core.width == 0 ) - new->core.width = 25; - if( request->core.height == 0 ) - new->core.height = 30; -} - -static void getDrawGC( w ) - XipAnnotationWidget w; -{ - XGCValues values; - XtGCMask valueMask; - - values.foreground = w->primitive.foreground; - values.background = w->core.background_pixel; - valueMask = GCForeground | GCBackground; - - w->annotation.draw_GC = XtGetGC ( (Widget)w, valueMask, &values ); -} - -static void Realize( w, valueMask, attributes ) - XipAnnotationWidget w; - Mask *valueMask; - XSetWindowAttributes *attributes; -{ - /*(*xipAnnotationClassRec.core_class.superclass->core_class.realize) - (w, valueMask, attributes);*/ - - XtCreateWindow( (Widget)w, - InputOutput, - CopyFromParent, - *valueMask, - attributes); - -#ifdef SHAPE - { - GC shape_gc; - Pixmap shape_mask; - XGCValues xgcv; - - shape_mask = XCreatePixmap( XtDisplay(w), - XtWindow(w), - w->core.width, - w->core.height, - 1 ); - shape_gc = XCreateGC( XtDisplay(w), - shape_mask, - 0, - &xgcv); - - XSetForeground( XtDisplay(w), - shape_gc, - 0); - XFillRectangle( XtDisplay(w), - shape_mask, - shape_gc, - 0, 0, - w->core.width, w->core.height ); - XSetForeground( XtDisplay(w), - shape_gc, - 1); - XFillRectangle( XtDisplay(w), - shape_mask, - shape_gc, - 1, 1, - w->core.width-4, w->core.height-4 ); - XSetForeground( XtDisplay(w), - shape_gc, - 0); - { - int i; - - for( i = 0; i < w->core.width/6; i++ ) - XDrawLine( XtDisplay(w), - shape_mask, - shape_gc, - w->core.width-4-i, w->core.height-4, - w->core.width-4, w->core.height-4-i ); - - XDrawLine( XtDisplay(w), - shape_mask, - shape_gc, - w->core.width-4-i, w->core.height-4-i, - w->core.width-4-i, w->core.height-4 ); - XDrawLine( XtDisplay(w), - shape_mask, - shape_gc, - w->core.width-4-i, w->core.height-4-i, - w->core.width-4, w->core.height-4-i ); - } - XShapeCombineMask( XtDisplay(w), - XtWindow(w), - ShapeClip, - 0, 0, - shape_mask, - ShapeSet); - - XSetForeground( XtDisplay(w), - shape_gc, - 0); - XFillRectangle( XtDisplay(w), - shape_mask, - shape_gc, - 0, 0, - w->core.width, w->core.height ); - XSetForeground( XtDisplay(w), - shape_gc, - 1); - XFillRectangle( XtDisplay(w), - shape_mask, - shape_gc, - 0, 0, - w->core.width-2, w->core.height-2 ); - XFillRectangle( XtDisplay(w), - shape_mask, - shape_gc, - 2, 2, - w->core.width-2, w->core.height-2 ); - XSetForeground( XtDisplay(w), - shape_gc, - 0); - { - int i; - - for( i = 0; i < w->core.width/6; i++ ) - XDrawLine( XtDisplay(w), - shape_mask, - shape_gc, - w->core.width-1-i, w->core.height-1, - w->core.width-1, w->core.height-1-i ); - } - XShapeCombineMask( XtDisplay(w), - XtWindow(w), - ShapeBounding, - 0, 0, - shape_mask, - ShapeSet); - - XFreePixmap( XtDisplay(w), - shape_mask ); - } -#endif - - XDefineCursor( XtDisplay(w), - XtWindow(w), - w->annotation.cursor ); -} - -static XtGeometryResult QueryGeometry( w, proposed, answer ) - XipAnnotationWidget w; - XtWidgetGeometry *proposed; - XtWidgetGeometry *answer; -{ - - answer->width = (Dimension)256; - answer->height = (Dimension)120; - answer->request_mode = CWWidth || CWHeight; - - return( XtGeometryAlmost ); -} - -static void Destroy( w ) - XipAnnotationWidget w; -{ - XtReleaseGC( (Widget)w, w->annotation.draw_GC ); - - XtRemoveAllCallbacks ( (Widget)w, XipNactivateCallback ); -} - -static void Resize( w ) - XipAnnotationWidget w; -{ - /*if( w->core.width > w->annotation.image->width - || w->core.height > w->annotation.image->height ) - XtWarning( "XipAnnotationWidget resized" );*/ - -} - - -static void Redisplay( w, event, region) - XipAnnotationWidget w; - XExposeEvent *event; - Region region; -{ - if( w->core.visible ) - { - if( w->annotation.icon_text == 0 ) - w->annotation.icon_text = XCreateBitmapFromData( XtDisplay(w), - XtWindow(w), - icon_text_bits, - icon_text_width, - icon_text_height ); - - XCopyPlane( XtDisplay(w), - w->annotation.icon_text, - XtWindow(w), - w->annotation.draw_GC, - 0, 0, - icon_text_width, icon_text_height, - 0, 0, - 1 ); - /*XDrawLine( XtDisplay(w), - XtWindow(w), - w->annotation.draw_GC, - 0, 0, - 200, 200 );*/ - } -} - -static Boolean SetValues( current, request, new, args, num_args ) - XipAnnotationWidget current, request, new; - ArgList args; - Cardinal *num_args; -{ - Cardinal i; - - Boolean redraw = False; - - /*printf( "setv\n" );*/ - - return( redraw ); -} - -static void activate( w, event ) - XipAnnotationWidget w; - XEvent *event; -{ - if( event->xbutton.x < w->core.width - && event->xbutton.y < w->core.height ) - XtCallCallbacks( (Widget)w, - XipNactivateCallback, - (XtPointer) event ); -} diff --git a/Utilities/IpPic/annotation/Annotation.h b/Utilities/IpPic/annotation/Annotation.h deleted file mode 100755 index 4c3bdc8b498..00000000000 --- a/Utilities/IpPic/annotation/Annotation.h +++ /dev/null @@ -1,79 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * Annotation.h - *--------------------------------------------------------------- - * DESCRIPTION - * public header for the annotation widget - * - * Author - * a.schroeter - * - *--------------------------------------------------------------- - * - */ - -#ifndef _XipAnnotationWidget_h -#define _XipAnnotationWidget_h - -extern WidgetClass xipAnnotationWidgetClass; - -typedef struct _XipAnnotationClassRec *XipAnnotationWidgetClass; -typedef struct _XipAnnotationRec *XipAnnotationWidget; - -#ifndef XipIsAnnotation -#define XipIsAnnotation(w) XtIsSubclass(w, xipAnnotationWidgetClass) -#endif - -/* -** resource strings -*/ -#define XipNactivateCallback XmNactivateCallback - -#define XipCActivateCallback XmCActivateCallback - -/* -** new data types -*/ - - -#endif /* _XipAnnotationWidget_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/annotation/AnnotationP.h b/Utilities/IpPic/annotation/AnnotationP.h deleted file mode 100755 index f1553932457..00000000000 --- a/Utilities/IpPic/annotation/AnnotationP.h +++ /dev/null @@ -1,119 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * AnnotationP.h - *--------------------------------------------------------------- - * DESCRIPTION - * private header file for the annotation widget - * - * Author - * a.schroeter - * - *--------------------------------------------------------------- - * - */ - -#ifndef _XipAnnotationP_h -#define _XipAnnotationP_h - -/* superclass */ -#include - -#if( XmVersion >= 1002 ) -#include -#endif - - -/* public header for this widget */ -#include "Annotation.h" - -/* other headers */ - - -#ifndef XlibSpecificationRelease -#define XrmPermStringToQuark XrmStringToQuark -#endif - -/*private macros */ -#ifndef Min -#define Min(x, y) (((x) < (y)) ? (x) : (y)) -#endif -#ifndef Max -#define Max(x, y) (((x) > (y)) ? (x) : (y)) -#endif - -/* new fields for this widget's class record */ -typedef struct _XipAnnotationClassPart - { - XtPointer extension; - } XipAnnotationClassPart; - -/* full class record declaration */ -typedef struct _XipAnnotationClassRec - { - CoreClassPart core_class; - XmPrimitiveClassPart primitive_class; - XipAnnotationClassPart annotation_class; - } XipAnnotationClassRec; - -extern XipAnnotationClassRec xipAnnotationClassRec; - -/* new fields for this widget's instance record */ -typedef struct _XipAnnotationPart - { /* resources */ - - Cursor cursor; - XtCallbackList activate_CB; - Pixmap icon_text; - - /* private variables */ - GC draw_GC; - } XipAnnotationPart; - -/* full instance record declaration */ -typedef struct _XipAnnotationRec - { CorePart core; - XmPrimitivePart primitive; - XipAnnotationPart annotation; - } XipAnnotationRec; - -#endif /* _XipAnnotationP_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/annotation/ad.h b/Utilities/IpPic/annotation/ad.h deleted file mode 100755 index 4db90a1a501..00000000000 --- a/Utilities/IpPic/annotation/ad.h +++ /dev/null @@ -1,2 +0,0 @@ -"*background: gray75", -"*annotation.background: yellow", diff --git a/Utilities/IpPic/annotation/icon_text.xbm b/Utilities/IpPic/annotation/icon_text.xbm deleted file mode 100755 index d38f1e15a5f..00000000000 --- a/Utilities/IpPic/annotation/icon_text.xbm +++ /dev/null @@ -1,13 +0,0 @@ -#define icon_text_width 25 -#define icon_text_height 30 -static char icon_text_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/Utilities/IpPic/annotation/main.ad b/Utilities/IpPic/annotation/main.ad deleted file mode 100755 index 25cb50de920..00000000000 --- a/Utilities/IpPic/annotation/main.ad +++ /dev/null @@ -1,3 +0,0 @@ - -*background: gray75 -*annotation.background: yellow diff --git a/Utilities/IpPic/annotation/main.c b/Utilities/IpPic/annotation/main.c deleted file mode 100755 index ad280d5ddab..00000000000 --- a/Utilities/IpPic/annotation/main.c +++ /dev/null @@ -1,181 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -#include -#include -#include -#include -#include - -#include - -#include - -#include "Annotation.h" - -/*#include */ - -static String fallback_resources[] = { -#include "ad.h" -NULL -}; - - -static int n; -static Arg args[20]; - -void activate( Widget w, XtPointer data, XtPointer call_data ); - -extern void _XEditResCheckMessages(); - -Widget button1; -Widget button2; - -Position x, y; -char* text; - -main( int argc, char *argv[] ) -{ - XtAppContext app_context; - Widget toplevel, bb, pic, annotation; - /*Widget button;*/ - - - toplevel = XtVaAppInitialize( &app_context, - "Test", - NULL, 0, - &argc, argv, - fallback_resources, - NULL ); - - XtAddEventHandler( toplevel, - (EventMask)0, - True,_XEditResCheckMessages, - NULL ); - - n = 0; - XtSetArg( args[n], XmNheight, 400 ); n++; - XtSetArg( args[n], XmNwidth, 400 ); n++; - - XtSetValues( toplevel, args, n ); - - bb = XmCreateDrawingArea( toplevel, "bb", args, n ); - XtManageChild( bb ); - - - n = 0; - XtSetArg( args[n], XmNx, 200 ); n++; - XtSetArg( args[n], XmNy, 100 ); n++; - annotation = XtCreateManagedWidget( "annotation", - xipAnnotationWidgetClass, - bb, - args, n ); - XtAddCallback( annotation, XipNactivateCallback, activate, NULL ); - - n = 0; - XtSetArg( args[n], XmNx, 0 ); n++; - XtSetArg( args[n], XmNy, 0 ); n++; - XtSetArg( args[n], XipNquantisation, True ); n++; - XtSetArg( args[n], XipNpic, mitkIpPicGet( "../b.pic", NULL ) ); n++; - pic = XtCreateManagedWidget( "pic", - xipPicWidgetClass, - bb, - args, n ); -/**************/ - XtRealizeWidget( toplevel ); -/**************/ - { - mitkIpPicDescriptor *pic; - _mitkIpPicTagsElement_t *head; - mitkIpPicTSV_t *tsv; - - pic = mitkIpPicGetTags( "../b.pic", - NULL ); - tsv = mitkIpPicQueryTag( pic, "ANNOTATION" ); - if( tsv != NULL ) - { - head = tsv->value; - - tsv = _mitkIpPicFindTag( head, "TEXT" )->tsv; - text = malloc( strlen(tsv->value) ); - strcpy( text, tsv->value ); - printf( "%s\n", text ); - - tsv = _mitkIpPicFindTag( head, "POSITION" )->tsv; - x = ((mitkIpUInt4_t *)(tsv->value))[0]; - y = ((mitkIpUInt4_t *)(tsv->value))[1]; - printf( "%i %i\n", x, y ); - } - - mitkIpPicFree( pic ); - } -/**************/ - XtVaSetValues( annotation, - XmNx, x, - XmNy, y, - NULL ); -/**************/ - XtAppMainLoop(app_context); -} - -void activate( Widget w, XtPointer data, XtPointer call_data ) -{ - static Widget box = 0; - - /*printf( "activated\n" );*/ - - if( box == 0 ) - box = XmCreateInformationDialog( w, "info", NULL, 0 ); - - XtVaSetValues( box, - XmNnoResize, True, - XtVaTypedArg, - XmNdialogTitle, XmRString, "HELP", sizeof( char *), - XtVaTypedArg, - XmNmessageString, XmRString, text, sizeof( char *), - XtVaTypedArg, - XmNokLabelString, XmRString, " Close ", sizeof( char *), - NULL ); - - XtUnmanageChild( XmMessageBoxGetChild( box, XmDIALOG_CANCEL_BUTTON ) ); - XtUnmanageChild( XmMessageBoxGetChild( box, XmDIALOG_HELP_BUTTON ) ); - - XtManageChild( box ); -} diff --git a/Utilities/IpPic/doc/ipPic.pdf b/Utilities/IpPic/doc/ipPic.pdf deleted file mode 100644 index c43cce90323..00000000000 Binary files a/Utilities/IpPic/doc/ipPic.pdf and /dev/null differ diff --git a/Utilities/IpPic/doc/usingPic.pdf b/Utilities/IpPic/doc/usingPic.pdf deleted file mode 100644 index c3d96bdb324..00000000000 Binary files a/Utilities/IpPic/doc/usingPic.pdf and /dev/null differ diff --git a/Utilities/IpPic/endian.c b/Utilities/IpPic/endian.c deleted file mode 100755 index 31ddd1f5706..00000000000 --- a/Utilities/IpPic/endian.c +++ /dev/null @@ -1,57 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -union { - unsigned short s; - unsigned char b; -} t = { 0x1234 }; - -void main( void ) -{ - - /*t.s = 0x1234;*/ - - if( t.b == 0x12 ) - printf( "big\n" ); - else - printf( "little\n" ); - -} diff --git a/Utilities/IpPic/files.cmake b/Utilities/IpPic/files.cmake deleted file mode 100644 index ef022fffa9f..00000000000 --- a/Utilities/IpPic/files.cmake +++ /dev/null @@ -1,15 +0,0 @@ -set(CPP_FILES - ipPicInfo.c ipPicType.c - ipPicAddT.c ipPicQueryT.c ipPicDelT.c ipPicGetT.c - ipPicOldGet.c ipPicOldGetH.c ipPicOldGetS.c - ipPicGet.c ipPicGetH.c ipPicGetS.c - ipPicPut.c ipPicPutS.c - ipPicGetMem.c ipPicPutMem.c - ipPicCopyS.c ipPicCopyH.c - ipPicNew.c ipPicClear.c ipPicFree.c ipPicClone.c - ipEndian.c ipFRead.c ipFWrite.c - ipError.c - ipPicSize.c ipPicElements.c - ipPicTSVSize.c ipPicTSVElements.c - ) - diff --git a/Utilities/IpPic/ipEndian.c b/Utilities/IpPic/ipEndian.c deleted file mode 100755 index c1c2ed6193b..00000000000 --- a/Utilities/IpPic/ipEndian.c +++ /dev/null @@ -1,149 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * $RCSfile$ - *--------------------------------------------------------------- - * DESCRIPTION - * Routines for the conversion of Data - * between different machine representations - * - * $Log$ - * Revision 1.10 2004/01/17 22:58:18 andre - * big endian fixes - * - * Revision 1.6 2004/01/17 22:56:18 uid9277 - * big endian fixes - * - * Revision 1.5 1999/11/27 23:59:45 andre - * *** empty log message *** - * - * Revision 1.4 1999/11/27 19:15:08 andre - * *** empty log message *** - * - * Revision 1.3 1998/11/11 11:11:26 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:07 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *--------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)ipEndian\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include - -#include "mitkIpPic.h" - -_mitkIpEndian_t _mitkIpEndian( void ) -{ - static union - { mitkIpUInt2_t s; - mitkIpUInt1_t b; - } t = { 0x1234 }; - - if( t.b == 0x12 ) - return( _mitkIpEndianBig ); - if( t.b == 0x34 ) - return( _mitkIpEndianLittle ); - else - { - fprintf( stderr, "%s:_mitkIpEndian: WARNING: unknown endian !!!\n", __FILE__ ); - return( _mitkIpEndianUnknown ); - } -} - -void _mitkIpCp( void *source, void *destination, unsigned long int len ) -{ - if( !source ) - return; - if( !destination ) - return; - - memmove( destination, source, len ); -} - -void _mitkIpCvtEndian( void *data, unsigned long int len, unsigned char bytes ) -{ - unsigned long int i; - unsigned char i2; - char buff; - - if( !data ) - return; - - for( i=0; i - -#include "mitkIpTypes.h" - -/** maps mitkIpError_t type values to printable strings - * @param error the error number - * @return the printable string - * - * AUTHOR & DATE - */ - -char *mitkIpErrorStr( mitkIpError_t error ) -{ - char *str; - - switch( error ) - { - case mitkIpError : - str = "generic error"; - break; - case mitkIpOK : - str = "No Error"; - break; - default: - str = "mitkIpError: Unknown Error"; - fprintf( stderr, "mitkIpErrorStr: sorry, unknown error (#%i)\n", error ); - break; - } - - return( str ); -} diff --git a/Utilities/IpPic/ipFRead.c b/Utilities/IpPic/ipFRead.c deleted file mode 100755 index 19a42042c04..00000000000 --- a/Utilities/IpPic/ipFRead.c +++ /dev/null @@ -1,174 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads big- and litle- endian from disk - * and swaps to the other endianess - * - * $Log$ - * Revision 1.14 2005/09/09 09:14:45 ivo - * FIX: warnings on windows - * - * Revision 1.13 2003/03/06 10:53:08 andre - * *** empty log message *** - * - * Revision 1.12 2002/11/13 17:52:59 ivo - * new ipPic added. - * - * Revision 1.10 2002/02/27 08:54:43 andre - * zlib changes - * - * Revision 1.9 2000/05/04 12:52:35 ivo - * inserted BSD style license - * - * Revision 1.8 2000/01/17 18:31:59 andre - * *** empty log message *** - * - * Revision 1.7 1999/12/09 19:12:09 andre - * *** empty log message *** - * - * Revision 1.5 1999/11/29 09:34:34 andre - * *** empty log message *** - * - * Revision 1.4 1999/11/28 16:27:20 andre - * *** empty log message *** - * - * Revision 1.3 1999/11/27 19:15:08 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:08 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)_ipFRead\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include -#include -#ifdef WIN32 -#include -#else -#include -#endif - -#include "mitkIpPic.h" - -size_t -mitkIpFReadCvt( void *ptr, size_t size, size_t nitems, FILE *stream ) -{ - size_t bytes_return; - - bytes_return = fread( ptr, size, nitems, stream ); - _mitkIpCvtEndian( ptr, size*nitems, size ); - - return( bytes_return ); -} - -#ifdef USE_ZLIB -mitkIpBool_t _mitkIpPicCanReadCompressed = mitkIpTrue; -#else -mitkIpBool_t _mitkIpPicCanReadCompressed = mitkIpFalse; -#endif - -size_t -mitkIpPicFReadCvt( void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream ) -{ - size_t bytes_return; - - bytes_return = mitkIpPicFRead( ptr, size, nitems, stream ); - - _mitkIpCvtEndian( ptr, size*nitems, size ); - - return( bytes_return ); -} - -int -mitkIpPicAccess( const char *path, int mode ) -{ - int status; - - status = access( path, mode ); - - if( status == -1 ) - { - char buff[1024]; - - sprintf( buff, "%s.gz", path ); - - status = access( buff, mode ); - } - - return( status ); -} -int -mitkIpPicRemoveFile( const char *path ) -{ - int status; - - status = remove( path ); - - if( status != 0 ) - { - char buff[1024]; - - sprintf( buff, "%s.gz", path ); - - status = remove( buff ); - } - - return( status ); -} diff --git a/Utilities/IpPic/ipFWrite.c b/Utilities/IpPic/ipFWrite.c deleted file mode 100755 index cc17208106a..00000000000 --- a/Utilities/IpPic/ipFWrite.c +++ /dev/null @@ -1,156 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * writes big- and litle- endian to disk - * and swaps to the other endianess - * - * $Log$ - * Revision 1.8 2003/02/18 12:28:23 andre - * write compressed pic files - * - * Revision 1.7 2002/11/13 17:52:59 ivo - * new ipPic added. - * - * Revision 1.5 2000/05/04 12:52:35 ivo - * inserted BSD style license - * - * Revision 1.4 2000/05/04 12:35:57 ivo - * some doxygen comments. - * - * Revision 1.3 1997/09/15 13:22:32 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:09 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)_mitkIpFWrite\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include -#include - -#include "mitkIpPic.h" - -#ifdef USE_ZLIB -mitkIpBool_t _mitkIpPicCanWriteCompressed = mitkIpTrue; -#else -mitkIpBool_t _mitkIpPicCanWriteCompressed = mitkIpFalse; -#endif - - -static mitkIpBool_t mitk_write_compressed = mitkIpFalse; - -mitkIpBool_t -mitkIpPicGetWriteCompression( void ) -{ - return( mitk_write_compressed ); -} - -mitkIpBool_t -mitkIpPicSetWriteCompression( mitkIpBool_t compression ) -{ - mitkIpBool_t compression_old = mitk_write_compressed; - - mitk_write_compressed = compression; - - return( compression_old ); -} - -size_t -mitkIpFWriteCvt( void *ptr, size_t size, size_t nitems, FILE *stream ) -{ - size_t bytes_return; - - void *buff; - buff = malloc( size * nitems ); - _mitkIpCpCvtEndian( ptr, buff, size*nitems, size ); - bytes_return = fwrite( buff, size, nitems, stream); - free( buff ); - - return( bytes_return ); -} - -size_t -_mitkIpPicFWrite( const void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream) -{ - size_t bytes_return; - -#ifdef USE_ZLIB - if( mitk_write_compressed ) - bytes_return = gzwrite( stream, (void *)ptr, size*nitems); - else -#endif - bytes_return = fwrite( ptr, size, nitems, (FILE *)stream ); - - return( bytes_return ); -} - -size_t -mitkIpPicFWriteCvt( void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream ) -{ - size_t bytes_return; - - void *buff; - buff = malloc( size * nitems ); - _mitkIpCpCvtEndian( ptr, buff, size*nitems, size ); - bytes_return = mitkIpPicFWrite( buff, size, nitems, stream); - free( buff ); - - return( bytes_return ); -} diff --git a/Utilities/IpPic/ipPic.dox b/Utilities/IpPic/ipPic.dox deleted file mode 100755 index 03d8f45c64c..00000000000 --- a/Utilities/IpPic/ipPic.dox +++ /dev/null @@ -1,401 +0,0 @@ -# Doxyfile 0.49-990829 - -# This file describes the settings to be used by doxygen for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of word surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = ipPic - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Dutch, French, Italian, Czech, Swedish, German and Japanese - -OUTPUT_LANGUAGE = English - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# If the EXTRACT_ALL tag is set to YES all classes and functions will be -# included in the documentation, even if no documentation was available. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members inside documented classes or files. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all -# undocumented classes. - -HIDE_UNDOC_CLASSES = YES - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# If the FULL_PATH_NAMES tag is set to YES Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. - -STRIP_FROM_PATH = - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a class diagram (in Html and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. - -CLASS_DIAGRAMS = YES - -# If the SOURCE_BROWSER tag is set to YES than the body of a member or -# function will be appended as a block of code to the documentation of. -# that member or function. - -SOURCE_BROWSER = NO - -# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen -# will only generate file names in lower case letters. If set to -# YES upper case letters are also allowed. This is useful if you have -# classes or files whose names only differ in case and if your file system -# supports case sensitive file names. - -CASE_SENSE_NAMES = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -# If the JAVADOC_NO_AUTOBRIEF is set to YES (the default) then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the Javadoc-style will -# behave just like the Qt-style comments. - -JAVADOC_AUTOBRIEF = YES - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . mitkIpPic.h - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -FILE_PATTERNS = *.c - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. - -MACRO_EXPANSION = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = DOXYGEN_IGNORE - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED tag. - -EXPAND_ONLY_PREDEF = NO - -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES tag can be used to specify one or more tagfiles. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO - -# The CGI_NAME tag should be the name of the CGI script that -# starts the search engine (doxysearch) with the correct parameters. -# A script with this name will be generated by doxygen. - -CGI_NAME = search.cgi - -# The CGI_URL tag should be the absolute URL to the directory where the -# cgi binaries are located. See the documentation of your http daemon for -# details. - -CGI_URL = - -# The DOC_URL tag should be the absolute URL to the directory where the -# documentation is located. If left blank the absolute path to the -# documentation, with file:// prepended to it, will be used. - -DOC_URL = - -# The DOC_ABSPATH tag should be the absolute path to the directory where the -# documentation is located. If left blank the directory on the local machine -# will be used. - -DOC_ABSPATH = - -# The BIN_ABSPATH tag must point to the directory where the doxysearch binary -# is installed. - -BIN_ABSPATH = /usr/local/bin/ - -# The EXT_DOC_PATHS tag can be used to specify one or more paths to -# documentation generated for other projects. This allows doxysearch to search -# the documentation for these projects as well. - -EXT_DOC_PATHS = - diff --git a/Utilities/IpPic/ipPicAddT.c b/Utilities/IpPic/ipPicAddT.c deleted file mode 100755 index 35bec098653..00000000000 --- a/Utilities/IpPic/ipPicAddT.c +++ /dev/null @@ -1,103 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * inserts a tsv into the pic - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicAddTag\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - - -void -mitkIpPicAddTag( mitkIpPicDescriptor *pic, mitkIpPicTSV_t *tsv ) -{ - pic->info->tags_head = _mitkIpPicInsertTag( pic->info->tags_head, tsv ); -} - -void -mitkIpPicAddSubTag( mitkIpPicTSV_t *parent, mitkIpPicTSV_t *tsv ) -{ - if( parent->type != mitkIpPicTSV ) - return; - - parent->n[0]++; - parent->value = _mitkIpPicInsertTag( parent->value, tsv ); -} - -_mitkIpPicTagsElement_t * -_mitkIpPicInsertTag( _mitkIpPicTagsElement_t *head, mitkIpPicTSV_t *tsv ) -{ - int i; - _mitkIpPicTagsElement_t *new; - _mitkIpPicTagsElement_t *current; - - tsv->tag[_mitkIpPicTAGLEN] = '\0'; - for( i=strlen(tsv->tag); i<_mitkIpPicTAGLEN; i++ ) - tsv->tag[i] = ' '; - - new = malloc( sizeof(_mitkIpPicTagsElement_t) ); - - new->tsv = tsv; - new->prev = NULL; - new->next = NULL; - - if( head == NULL ) - { - head = new; - } - else - { - current = head; - - while( current->next != NULL ) - { - current = current->next; - } - - new->prev = current; - current->next = new; - } - - return( head ); -} diff --git a/Utilities/IpPic/ipPicAnnotation.h b/Utilities/IpPic/ipPicAnnotation.h deleted file mode 100755 index 64aa9d944dd..00000000000 --- a/Utilities/IpPic/ipPicAnnotation.h +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * mitkIpPicAnnotation.h - *--------------------------------------------------------------------- - * DESCRIPTION - * declarations for the annotations in the pic format - * - * AUTHOR & DATE - * Andre Schroeter 09.01.95 - * - * UPDATES - * a short history of the file - * - *--------------------------------------------------------------------- - */ - -#ifndef _mitkIpPicAnnotation_h -#define _mitkIpPicAnnotation_h - -typedef enum - { - mitkIpPicAUnknown = 0, - mitkIpPicAText = 1 - } mitkIpPicAnnotationType_t; - -typedef struct - { - mitkIpUInt4_t _magic; - - mitkIpPicAnnotationType_t type; - - mitkIpUInt4_t location_x; - mitkIpUInt4_t location_y; - - mitkIpUInt4_t position_x; - mitkIpUInt4_t position_y; - char *text; - } mitkIpPicAnnotation_t; - -#endif /* _mitkIpPicAnnotation_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ - diff --git a/Utilities/IpPic/ipPicAnnotations.h b/Utilities/IpPic/ipPicAnnotations.h deleted file mode 100755 index edcd5b2795a..00000000000 --- a/Utilities/IpPic/ipPicAnnotations.h +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - * mitkIpPicAnnotations.h - *--------------------------------------------------------------------- - * DESCRIPTION - * declarations for the annotations in the pic format - * - * AUTHOR & DATE - * Andre Schroeter 09.01.95 - * - * UPDATES - * a short history of the file - * - *--------------------------------------------------------------------- - */ - -#ifndef _mitkIpPicAnnotations_h -#define _mitkIpPicAnnotations_h - -typedef enum - { - mitkIpPicAUnknown = 0, - mitkIpPicAText = 1 - } mitkIpPicAnnotations_t; - -typedef struct - { - mitkIpUInt4_t xpos; - mitkIpUInt4_t ypos; - char *text; - } mitkIpPicAnnotation; - -#endif /* _mitkIpPicAnnotations_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/ipPicClear.c b/Utilities/IpPic/ipPicClear.c deleted file mode 100755 index 6825cb047f3..00000000000 --- a/Utilities/IpPic/ipPicClear.c +++ /dev/null @@ -1,127 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * Clears the entries in a picDescriptor - * and frees the data and info - * - * $Log$ - * Revision 1.6 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.4 2000/05/04 12:52:36 ivo - * inserted BSD style license - * - * Revision 1.3 2000/05/04 12:35:58 ivo - * some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:10 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicClear\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -void mitkIpPicClear( mitkIpPicDescriptor *pic ) -{ - if( pic != NULL ) - { - if( pic->data != NULL ) - { - free( pic->data ); - pic->data = NULL; - } - - if( pic->info != NULL ) - { - _mitkIpPicFreeTags( pic->info->tags_head ); - pic->info->tags_head = NULL; - - /*free( pic->info ); - pic->info = NULL;*/ - } - pic->type = mitkIpPicUnknown; - } -} - -void _mitkIpPicFreeTags( _mitkIpPicTagsElement_t *head ) -{ - _mitkIpPicTagsElement_t *current; - - current = head; - while( current != NULL ) - { - _mitkIpPicTagsElement_t *this = current; - current = current->next; - - if( this->tsv != NULL ) - { - if( this->tsv->value != NULL ) - { - if( this->tsv->type == mitkIpPicTSV ) - _mitkIpPicFreeTags( this->tsv->value ); - else - free( this->tsv->value ); - } - free( this->tsv ); - } - - free( this ); - } -} diff --git a/Utilities/IpPic/ipPicClone.c b/Utilities/IpPic/ipPicClone.c deleted file mode 100755 index 895bf7f51ee..00000000000 --- a/Utilities/IpPic/ipPicClone.c +++ /dev/null @@ -1,141 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * creates the clone of a pic - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicClone\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** - * creates the clone of a pic - * @param pic the original pic - * - * @return the exact copy - * - * - * AUTHOR & DATE - * - */ - -mitkIpPicDescriptor *mitkIpPicClone( mitkIpPicDescriptor *pic ) -{ - mitkIpPicDescriptor *clone; - - clone = mitkIpPicCopyHeader( pic, - NULL ); - - strncpy( clone->info->version, pic->info->version, _mitkIpPicTAGLEN ); - - clone->info->tags_head = _mitkIpPicCloneTags( pic->info->tags_head ); - - clone->info->write_protect = pic->info->write_protect; - - if( !pic->data ) - { - clone->data = NULL; - } - else - { - mitkIpUInt4_t size; - - size = _mitkIpPicSize( pic ); - - clone->data = malloc( size ); - if ( ! ( clone->data ) ) - return NULL; - memmove( clone->data, pic->data, size ); - } - - return( clone ); -} - -_mitkIpPicTagsElement_t *_mitkIpPicCloneTags( _mitkIpPicTagsElement_t *head ) -{ - _mitkIpPicTagsElement_t *new; - _mitkIpPicTagsElement_t *current; - - new = NULL; - current = head; - while( current != NULL ) - { - new = _mitkIpPicInsertTag( new, _mitkIpPicCloneTag(current->tsv) ); - - current = current->next; - } - return( new ); -} - -mitkIpPicTSV_t *_mitkIpPicCloneTag( mitkIpPicTSV_t *source ) -{ - mitkIpPicTSV_t *new; - - mitkIpUInt4_t i; - - new = malloc( sizeof(mitkIpPicTSV_t) ); - - strncpy( new->tag, source->tag, _mitkIpPicTAGLEN ); - - new->type = source->type; - new->bpe = source->bpe; - new->dim = source->dim; - - for( i = 0; i < source->dim; i++ ) - new->n[i] = source->n[i]; - - if( source->type == mitkIpPicTSV ) - { - new->value = _mitkIpPicCloneTags( source->value ); - } - else - { - mitkIpUInt4_t size; - - size = _mitkIpPicTSVSize( new ); - - new->value = malloc( size ); - memmove( new->value, source->value, size ); - } - - return( new ); -} diff --git a/Utilities/IpPic/ipPicCopyH.c b/Utilities/IpPic/ipPicCopyH.c deleted file mode 100755 index 91093a56dca..00000000000 --- a/Utilities/IpPic/ipPicCopyH.c +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * copys the header from a pic into a new pic - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicCopyHeader\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** copys the header from a pic into a new pic - * - */ - -mitkIpPicDescriptor *mitkIpPicCopyHeader( mitkIpPicDescriptor *pic, mitkIpPicDescriptor *pic_new ) -{ - mitkIpUInt4_t i; - - if( pic_new == NULL ) - pic_new = mitkIpPicNew(); - - mitkIpPicClear( pic_new ); - - - pic_new->type = pic->type; - pic_new->bpe = pic->bpe; - pic_new->dim = pic->dim; - for( i=0; idim; i++ ) - pic_new->n[i] = pic->n[i]; - - return( pic_new ); -} diff --git a/Utilities/IpPic/ipPicCopyS.c b/Utilities/IpPic/ipPicCopyS.c deleted file mode 100755 index e59d448877b..00000000000 --- a/Utilities/IpPic/ipPicCopyS.c +++ /dev/null @@ -1,111 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * copys a slice from a pic into a new pic - */ - -/*$Log$ - *Revision 1.7 2002/11/13 17:53:00 ivo - *new ipPic added. - * - *Revision 1.5 2002/04/23 11:06:25 ivo - *mitkIpPicCopySlice behaves now in the same way as mitkIpPicGetSlice: - *2D-slices are copied, no longer hyper-planes of dimension dim-1. - * - *Revision 1.4 2000/05/04 12:52:36 ivo - *inserted BSD style license - * - *Revision 1.3 2000/05/04 12:35:58 ivo - *some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:11 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.0 1993/06/07 19:19:19 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicCopySlice\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor *_mitkIpPicCopySlice( mitkIpPicDescriptor *pic, mitkIpPicDescriptor *pic_in, mitkIpUInt4_t slice ) -{ - mitkIpUInt4_t picsize; - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - pic->type = pic_in->type; - pic->bpe = pic_in->bpe; - pic->dim = 2; - pic->n[0] = pic_in->n[0]; - pic->n[1] = pic_in->n[1]; - pic->data = NULL; - - picsize = _mitkIpPicSize(pic); - - if( slice < 1 - || slice > _mitkIpPicSize(pic_in) / picsize ) - { - mitkIpPicClear(pic); - return( pic ); - } - - pic->data = malloc( picsize ); - - memmove( pic->data, - &((char *)pic_in->data)[(slice-1) * picsize], - picsize ); - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicDelT.c b/Utilities/IpPic/ipPicDelT.c deleted file mode 100755 index 7e860e68167..00000000000 --- a/Utilities/IpPic/ipPicDelT.c +++ /dev/null @@ -1,119 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * deletes a tsv from the pic - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicDelTag\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" -/** deletes a tsv from the pic - */ - - - -static mitkIpPicTSV_t *_mitkIpPicRemoveTag( _mitkIpPicTagsElement_t **head, - _mitkIpPicTagsElement_t *which, - const char *tag ); - -mitkIpPicTSV_t * -mitkIpPicDelTag( mitkIpPicDescriptor *pic, const char *tag ) -{ - _mitkIpPicTagsElement_t *which; - - which = _mitkIpPicFindTag( pic->info->tags_head, tag ); - - return( _mitkIpPicRemoveTag( &(pic->info->tags_head), which, tag ) ); -} - -mitkIpPicTSV_t * -mitkIpPicDelSubTag( mitkIpPicTSV_t *parent, const char *tag ) -{ - _mitkIpPicTagsElement_t *which; - - if( parent->type != mitkIpPicTSV ) - return( NULL ); - - which = _mitkIpPicFindTag( parent->value, tag ); - - if( !which ) - return( NULL ); - - if( which->tsv->type == mitkIpPicTSV ) - return( NULL ); - - parent->n[0]--; - return( _mitkIpPicRemoveTag( (_mitkIpPicTagsElement_t **)&(parent->value), which, tag ) ); -} - -mitkIpPicTSV_t * -_mitkIpPicRemoveTag( _mitkIpPicTagsElement_t **head, _mitkIpPicTagsElement_t *which, const char *tag ) -{ - mitkIpPicTSV_t *tsv = NULL; - - if( which != NULL ) - { - tsv = which->tsv; - - if( which->prev == NULL ) /* which is the current head */ - { - *head = which->next; - - if( *head ) - (*head)->prev = NULL; - } - else if( which->next == NULL ) /* which is the current tail */ - { - which->prev->next = NULL; - } - else /* which is somewhere if the list */ - { - which->prev->next = which->next; - which->next->prev = which->prev; - } - - free( which ); - } - - return( tsv ); -} diff --git a/Utilities/IpPic/ipPicElements.c b/Utilities/IpPic/ipPicElements.c deleted file mode 100755 index c4e28f63818..00000000000 --- a/Utilities/IpPic/ipPicElements.c +++ /dev/null @@ -1,65 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * calculates number of Elements in the data - */ - -#ifndef lint - static char *what = { "@(#)_mitkIpPicElements\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpUInt4_t _mitkIpPicElements( mitkIpPicDescriptor *pic ) -{ - unsigned int i; - mitkIpUInt4_t elements; - - if( pic->dim == 0 ) - return( 0 ); - - elements = pic->n[0]; - for( i = 1; i < pic->dim; i++ ) - elements *= pic->n[i]; - - return( elements ); -} diff --git a/Utilities/IpPic/ipPicFree.c b/Utilities/IpPic/ipPicFree.c deleted file mode 100755 index 7aa2abea49a..00000000000 --- a/Utilities/IpPic/ipPicFree.c +++ /dev/null @@ -1,113 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * frees all space used by a picDescriptor - * - * $Log$ - * Revision 1.8 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.6 2000/05/04 12:52:37 ivo - * inserted BSD style license - * - * Revision 1.5 2000/05/04 12:35:59 ivo - * some doxygen comments. - * - * Revision 1.4 1998/09/16 18:37:34 andre - * added mitkIpPicFreeTag - * - * Revision 1.3 1998/09/16 18:32:45 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:12 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:58 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicFree\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -void mitkIpPicFree( mitkIpPicDescriptor *pic ) -{ - if( pic != NULL ) - { - mitkIpPicClear( pic ); - - if( pic->info != NULL ) - { - free( pic->info ); - } - - free( pic ); - - pic = NULL; - } -} - -void -mitkIpPicFreeTag( mitkIpPicTSV_t *tsv ) -{ - if( tsv ) - { - if( tsv->value ); - free( tsv->value ); - - free( tsv ); - } -} diff --git a/Utilities/IpPic/ipPicGet.c b/Utilities/IpPic/ipPicGet.c deleted file mode 100755 index 5d80efef8a5..00000000000 --- a/Utilities/IpPic/ipPicGet.c +++ /dev/null @@ -1,318 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a PicFile from disk - * - * $Log$ - * Revision 1.16 2004/01/16 22:11:59 andre - * big endian bug fix - * - * Revision 1.15 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.13 2002/02/27 09:02:56 andre - * zlib changes - * - * Revision 1.12 2002/02/27 08:54:43 andre - * zlib changes - * - * Revision 1.11 2000/05/04 12:52:37 ivo - * inserted BSD style license - * - * Revision 1.10 2000/02/16 14:29:20 andre - * *** empty log message *** - * - * Revision 1.9 1999/11/28 18:22:42 andre - * *** empty log message *** - * - * Revision 1.8 1999/11/28 16:29:43 andre - * *** empty log message *** - * - * Revision 1.7 1999/11/27 20:03:48 andre - * *** empty log message *** - * - * Revision 1.6 1999/11/27 19:29:43 andre - * *** empty log message *** - * - * Revision 1.5 1998/09/04 17:45:54 andre - * *** empty log message *** - * - * Revision 1.4 1998/05/06 14:13:15 andre - * added info->pixel_start_in_file - * - * Revision 1.3 1997/10/20 13:35:39 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:13 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicGet\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicFile_t -_mitkIpPicOpenPicFileIn( const char *path ) -{ - mitkIpPicFile_t infile; - - if( path == NULL ) - infile = stdin; - else if( strcmp(path, "stdin") == 0 ) - infile = stdin; - else - infile = mitkIpPicFOpen( path, "rb" ); - - if( !infile ) - { - char buff[1024]; - - sprintf( buff, "%s.gz", path ); - - infile = mitkIpPicFOpen( buff, "rb" ); - } - - return( infile ); -} - -mitkIpPicDescriptor * -mitkIpPicGet( const char *infile_name, mitkIpPicDescriptor *pic ) -{ - mitkIpPicFile_t infile; - - mitkIpPicTag_t tag_name; - mitkIpUInt4_t len; - - mitkIpUInt4_t to_read; - - infile = _mitkIpPicOpenPicFileIn( infile_name ); - - if( !infile ) - { - /*ipPrintErr( "mitkIpPicGet: sorry, error opening infile\n" );*/ - return( NULL ); - } - - /* read infile */ - mitkIpPicFRead( tag_name, 1, 4, infile ); - - if( strncmp( "\037\213", tag_name, 2 ) == 0 ) - { - fprintf( stderr, "mitkIpPicGetHeader: sorry, can't read compressed file\n" ); - return( NULL ); - } - else if( strncmp( mitkIpPicVERSION, tag_name, 4 ) != 0 ) - { - if( pic == NULL ) - pic = _mitkIpPicOldGet( infile, - NULL ); - else - _mitkIpPicOldGet( infile, - pic ); - if( infile != stdin ) - mitkIpPicFClose( infile ); - return( pic ); - } - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - mitkIpPicFRead( &(tag_name[4]), 1, sizeof(mitkIpPicTag_t)-4, infile ); - strncpy( pic->info->version, tag_name, _mitkIpPicTAGLEN ); - - mitkIpPicFReadLE( &len, sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->n), sizeof(mitkIpUInt4_t), pic->dim, infile ); - - - to_read = len - 3 * sizeof(mitkIpUInt4_t) - - pic->dim * sizeof(mitkIpUInt4_t); -#if 0 - mitkIpPicFSeek( infile, to_read, SEEK_CUR ); -#else - pic->info->tags_head = _mitkIpPicReadTags( pic->info->tags_head, to_read, infile, mitkIpPicEncryptionType(pic) ); -#endif - - pic->info->write_protect = mitkIpFalse; - -#ifdef WIN - if ((pic->hdata = GlobalAlloc( GMEM_MOVEABLE, _mitkIpPicSize(pic) )) != 0) - pic->data = GlobalLock( pic->hdata ); -#else - pic->data = malloc( _mitkIpPicSize(pic) ); -#endif - - pic->info->pixel_start_in_file = mitkIpPicFTell( infile ); - if( pic->type == mitkIpPicNonUniform ) - mitkIpPicFRead( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), infile ); - else - mitkIpPicFReadLE( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), infile ); - - if( infile != stdin ) - mitkIpPicFClose( infile ); - -#ifdef WIN - GlobalUnlock( pic->hdata ); -#endif - - return( pic ); -} - -_mitkIpPicTagsElement_t * -_mitkIpPicReadTags( _mitkIpPicTagsElement_t *head, mitkIpUInt4_t bytes_to_read, FILE *stream, char encryption_type ) -{ - while( bytes_to_read > 0 ) - { - mitkIpPicTSV_t *tsv; - - mitkIpPicTag_t tag_name; - mitkIpUInt4_t len; - - /*printf( "bytes_to_read: %i\n", bytes_to_read ); */ - - tsv = malloc( sizeof(mitkIpPicTSV_t) ); - - mitkIpPicFRead( &tag_name, 1, sizeof(mitkIpPicTag_t), stream ); - strncpy( tsv->tag, tag_name, _mitkIpPicTAGLEN ); - tsv->tag[_mitkIpPicTAGLEN] = '\0'; - - mitkIpPicFReadLE( &len, sizeof(mitkIpUInt4_t), 1, stream ); - - mitkIpPicFReadLE( &(tsv->type), sizeof(mitkIpUInt4_t), 1, stream ); - mitkIpPicFReadLE( &(tsv->bpe), sizeof(mitkIpUInt4_t), 1, stream ); - mitkIpPicFReadLE( &(tsv->dim), sizeof(mitkIpUInt4_t), 1, stream ); - - - mitkIpPicFReadLE( &(tsv->n), sizeof(mitkIpUInt4_t), tsv->dim, stream ); - - /*printf( "%.*s\n", _mitkIpPicTAGLEN, tsv->tag ); - printf( " %i\n", len ); - printf( " %i %i %i %i %i\n", - tsv->type, - tsv->bpe, - tsv->dim, - tsv->n[0], - tsv->n[1] ); */ - - if( tsv->type == mitkIpPicTSV ) - { - tsv->value = NULL; - tsv->value = _mitkIpPicReadTags( tsv->value, - len - 3 * sizeof(mitkIpUInt4_t) - - tsv->dim * sizeof(mitkIpUInt4_t), - stream, - encryption_type ); - } - else - { - mitkIpUInt4_t elements; - - elements = _mitkIpPicTSVElements( tsv ); - - if( tsv->type == mitkIpPicASCII - || tsv->type == mitkIpPicNonUniform ) - tsv->bpe = 8; - -assert( elements * tsv->bpe / 8 == len - - 3 * sizeof(mitkIpUInt4_t) - - tsv->dim * sizeof(mitkIpUInt4_t) ); - - if( tsv->type == mitkIpPicASCII ) - tsv->value = malloc( elements+1 * tsv->bpe / 8 ); - else - tsv->value = malloc( elements * tsv->bpe / 8 ); - - mitkIpPicFReadLE( tsv->value, tsv->bpe / 8, elements, stream ); - - if( tsv->type == mitkIpPicASCII ) - ((char *)(tsv->value))[elements] = '\0'; - - if( encryption_type == 'e' - && ( tsv->type == mitkIpPicASCII - || tsv->type == mitkIpPicNonUniform ) ) - { - if( tsv->type == mitkIpPicNonUniform ) - { - sprintf( tsv->tag, "*** ENCRYPTED ***" ); - tsv->tag[_mitkIpPicTAGLEN] = '\0'; - } - - free( tsv->value ); - - tsv->value = strdup( "*** ENCRYPTED ***" ); - tsv->n[0] = strlen(tsv->value); - tsv->type = mitkIpPicASCII; - tsv->dim = 1; - } - } - - head = _mitkIpPicInsertTag( head, tsv ); - - bytes_to_read -= 32 /* name */ - + sizeof(mitkIpUInt4_t) /* len */ - + len; /* type + bpe + dim + n[] + data */ - } - return( head ); -} diff --git a/Utilities/IpPic/ipPicGetH.c b/Utilities/IpPic/ipPicGetH.c deleted file mode 100755 index ef0b36f5d1c..00000000000 --- a/Utilities/IpPic/ipPicGetH.c +++ /dev/null @@ -1,155 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads the Header of a PicFile from disk - * - * $Log$ - * Revision 1.10 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.8 2000/05/04 12:52:37 ivo - * inserted BSD style license - * - * Revision 1.7 2000/05/04 12:35:59 ivo - * some doxygen comments. - * - * Revision 1.6 1999/11/28 16:27:21 andre - * *** empty log message *** - * - * Revision 1.5 1999/11/28 00:36:09 andre - * *** empty log message *** - * - * Revision 1.4 1999/11/27 20:02:41 andre - * *** empty log message *** - * - * Revision 1.3 1999/11/27 19:15:26 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:13 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicGetHeader\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor * -mitkIpPicGetHeader( const char *infile_name, mitkIpPicDescriptor *pic ) -{ - mitkIpPicFile_t infile; - - mitkIpPicTag_t tag_name; - mitkIpUInt4_t len; - - infile = _mitkIpPicOpenPicFileIn( infile_name ); - - if( infile == NULL ) - { - /*ipPrintErr( "mitkIpPicGetHeader: sorry, error opening infile\n" );*/ - return( NULL ); - } - - /* read infile */ - mitkIpPicFRead( &(tag_name[0]), 1, 4, infile ); - - if( strncmp( "\037\213", tag_name, 2 ) == 0 ) - { - fprintf( stderr, "mitkIpPicGetHeader: sorry, can't read compressed file\n" ); - return( NULL ); - } - else if( strncmp( mitkIpPicVERSION, tag_name, 4 ) != 0 ) - { - /* - if( pic == NULL ) - pic = _mitkIpPicOldGetHeader( infile, - NULL ); - else - _mitkIpPicOldGetHeader( infile, - pic ); - if( infile != stdin ) - mitkIpPicFClose( infile ); - return( pic ); - */ - return ( NULL ); - } - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - pic->info->write_protect = mitkIpTrue; - - mitkIpPicFRead( &(tag_name[4]), 1, sizeof(mitkIpPicTag_t)-4, infile ); - strncpy( pic->info->version, tag_name, _mitkIpPicTAGLEN ); - - mitkIpPicFReadLE( &len, sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->n), sizeof(mitkIpUInt4_t), pic->dim, infile ); - - - if( infile != stdin ) - mitkIpPicFClose( infile ); - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicGetMem.c b/Utilities/IpPic/ipPicGetMem.c deleted file mode 100755 index 880857318b5..00000000000 --- a/Utilities/IpPic/ipPicGetMem.c +++ /dev/null @@ -1,219 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/* - *-------------------------------------------------------------------- - * DESCRIPTION - * creates a PicStructure from memory block - * - * FUNCTION DECLARATION - * - * - * PARAMETERS - * - * - * AUTHOR & DATE - * Harald Evers 15.7.98 - * - * UPDATES - * - *-------------------------------------------------------------------- - * - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicGetMem\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor *mitkIpPicGetMem( mitkIpUInt1_t *mem_pic ) -{ - mitkIpPicDescriptor *pic; - mitkIpUInt4_t len; - mitkIpUInt4_t to_read; - mitkIpUInt1_t *mem_ptr = mem_pic; - - if( !mem_pic ) - return( NULL ); - - pic = mitkIpPicNew(); - mitkIpPicClear( pic ); - memmove( &(pic->info->version), mem_ptr, sizeof(mitkIpPicTag_t) ); - mem_ptr += sizeof(mitkIpPicTag_t); - if( strncmp( mitkIpPicVERSION, pic->info->version, 4 ) != 0 ) - { - mitkIpPicFree( pic ); - return( NULL ); - } - - /*memmove( &len, mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( mem_ptr, &len, sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(pic->type), mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( mem_ptr, &(pic->type), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(pic->bpe), mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( mem_ptr, &(pic->bpe), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(pic->dim), mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( mem_ptr, &(pic->dim), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(pic->n), mem_ptr, pic->dim * sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( mem_ptr, &(pic->n), pic->dim*sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - mem_ptr += pic->dim*sizeof(mitkIpUInt4_t); - - to_read = len - 3 * sizeof(mitkIpUInt4_t) - - pic->dim * sizeof(mitkIpUInt4_t); - pic->info->tags_head = _mitkIpPicReadTagsMem( pic->info->tags_head, - to_read, &mem_ptr, - mitkIpPicEncryptionType(pic) ); - - pic->info->write_protect = mitkIpFalse; - pic->data = malloc( _mitkIpPicSize(pic) ); - - /* - pic->info->pixel_start_in_file = ftell( infile ); - */ - - /*memmove( pic->data, mem_ptr, pic->bpe/8*_mitkIpPicElements(pic) );*/ - mitkIpCpFromLE( mem_ptr, pic->data, _mitkIpPicSize(pic), pic->bpe/8 ); - - return( pic ); -} - -_mitkIpPicTagsElement_t * -_mitkIpPicReadTagsMem( _mitkIpPicTagsElement_t *head, mitkIpUInt4_t bytes_to_read, - mitkIpUInt1_t **mem_ptr, char encryption_type ) -{ - while( bytes_to_read > 0 ) - { - mitkIpPicTSV_t *tsv; - mitkIpUInt4_t len; - - tsv = malloc( sizeof(mitkIpPicTSV_t) ); - - memmove( tsv->tag, *mem_ptr, _mitkIpPicTAGLEN ); - tsv->tag[_mitkIpPicTAGLEN] = '\0'; - *mem_ptr += _mitkIpPicTAGLEN; - - /*memmove( &len, *mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( *mem_ptr, &len, sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(tsv->type), *mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( *mem_ptr, &(tsv->type), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(tsv->bpe), *mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( *mem_ptr, &(tsv->bpe), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(tsv->dim), *mem_ptr, sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( *mem_ptr, &(tsv->dim), sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - - /*memmove( &(tsv->n), *mem_ptr, tsv->dim*sizeof(mitkIpUInt4_t) );*/ - mitkIpCpFromLE( *mem_ptr, &(tsv->n), tsv->dim*sizeof(mitkIpUInt4_t), sizeof(mitkIpUInt4_t) ); - *mem_ptr += tsv->dim*sizeof(mitkIpUInt4_t); - - if( tsv->type == mitkIpPicTSV ) - { - tsv->value = NULL; - tsv->value = _mitkIpPicReadTagsMem( tsv->value, - len - 3 * sizeof(mitkIpUInt4_t) - - tsv->dim * sizeof(mitkIpUInt4_t), - mem_ptr, - encryption_type ); - } - else - { - mitkIpUInt4_t elements; - - elements = _mitkIpPicTSVElements( tsv ); - - if( tsv->type == mitkIpPicASCII - || tsv->type == mitkIpPicNonUniform ) - tsv->bpe = 8; - - if( tsv->type == mitkIpPicASCII ) - tsv->value = malloc( (elements+1) * (tsv->bpe / 8) ); - else - tsv->value = malloc( elements * tsv->bpe / 8 ); - - /*memmove( tsv->value, *mem_ptr, tsv->bpe/8*_mitkIpPicTSVElements(tsv) );*/ - mitkIpCpFromLE( *mem_ptr, tsv->value, _mitkIpPicTSVSize(tsv), tsv->bpe/8 ); - *mem_ptr += tsv->bpe/8*_mitkIpPicTSVElements(tsv); - - if( tsv->type == mitkIpPicASCII ) - ((char *)(tsv->value))[elements] = '\0'; - - if( encryption_type == 'e' - && ( tsv->type == mitkIpPicASCII - || tsv->type == mitkIpPicNonUniform ) ) - { - if( tsv->type == mitkIpPicNonUniform ) - { - sprintf( tsv->tag, "*** ENCRYPTED ***" ); - tsv->tag[_mitkIpPicTAGLEN] = '\0'; - } - - if( tsv->value ) - free( tsv->value ); - - tsv->value = strdup( "*** ENCRYPTED ***" ); - tsv->n[0] = (mitkIpUInt4_t)strlen(tsv->value); - tsv->type = mitkIpPicASCII; - tsv->dim = 1; - } - } - - head = _mitkIpPicInsertTag( head, tsv ); - - bytes_to_read -= 32 /* name */ - + sizeof(mitkIpUInt4_t) /* len */ - + len; /* type + bpe + dim + n[] + data */ - } - return( head ); -} diff --git a/Utilities/IpPic/ipPicGetS.c b/Utilities/IpPic/ipPicGetS.c deleted file mode 100755 index d0fc1495d7b..00000000000 --- a/Utilities/IpPic/ipPicGetS.c +++ /dev/null @@ -1,208 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a slice from a PicFile - * - * $Log$ - * Revision 1.12 2006/03/03 14:07:58 maleike - * try to fix warning "cast from pointer to integer of different size" - * - * Revision 1.11 2005/10/09 08:56:31 ivo - * FIX: warning: comparison between pointer and integer - * - * Revision 1.10 2003/02/25 16:16:53 andre - * *** empty log message *** - * - * Revision 1.9 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.7 2002/02/27 09:05:15 andre - * zlib changes - * - * Revision 1.6 2002/02/27 09:02:56 andre - * zlib changes - * - * Revision 1.5 2002/02/27 08:54:43 andre - * zlib changes - * - * Revision 1.4 2000/05/04 12:52:38 ivo - * inserted BSD style license - * - * Revision 1.3 2000/05/04 12:35:59 ivo - * some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:14 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/31 11:26:16 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicGetSlice\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor *mitkIpPicGetSlice( const char *infile_name, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ) -{ - mitkIpPicFile_t infile; - - mitkIpPicTag_t tag_name; - mitkIpUInt4_t len; - mitkIpUInt4_t skip; - - int number = 1; - - unsigned long int picsize; - - if( infile_name == NULL ) - infile = stdin; - else if( strcmp(infile_name, "stdin") == 0 ) - infile = stdin; - else - infile = _mitkIpPicOpenPicFileIn( infile_name ); - - if( infile == NULL ) - { - /*ipPrintErr( "mitkIpPicGetSlice: sorry, error opening infile\n" );*/ - return( NULL ); - } - - /* read infile */ - mitkIpPicFRead( &(tag_name[0]), 1, 4, infile ); - - if( strncmp( mitkIpPicVERSION, tag_name, 4 ) != 0 ) - { - if( pic == NULL ) - pic = _mitkIpPicOldGetSlice( infile, - NULL, - slice ); - else - _mitkIpPicOldGetSlice( infile, - pic, - slice ); - if( infile != stdin ) - mitkIpPicFClose( infile ); - return( pic ); - } - - - if( (void*)pic == (void*)3 ) - { - pic = NULL; - number = 3; - } - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - mitkIpPicFRead( &(tag_name[4]), 1, sizeof(mitkIpPicTag_t)-4, infile ); - strncpy( pic->info->version, tag_name, _mitkIpPicTAGLEN ); - - mitkIpPicFReadLE( &len, sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &(pic->n), sizeof(mitkIpUInt4_t), pic->dim, infile ); - - skip = len - 3 * sizeof(mitkIpUInt4_t) - - pic->dim * sizeof(mitkIpUInt4_t); - mitkIpPicFSeek( infile, skip, SEEK_CUR ); - - picsize = _mitkIpPicSize(pic); - - pic->dim = 2; - - if( slice < 1 - || slice > picsize / _mitkIpPicSize(pic) ) - { - mitkIpPicClear( pic ); - return( pic ); - } - - if( number < 1 ) - number = 1; - - if( slice + number - 1 > pic->n[2] ) - number = pic->n[2] - slice + 1; - - - pic->info->write_protect = mitkIpTrue; - - picsize = _mitkIpPicSize(pic); - - mitkIpPicFSeek( infile, picsize * (slice - 1), SEEK_CUR ); - - if( number > 1 ) - { - pic->dim = 3; - pic->n[2] = number; - } - - picsize = _mitkIpPicSize(pic); - - pic->data = malloc( picsize ); - - mitkIpPicFReadLE( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), infile ); - - if( infile != stdin ) - mitkIpPicFClose( infile ); - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicGetT.c b/Utilities/IpPic/ipPicGetT.c deleted file mode 100755 index ff7da68e6a1..00000000000 --- a/Utilities/IpPic/ipPicGetT.c +++ /dev/null @@ -1,152 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a tag from a PicFile - * - * $Log$ - * Revision 1.12 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.10 2000/05/04 12:52:38 ivo - * inserted BSD style license - * - * Revision 1.9 2000/05/04 12:35:59 ivo - * some doxygen comments. - * - * Revision 1.8 1999/11/28 18:21:37 andre - * *** empty log message *** - * - * Revision 1.7 1999/11/28 16:27:21 andre - * *** empty log message *** - * - * Revision 1.6 1999/11/28 00:36:09 andre - * *** empty log message *** - * - * Revision 1.5 1999/11/27 19:32:13 andre - * *** empty log message *** - * - * Revision 1.2.2.2 1998/03/25 15:03:36 andre - * added info->pixel_start_in_file - * - * Revision 1.2.2.1 1997/09/15 13:47:06 andre - * added encryption - * - * Revision 1.2 1997/09/15 13:21:14 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicGetTag\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor * -mitkIpPicGetTags( const char *infile_name, mitkIpPicDescriptor *pic ) -{ - mitkIpPicFile_t infile; - - mitkIpPicTag_t tag_name; - mitkIpUInt4_t dummy; - mitkIpUInt4_t len; - mitkIpUInt4_t dim; - mitkIpUInt4_t n[_mitkIpPicNDIM]; - - mitkIpUInt4_t to_read; - - infile = _mitkIpPicOpenPicFileIn( infile_name ); - - if( infile == NULL ) - { - /*ipPrintErr( "mitkIpPicGetTags: sorry, error opening infile\n" );*/ - return( NULL ); - } - - if( pic != NULL ) - pic->info->write_protect = mitkIpFalse; - - /* read infile */ - mitkIpPicFRead( &(tag_name[0]), 1, 4, infile ); - - if( strncmp( mitkIpPicVERSION, tag_name, 4 ) != 0 ) - { - if( infile != stdin ) - mitkIpPicFClose( infile ); - return( pic ); - } - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicFRead( &(tag_name[4]), 1, sizeof(mitkIpPicTag_t)-4, infile ); - /*strncpy( pic->info->version, tag_name, _mitkIpPicTAGLEN );*/ - - mitkIpPicFReadLE( &len, sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( &dummy, sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &dummy, sizeof(mitkIpUInt4_t), 1, infile ); - mitkIpPicFReadLE( &dim, sizeof(mitkIpUInt4_t), 1, infile ); - - mitkIpPicFReadLE( n, sizeof(mitkIpUInt4_t), dim, infile ); - - - to_read = len - 3 * sizeof(mitkIpUInt4_t) - - dim * sizeof(mitkIpUInt4_t); - - pic->info->tags_head = _mitkIpPicReadTags( pic->info->tags_head, to_read, infile, mitkIpPicEncryptionType(pic) ); - - pic->info->pixel_start_in_file = mitkIpPicFTell( infile ); - - if( infile != stdin ) - mitkIpPicFClose( infile ); - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicInfo.c b/Utilities/IpPic/ipPicInfo.c deleted file mode 100755 index ef2580f9ec3..00000000000 --- a/Utilities/IpPic/ipPicInfo.c +++ /dev/null @@ -1,249 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * prints information about an mitkIpPicDescriptor - */ - -#ifndef lint - static char *what = { "@(#)_mitkIpPicInfo\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** prints information about an mitkIpPicDescriptor - * - * @param stream the output FILE* - * @param pic the pic - * @param flags which information to show - * - * @return none - * - * AUTHOR & DATE - * Andre Schroeter 03.10.94 - * - */ - - -#define INT_MAXIMUM 5 -#define ASCII_MAX 60 - -/* -** private macros -*/ -#define Min(x, y) (((x) < (y)) ? (x) : (y)) -#define Max(x, y) (((x) > (y)) ? (x) : (y)) - -void _mitkIpPicInfo( FILE *stream, mitkIpPicDescriptor *pic, mitkIpUInt4_t flags ) -{ - mitkIpUInt4_t i; - - fprintf( stream, "%.*s\n", _mitkIpPicTAGLEN, pic->info->version ); - fprintf( stream, "--------------------\n" ); - - fprintf( stream, "type: %s [%i]\n", mitkIpPicTypeName(pic->type), pic->type ); - - fprintf( stream, "bpe : %i\n", pic->bpe ); - - fprintf( stream, "dim : %i ", pic->dim ); - for( i=0; idim; i++ ) - fprintf( stream, "[%i] ", pic->n[i] ); - fprintf( stream, "\n" ); - - if( pic != NULL - && pic->info->tags_head != NULL ) - fprintf( stream, "--------------------\n" ); - - _mitkIpPicInfoPrintTags( stream, - pic->info->tags_head, - 1, - flags ); - - fprintf( stream, "--------------------\n" ); - fprintf( stream, "size of the image data: %u\n", _mitkIpPicSize( pic ) ); -} - -void _mitkIpPicInfoPrintTags( FILE *stream, _mitkIpPicTagsElement_t* head, mitkIpUInt4_t level, mitkIpUInt4_t flags ) -{ - mitkIpUInt4_t i; - _mitkIpPicTagsElement_t *current; - - char *indent; - - indent = malloc( level*4 + 1 ); - for( i = 0; i < level*4-2; i++ ) - indent[i] = ' '; - indent[i] = '\0'; - - current = head; - while( current != NULL ) - { - fprintf( stream, "%s%.*s\n", indent, _mitkIpPicTAGLEN, current->tsv->tag ); - if( !(flags & _mitkIpPicInfoSHORT) ) - { - fprintf( stream, "%s type: %s [%i]\n", indent, - mitkIpPicTypeName(current->tsv->type), current->tsv->type ); - fprintf( stream, "%s bpe : %i\n", indent, current->tsv->bpe ); - fprintf( stream, "%s dim : %i ", indent, current->tsv->dim ); - - for( i=0; itsv->dim; i++ ) - fprintf( stream, "[%i] ", current->tsv->n[i] ); - fprintf( stream, "\n" ); - } - - if( current->tsv->type == mitkIpPicTSV ) - { - _mitkIpPicInfoPrintTags( stream, - current->tsv->value, - level+1, - flags ); - } - else - { - fprintf( stream, "%s value : ", indent ); - - switch( current->tsv->type ) - { - case mitkIpPicASCII: - if( current->tsv->n[0] > ASCII_MAX ) - fprintf( stream, "\"%.*s\"...\n", - ASCII_MAX, - (char *)current->tsv->value ); - else - fprintf( stream, "\"%.*s\"\n", - (int)current->tsv->n[0], - (char *)current->tsv->value ); - break; - case mitkIpPicUInt: - for( i = 0; i < Min( INT_MAXIMUM, current->tsv->n[0] ); i++ ) - switch( current->tsv->bpe ) - { - case 8: - fprintf( stream, "%3u ", - ((mitkIpUInt1_t *)current->tsv->value)[i] ); - break; - case 16: - fprintf( stream, "%5u ", - ((mitkIpUInt2_t *)current->tsv->value)[i] ); - break; - case 32: - fprintf( stream, "%11u ", - ((mitkIpUInt4_t *)current->tsv->value)[i] ); - break; - default: - fprintf( stream, "???" ); - break; - } - if( current->tsv->n[0] > INT_MAXIMUM ) - fprintf( stream, "..." ); - fprintf( stream, "\n" ); - if( current->tsv->dim > 1 ) - { - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - } - break; - case mitkIpPicInt: - for( i = 0; i < Min( INT_MAXIMUM, current->tsv->n[0] ); i++ ) - switch( current->tsv->bpe ) - { - case 8: - fprintf( stream, "%3i ", - ((mitkIpInt1_t *)current->tsv->value)[i] ); - break; - case 16: - fprintf( stream, "%5i ", - ((mitkIpInt2_t *)current->tsv->value)[i] ); - break; - case 32: - fprintf( stream, "%11i ", - ((mitkIpInt4_t *)current->tsv->value)[i] ); - break; - default: - fprintf( stream, "???" ); - break; - } - if( current->tsv->n[0] > INT_MAXIMUM ) - fprintf( stream, "..." ); - fprintf( stream, "\n" ); - if( current->tsv->dim > 1 ) - { - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - } - break; - case mitkIpPicFloat: - for( i = 0; i < Min( INT_MAXIMUM, current->tsv->n[0] ); i++ ) - switch( current->tsv->bpe ) - { - case 32: - fprintf( stream, "%5.5f ", - ((mitkIpFloat4_t *)current->tsv->value)[i] ); - break; - case 64: - fprintf( stream, "%5.5f ", - ((mitkIpFloat8_t *)current->tsv->value)[i] ); - break; - default: - fprintf( stream, "???" ); - break; - } - if( current->tsv->n[0] > INT_MAXIMUM ) - fprintf( stream, "..." ); - fprintf( stream, "\n" ); - if( current->tsv->dim > 1 ) - { - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - fprintf( stream, "%s .\n", indent ); - } - break; - default: - fprintf( stream, "???\n" ); - break; - } - } - - current = current->next; - } - free( indent ); -} diff --git a/Utilities/IpPic/ipPicNew.c b/Utilities/IpPic/ipPicNew.c deleted file mode 100755 index 7e1045c51c2..00000000000 --- a/Utilities/IpPic/ipPicNew.c +++ /dev/null @@ -1,105 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * Allocates memory for a new PicDescriptor - * - * $Log$ - * Revision 1.7 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.5 2000/05/04 12:52:39 ivo - * inserted BSD style license - * - * Revision 1.4 2000/05/04 12:36:00 ivo - * some doxygen comments. - * - * Revision 1.3 1999/11/27 19:15:08 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:16 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.0 1993/04/06 09:54:58 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicNew\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicDescriptor *mitkIpPicNew( void ) -{ - mitkIpPicDescriptor *pic; - - pic = malloc( sizeof(mitkIpPicDescriptor) ); - - if( pic != NULL ) - { - pic->data = NULL; - pic->type = mitkIpPicUnknown; - - pic->info = malloc( sizeof(_mitkIpPicInfo_t) ); - - strncpy( pic->info->version, mitkIpPicVERSION, _mitkIpPicTAGLEN ); - - pic->info->tags_head = NULL; - - pic->info->write_protect = mitkIpFalse; - pic->info->pixel_start_in_file = 0; - pic->info->lender = 0; - pic->info->borrower = 0; - pic->info->ref = 1; - } - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicNewT.c b/Utilities/IpPic/ipPicNewT.c deleted file mode 100755 index 502317ed36d..00000000000 --- a/Utilities/IpPic/ipPicNewT.c +++ /dev/null @@ -1,77 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a tag from a PicFile - * - * $Log$ - * Revision 1.6 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.4 2000/05/04 12:52:39 ivo - * inserted BSD style license - * - * Revision 1.3 2000/05/04 12:36:00 ivo - * some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:16 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicNewTag\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -mitkIpPicTSV *mitkIpPicNewTag( ) -{ - -} diff --git a/Utilities/IpPic/ipPicOldGet.c b/Utilities/IpPic/ipPicOldGet.c deleted file mode 100755 index a3ea61fcd25..00000000000 --- a/Utilities/IpPic/ipPicOldGet.c +++ /dev/null @@ -1,167 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a oldstyle PicFile from disk - * - * $Log$ - * Revision 1.7 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.5 2000/05/04 12:52:39 ivo - * inserted BSD style license - * - * Revision 1.4 2000/05/04 12:36:00 ivo - * some doxygen comments. - * - * Revision 1.3 2000/01/13 14:03:07 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:17 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.2 1993/04/26 17:40:09 andre - * 8 bit images from old pic format are now unsigned - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)_mitkIpPicOldGet\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -#ifdef DOS -#include "mitkIpPicOP.h" -#else -#include "mitkIpPicOldP.h" -#endif - -mitkIpPicDescriptor * _mitkIpPicOldGet( FILE *infile, mitkIpPicDescriptor *pic ) -{ - _mitkIpPicOldHeader old_pic; -#ifdef WIN - HANDLE hbuff; -#endif - - /*unsigned char *text;*/ - void *buff; - - unsigned long int elements; - - /* read infile */ - size_t ignored = mitkIpFReadLE( &(old_pic.dummy1), sizeof(mitkIpUInt4_t), 4, infile ); - if( old_pic.conv <= 0 || old_pic.conv > 6 ) - { - old_pic.conv = 3; - old_pic.rank = 2; - } - - ignored = mitkIpFReadLE( &(old_pic.n1), sizeof(mitkIpUInt4_t), old_pic.rank, infile ); - if( old_pic.rank == 3 && old_pic.n3 == 1 ) - old_pic.rank = 2; - - ignored = mitkIpFReadLE( &(old_pic.type), sizeof(mitkIpUInt4_t), 3, infile ); - if( old_pic.ntxt ) - { - /*text = (unsigned char *)malloc( old_pic.ltxt ); - ignored = mitkIpFReadLE( text, 1, old_pic.ltxt, infile );*/ - fseek( infile, old_pic.ltxt, SEEK_CUR ); - } - - - elements = old_pic.n1 * old_pic.n2; - if( old_pic.rank == 3 ) - elements *= old_pic.n3; - -#ifdef WIN - if ((hbuff = GlobalAlloc( GMEM_MOVEABLE, elements * old_pic.type )) != 0) - buff = GlobalLock( hbuff ); -#else - buff = malloc( elements * old_pic.type ); -#endif - - ignored = mitkIpFReadLE( buff, old_pic.type, elements, infile ); - - /* convert to the new pic3 format */ - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - pic->data = (void *)buff; - if( old_pic.type == 1 ) - pic->type = mitkIpPicUInt; - else - pic->type = (mitkIpPicType_t)old_pic.conv; - pic->bpe = old_pic.type*8; - pic->dim = old_pic.rank; - pic->n[0] = old_pic.n1; - pic->n[1] = old_pic.n2; - pic->n[2] = old_pic.n3; - pic->n[3] = old_pic.n4; - pic->n[4] = old_pic.n5; - pic->n[5] = old_pic.n6; - pic->n[6] = old_pic.n7; - pic->n[7] = old_pic.n8; - -#ifdef WIN - GlobalUnlock( hbuff ); - pic->hdata = hbuff; -#endif - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicOldGetH.c b/Utilities/IpPic/ipPicOldGetH.c deleted file mode 100755 index 07bd7b9cbfe..00000000000 --- a/Utilities/IpPic/ipPicOldGetH.c +++ /dev/null @@ -1,142 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads the header of a oldstyle PicFile from disk - * - * $Log$ - * Revision 1.7 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.5 2000/05/04 12:52:39 ivo - * inserted BSD style license - * - * Revision 1.4 2000/05/04 12:36:00 ivo - * some doxygen comments. - * - * Revision 1.3 2000/01/13 14:03:07 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:17 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.2 1993/04/26 17:40:09 andre - * 8 bit images from old pic format are now unsigned - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)_mitkIpPicOldGetHeader\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -#ifdef DOS -#include "mitkIpPicOP.h" -#else -#include "mitkIpPicOldP.h" -#endif - -mitkIpPicDescriptor * _mitkIpPicOldGetHeader( FILE *infile, mitkIpPicDescriptor *pic ) -{ - _mitkIpPicOldHeader old_pic; - - /*unsigned char *text;*/ - - /* read infile */ - size_t ignored = mitkIpFReadLE( &(old_pic.dummy1), sizeof(mitkIpUInt4_t), 4, infile ); - if( old_pic.conv <= 0 || old_pic.conv > 6 ) - { - old_pic.conv = 3; - old_pic.rank = 2; - } - - ignored = mitkIpFReadLE( &(old_pic.n1), sizeof(mitkIpUInt4_t),old_pic.rank, infile ); - if( old_pic.rank == 3 && old_pic.n3 == 1 ) - old_pic.rank = 2; - - ignored = mitkIpFReadLE( &(old_pic.type), sizeof(mitkIpUInt4_t), 3, infile ); - if( old_pic.ntxt ) - { - /*text = (unsigned char *)malloc( old_pic.ltxt ); - ignored = mitkIpFReadLE( text, 1, old_pic.ltxt, infile );*/ - fseek( infile, old_pic.ltxt, SEEK_CUR ); - } - - /* convert to the new pic3 format */ - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - pic->data = NULL; - if( old_pic.type == 1 ) - pic->type = mitkIpPicUInt; - else - pic->type = (mitkIpPicType_t)old_pic.conv; - pic->bpe = old_pic.type*8; - pic->dim = old_pic.rank; - pic->n[0] = old_pic.n1; - pic->n[1] = old_pic.n2; - pic->n[2] = old_pic.n3; - pic->n[3] = old_pic.n4; - pic->n[4] = old_pic.n5; - pic->n[5] = old_pic.n6; - pic->n[6] = old_pic.n7; - pic->n[7] = old_pic.n8; - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicOldGetS.c b/Utilities/IpPic/ipPicOldGetS.c deleted file mode 100755 index ec43f428b4d..00000000000 --- a/Utilities/IpPic/ipPicOldGetS.c +++ /dev/null @@ -1,157 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * reads a slice from an oldstyle PicFile - * - * $Log$ - * Revision 1.7 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.5 2000/05/04 12:52:39 ivo - * inserted BSD style license - * - * Revision 1.4 2000/05/04 12:36:00 ivo - * some doxygen comments. - * - * Revision 1.3 2000/01/13 14:03:07 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:18 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.2 1993/04/26 17:40:09 andre - * 8 bit images from old pic format are now unsigned - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/31 11:42:13 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)_mitkIpPicOldGetSlice\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -#ifdef DOS -#include "mitkIpPicOP.h" -#else -#include "mitkIpPicOldP.h" -#endif - -mitkIpPicDescriptor * _mitkIpPicOldGetSlice( FILE *infile, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ) -{ - _mitkIpPicOldHeader old_pic; - - /*unsigned char *text;*/ - void *buff; - - unsigned long int elements; - - /* read infile */ - size_t ignored = mitkIpFReadLE( &(old_pic.dummy1), sizeof(mitkIpUInt4_t), 4, infile ); - if( old_pic.conv <= 0 || old_pic.conv > 6 ) - { - old_pic.conv = 3; - old_pic.rank = 2; - } - - ignored = mitkIpFReadLE( &(old_pic.n1), sizeof(mitkIpUInt4_t), old_pic.rank, infile ); - if( old_pic.rank == 3 && old_pic.n3 == 1 ) - old_pic.rank = 2; - - ignored = mitkIpFReadLE( &(old_pic.type), sizeof(mitkIpUInt4_t), 3, infile ); - if( old_pic.ntxt ) - { - /*text = (unsigned char *)malloc( old_pic.ltxt ); - ignored = mitkIpFReadLE( text, 1, old_pic.ltxt, infile );*/ - fseek( infile, old_pic.ltxt, SEEK_CUR ); - } - - old_pic.rank = 2; - - elements = old_pic.n1 * old_pic.n2; - if( old_pic.rank == 3 ) - elements *= old_pic.n3; - - fseek( infile, elements * (slice - 1) * old_pic.type, SEEK_CUR ); - - buff = malloc( elements * old_pic.type ); - - ignored = mitkIpFReadLE( buff, old_pic.type, elements, infile ); - - /* convert to the new pic3 format */ - - if( pic == NULL ) - pic = mitkIpPicNew(); - - mitkIpPicClear( pic ); - - pic->data = (void *)buff; - if( old_pic.type == 1 ) - pic->type = mitkIpPicUInt; - else - pic->type = (mitkIpPicType_t)old_pic.conv; - pic->bpe = old_pic.type*8; - pic->dim = old_pic.rank; - pic->n[0] = old_pic.n1; - pic->n[1] = old_pic.n2; - pic->n[2] = old_pic.n3; - pic->n[3] = old_pic.n4; - pic->n[4] = old_pic.n5; - pic->n[5] = old_pic.n6; - pic->n[6] = old_pic.n7; - pic->n[7] = old_pic.n8; - - return( pic ); -} diff --git a/Utilities/IpPic/ipPicPut.c b/Utilities/IpPic/ipPicPut.c deleted file mode 100755 index 8708c8aecf5..00000000000 --- a/Utilities/IpPic/ipPicPut.c +++ /dev/null @@ -1,321 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * writes a PicFile to disk - * - * $Log$ - * Revision 1.17 2005/09/09 09:14:45 ivo - * FIX: warnings on windows - * - * Revision 1.16 2005/06/21 11:22:48 ivo - * CHG: encrypted only a warning instead of an error on write - * - * Revision 1.15 2003/02/18 12:28:23 andre - * write compressed pic files - * - * Revision 1.14 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.12 2002/02/27 09:06:28 andre - * zlib changes - * - * Revision 1.11 2000/05/04 12:52:40 ivo - * inserted BSD style license - * - * Revision 1.10 2000/05/04 12:36:01 ivo - * some doxygen comments. - * - * Revision 1.9 1999/11/27 19:40:44 andre - * *** empty log message *** - * - * Revision 1.8 1999/11/27 19:24:19 andre - * *** empty log message *** - * - * Revision 1.3.2.3 1998/03/25 15:03:36 andre - * added info->pixel_start_in_file - * - * Revision 1.3.2.2 1997/10/09 11:03:53 andre - * *** empty log message *** - * - * Revision 1.3.2.1 1997/09/15 13:46:15 andre - * added encryption - * - * Revision 1.3 1997/09/15 13:21:18 andre - * switched to new what string format - * - * Revision 1.2 1997/09/15 10:24:13 andre - * mitkIpPicPut now returns status - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicPut\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -extern size_t -_mitkIpPicFWrite( const void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream); - -int -mitkIpPicPut( const char *outfile_name, mitkIpPicDescriptor *pic ) -{ - FILE *outfile; - - mitkIpUInt4_t len; - mitkIpUInt4_t tags_len; - - if( pic->info->write_protect ) - { - fprintf( stderr, "mitkIpPicPut: sorry, can't write (missing tags !!!)\n" ); - return( -1 ); - } - - if( mitkIpPicEncryptionType(pic) != ' ' ) - { - fprintf( stderr, "mitkIpPicPut: warning: was encrypted !!!\n" ); - } - - if( outfile_name == NULL ) - outfile = stdout; - else if( strcmp(outfile_name, "stdout") == 0 ) - outfile = stdout; - else - { - mitkIpPicRemoveFile( outfile_name ); - - if( mitkIpPicGetWriteCompression() ) - { - char buff[1024]; - - sprintf( buff, "%s.gz", outfile_name ); - outfile = mitkIpPicFOpen( buff, "wb" ); - } - else - outfile = fopen( outfile_name, "wb" ); - } - - - if( outfile == NULL ) - { - fprintf( stderr, "mitkIpPicPut: sorry, error opening outfile\n" ); - return( -1 ); - } - - tags_len = _mitkIpPicTagsSize( pic->info->tags_head ); - - len = tags_len + 3 * sizeof(mitkIpUInt4_t) - + pic->dim * sizeof(mitkIpUInt4_t); - - /* write oufile */ - if( mitkIpPicEncryptionType(pic) == ' ' ) - mitkIpPicFWrite( mitkIpPicVERSION, 1, sizeof(mitkIpPicTag_t), outfile ); - else - mitkIpPicFWrite( pic->info->version, 1, sizeof(mitkIpPicTag_t), outfile ); - - mitkIpPicFWriteLE( &len, sizeof(mitkIpUInt4_t), 1, outfile ); - - mitkIpPicFWriteLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, outfile ); - mitkIpPicFWriteLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, outfile ); - mitkIpPicFWriteLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, outfile ); - - mitkIpPicFWriteLE( pic->n, sizeof(mitkIpUInt4_t), pic->dim, outfile ); - - _mitkIpPicWriteTags( pic->info->tags_head, outfile, mitkIpPicEncryptionType(pic) ); - - if( mitkIpPicGetWriteCompression() ) - pic->info->pixel_start_in_file = mitkIpPicFTell( outfile ); - else - pic->info->pixel_start_in_file = ftell( outfile ); - - if( pic->data ) - { - if( pic->type == mitkIpPicNonUniform ) - mitkIpPicFWrite( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), outfile ); - else - mitkIpPicFWriteLE( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), outfile ); - } - - if( outfile != stdout ) - { - if( mitkIpPicGetWriteCompression() ) - mitkIpPicFClose( outfile ); - else - fclose( outfile ); - } - - return( 0 ); -} - -mitkIpUInt4_t _mitkIpPicTagsSize( _mitkIpPicTagsElement_t *head ) -{ - _mitkIpPicTagsElement_t *current = head; - mitkIpUInt4_t tags_len; - - tags_len = 0; - while( current != NULL ) - { - mitkIpUInt4_t len; - - if( current->tsv->type == mitkIpPicTSV ) - { - if( current->tsv->dim == 0 ) - { - current->tsv->n[0] = _mitkIpPicTagsNumber(current->tsv->value); - - if( current->tsv->n[0] > 0 ) - current->tsv->dim = 1; - } - - len = _mitkIpPicTagsSize( (_mitkIpPicTagsElement_t *)current->tsv->value ); - } - else - { - mitkIpUInt4_t elements; - - elements = _mitkIpPicTSVElements( current->tsv ); - - if( current->tsv->type == mitkIpPicASCII - || current->tsv->type == mitkIpPicNonUniform ) - current->tsv->bpe = 8; - - len = elements * current->tsv->bpe / 8; - } - - tags_len += 32 /* name */ - + sizeof( mitkIpUInt4_t) /* len */ - + 3 * sizeof( mitkIpUInt4_t) /* type, bpe, dim */ - + current->tsv->dim * sizeof( mitkIpUInt4_t) /* n[] */ - + len; /* data */ - - current = current->next; - } - return( tags_len ); -} - -mitkIpUInt4_t _mitkIpPicTagsNumber( _mitkIpPicTagsElement_t *head ) -{ - _mitkIpPicTagsElement_t *current = head; - mitkIpUInt4_t tags_number; - - tags_number = 0; - while( current != NULL ) - { - tags_number++; - - current = current->next; - } - return( tags_number ); -} - -void _mitkIpPicWriteTags( _mitkIpPicTagsElement_t *head, FILE *stream, char encryption_type ) -{ - _mitkIpPicTagsElement_t *current = head; - - while( current != NULL ) - { - mitkIpUInt4_t elements; - mitkIpUInt4_t len; - - elements = _mitkIpPicTSVElements( current->tsv ); - - if( current->tsv->type == mitkIpPicTSV ) - { - if( current->tsv->dim == 0 ) - { - current->tsv->n[0] = _mitkIpPicTagsNumber(current->tsv->value); - - if( current->tsv->n[0] > 0 ) - current->tsv->dim = 1; - } - - assert( elements == _mitkIpPicTagsNumber(current->tsv->value) ); - - len = _mitkIpPicTagsSize( current->tsv->value ); - } - else - { - if( current->tsv->type == mitkIpPicASCII - || current->tsv->type == mitkIpPicNonUniform ) - current->tsv->bpe = 8; - - len = elements * current->tsv->bpe / 8; - - } - - len += 3 * sizeof(mitkIpUInt4_t) /* type, bpe, dim */ - + current->tsv->dim * sizeof(mitkIpUInt4_t); /* n[] */ - - mitkIpPicFWrite( current->tsv->tag, 1, sizeof(mitkIpPicTag_t), stream ); - - mitkIpPicFWriteLE( &len, sizeof(mitkIpUInt4_t), 1, stream ); - - mitkIpPicFWriteLE( &(current->tsv->type), sizeof(mitkIpUInt4_t), 1, stream ); - mitkIpPicFWriteLE( &(current->tsv->bpe), sizeof(mitkIpUInt4_t), 1, stream ); - mitkIpPicFWriteLE( &(current->tsv->dim), sizeof(mitkIpUInt4_t), 1, stream ); - mitkIpPicFWriteLE( &(current->tsv->n), sizeof(mitkIpUInt4_t), current->tsv->dim, stream ); - - if( current->tsv->type == mitkIpPicTSV ) - { - _mitkIpPicWriteTags( current->tsv->value, - stream, - encryption_type ); - } - else - { - mitkIpPicFWriteLE( current->tsv->value, current->tsv->bpe / 8, elements, stream ); - } - - current = current->next; - } -} diff --git a/Utilities/IpPic/ipPicPutH.c b/Utilities/IpPic/ipPicPutH.c deleted file mode 100755 index c21b306a07d..00000000000 --- a/Utilities/IpPic/ipPicPutH.c +++ /dev/null @@ -1,89 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * writes a PicFile Header to disk - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicPutHeader\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -void mitkIpPicPutHeader( char *outfile_name, mitkIpPicDescriptor *pic ) -{ - FILE *outfile; - - mitkIpUInt4_t len; - - if( outfile_name == NULL ) - outfile = stdout; - else if( strcmp(outfile_name, "stdout") == 0 ) - outfile = stdout; - else - outfile = fopen( outfile_name, "wb" ); - - if( outfile == NULL ) - { - /*ipPrintErr( "mitkIpPicPut: sorry, error opening outfile\n" );*/ - return; - } - - len = 3 * sizeof(mitkIpUInt4_t) - + pic->dim * sizeof(mitkIpUInt4_t); - - /* write oufile */ - fwrite( mitkIpPicVERSION, 1, sizeof(mitkIpPicTag_t), outfile ); - - mitkIpFWriteLE( &len, sizeof(mitkIpUInt4_t), 1, outfile ); - - mitkIpFWriteLE( &(pic->type), sizeof(mitkIpUInt4_t), 1, outfile ); - mitkIpFWriteLE( &(pic->bpe), sizeof(mitkIpUInt4_t), 1, outfile ); - mitkIpFWriteLE( &(pic->dim), sizeof(mitkIpUInt4_t), 1, outfile ); - - mitkIpFWriteLE( pic->n, sizeof(mitkIpUInt4_t), pic->dim, outfile ); - - if( outfile != stdout ) - fclose( outfile ); - - /*return();*/ -} diff --git a/Utilities/IpPic/ipPicPutMem.c b/Utilities/IpPic/ipPicPutMem.c deleted file mode 100755 index 564c5523fe3..00000000000 --- a/Utilities/IpPic/ipPicPutMem.c +++ /dev/null @@ -1,179 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/** @file - * writes a PicStructure to memory block - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicPutMem\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - - /** FUNCTION DECLARATION - * - * - * PARAMETERS - * - * - * AUTHOR & DATE - * Harald Evers 15.7.98 - * - * UPDATES - * - *-------------------------------------------------------------------- - * - */ - - - -void _mitkIpPicWriteTagsMem( _mitkIpPicTagsElement_t *head, mitkIpUInt1_t **mem_ptr ) -{ - _mitkIpPicTagsElement_t *current = head; - - while( current != NULL ) - { - mitkIpUInt4_t elements; - mitkIpUInt4_t len; - - elements = _mitkIpPicTSVElements( current->tsv ); - - if( current->tsv->type == mitkIpPicTSV ) - { - if( current->tsv->dim == 0 ) - { - current->tsv->n[0] = _mitkIpPicTagsNumber(current->tsv->value); - - if( current->tsv->n[0] > 0 ) - current->tsv->dim = 1; - } - - assert( elements == _mitkIpPicTagsNumber(current->tsv->value) ); - - len = _mitkIpPicTagsSize( current->tsv->value ); - } - else - { - if( current->tsv->type == mitkIpPicASCII - || current->tsv->type == mitkIpPicNonUniform ) - current->tsv->bpe = 8; - - len = elements * current->tsv->bpe / 8; - - } - - len += 3 * sizeof(mitkIpUInt4_t) /* type, bpe, dim */ - + current->tsv->dim * sizeof(mitkIpUInt4_t); /* n[] */ - - memmove( *mem_ptr, current->tsv->tag, sizeof(mitkIpPicTag_t) ); - *mem_ptr += sizeof(mitkIpPicTag_t); - memmove( *mem_ptr, &len, sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - memmove( *mem_ptr, &(current->tsv->type), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - memmove( *mem_ptr, &(current->tsv->bpe), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - memmove( *mem_ptr, &(current->tsv->dim), sizeof(mitkIpUInt4_t) ); - *mem_ptr += sizeof(mitkIpUInt4_t); - memmove( *mem_ptr, &(current->tsv->n), - current->tsv->dim*sizeof(mitkIpUInt4_t) ); - *mem_ptr += current->tsv->dim*sizeof(mitkIpUInt4_t); - - if( current->tsv->type == mitkIpPicTSV ) - { - _mitkIpPicWriteTagsMem( current->tsv->value, mem_ptr ); - } - else - { - /* if( encryption_type == 'e' ... */ - - memmove( *mem_ptr,current->tsv->value, current->tsv->bpe/8*elements ); - *mem_ptr += current->tsv->bpe/8*elements; - } - current = current->next; - } - -} - -mitkIpUInt1_t * -mitkIpPicPutMem( mitkIpPicDescriptor *pic, int *mem_size ) -{ - mitkIpUInt4_t len; - mitkIpUInt4_t tags_len; - mitkIpUInt1_t *mem_pic = NULL; - mitkIpUInt1_t *mem_ptr; - - tags_len = _mitkIpPicTagsSize( pic->info->tags_head ); - - len = tags_len + 3 * sizeof(mitkIpUInt4_t) - + pic->dim * sizeof(mitkIpUInt4_t); - - *mem_size = - sizeof(mitkIpPicTag_t) + /* pic version */ - sizeof(mitkIpUInt4_t) + /* pic data offset */ - len + /* header + tags */ - _mitkIpPicSize( pic ); /* size of data */ - - mem_pic = malloc( *mem_size ); - if( !mem_pic ) - return( NULL ); - - mem_ptr = mem_pic; - memmove( mem_ptr, mitkIpPicVERSION, sizeof(mitkIpPicTag_t) ); - mem_ptr += sizeof(mitkIpPicTag_t); - memmove( mem_ptr, &len, sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - memmove( mem_ptr, &(pic->type), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - memmove( mem_ptr, &(pic->bpe), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - memmove( mem_ptr, &(pic->dim), sizeof(mitkIpUInt4_t) ); - mem_ptr += sizeof(mitkIpUInt4_t); - memmove( mem_ptr, &(pic->n), pic->dim*sizeof(mitkIpUInt4_t) ); - mem_ptr += pic->dim*sizeof(mitkIpUInt4_t); - - _mitkIpPicWriteTagsMem( pic->info->tags_head, &mem_ptr ); - - memmove( mem_ptr, pic->data, pic->bpe/8*_mitkIpPicElements(pic) ); - - return( mem_pic ); -} diff --git a/Utilities/IpPic/ipPicPutS.c b/Utilities/IpPic/ipPicPutS.c deleted file mode 100755 index cf492679dba..00000000000 --- a/Utilities/IpPic/ipPicPutS.c +++ /dev/null @@ -1,185 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * writes a PicFile to disk - * - * $Log$ - * Revision 1.12 2005/09/09 09:14:45 ivo - * FIX: warnings on windows - * - * Revision 1.11 2003/02/18 12:28:23 andre - * write compressed pic files - * - * Revision 1.10 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.8 2000/05/04 12:52:40 ivo - * inserted BSD style license - * - * Revision 1.7 2000/05/04 12:36:01 ivo - * some doxygen comments. - * - * Revision 1.6 2000/01/17 18:32:00 andre - * *** empty log message *** - * - * Revision 1.5 1999/11/27 19:15:08 andre - * *** empty log message *** - * - * Revision 1.4 1998/09/01 15:26:43 andre - * *** empty log message *** - * - * Revision 1.3 1998/05/18 12:13:54 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 13:21:19 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.0 1993/04/02 16:18:39 andre - * Initial revision - * - * - *-------------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)mitkIpPicPutSlice\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" -#include -#include - - -void mitkIpPicPutSlice( const char *outfile_name, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ) -{ - mitkIpPicDescriptor *pic_in; - - FILE *outfile; - - size_t ignored; - - pic_in = mitkIpPicGetHeader( outfile_name, - NULL ); - - if( pic_in == NULL ) - { - if( slice == 1 ) - { - mitkIpBool_t compression; - - pic->n[pic->dim] = 1; - pic->dim += 1; - - compression = mitkIpPicSetWriteCompression( mitkIpFalse ); - mitkIpPicPut( outfile_name, pic ); - mitkIpPicSetWriteCompression( compression ); - - pic->dim -= 1; - pic->n[pic->dim] = 0; - - return; - } - else - return; - } - - pic_in = mitkIpPicGetTags( outfile_name, - pic_in ); - - outfile = fopen( outfile_name, "r+b" ); - - if( outfile == NULL ) - { - /*ipPrintErr( "mitkIpPicPut: sorry, error opening outfile\n" );*/ - /*return();*/ - } - - if( pic->dim != pic_in->dim - 1 ) - { - fclose( outfile ); - return; - } - else if( pic->n[0] != pic_in->n[0] ) - { - fclose( outfile ); - return; - } - else if( pic->n[1] != pic_in->n[1] ) - { - fclose( outfile ); - return; - } - - if( slice > pic_in->n[pic_in->dim-1] ) - pic_in->n[pic_in->dim-1] += 1; - - /* write outfile */ - /*fseek( outfile, 0, SEEK_SET );*/ - rewind( outfile ); - ignored = fwrite( mitkIpPicVERSION, 1, sizeof(mitkIpPicTag_t), outfile ); - - fseek( outfile, sizeof(mitkIpUInt4_t), SEEK_CUR ); /* skip tags_len */ - - ignored = mitkIpFWriteLE( &(pic_in->type), sizeof(mitkIpUInt4_t), 1, outfile ); - ignored = mitkIpFWriteLE( &(pic_in->bpe), sizeof(mitkIpUInt4_t), 1, outfile ); - ignored = mitkIpFWriteLE( &(pic_in->dim), sizeof(mitkIpUInt4_t), 1, outfile ); - - ignored = mitkIpFWriteLE( pic_in->n, sizeof(mitkIpUInt4_t), pic_in->dim, outfile ); - - fseek( outfile, pic_in->info->pixel_start_in_file + _mitkIpPicSize(pic) * (slice - 1), SEEK_SET ); - - ignored = mitkIpFWriteLE( pic->data, pic->bpe / 8, _mitkIpPicElements(pic), outfile ); - - /*fseek( outfile, 0, SEEK_END );*/ - - fclose( outfile ); - - mitkIpPicFree(pic_in); - - /*return();*/ -} diff --git a/Utilities/IpPic/ipPicQueryT.c b/Utilities/IpPic/ipPicQueryT.c deleted file mode 100755 index 802edd941ed..00000000000 --- a/Utilities/IpPic/ipPicQueryT.c +++ /dev/null @@ -1,113 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * searches for a tag - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicQueryTag\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** searches for a tag - * - * @param pic the pic - * @param tag the tag to search for - * @param head the head of the tags list - * - * AUTHOR & DATE - * Andre Schroeter 27.08.94 - * - * UPDATES - * none - */ - -mitkIpPicTSV_t * -mitkIpPicQueryTag( mitkIpPicDescriptor *pic, const char *tag ) -{ - _mitkIpPicTagsElement_t *found; - - found = _mitkIpPicFindTag( pic->info->tags_head, tag ); - - if( found == NULL ) - return( NULL ); - else - return( found->tsv ); -} -mitkIpPicTSV_t * -mitkIpPicQuerySubTag( mitkIpPicTSV_t *parent, const char *tag ) -{ - _mitkIpPicTagsElement_t *found; - - found = _mitkIpPicFindTag( parent->value, tag ); - - if( found == NULL ) - return( NULL ); - else - return( found->tsv ); -} - -_mitkIpPicTagsElement_t * -_mitkIpPicFindTag( _mitkIpPicTagsElement_t *head, const char *tag ) -{ - int i; - char name[_mitkIpPicTAGLEN+1]; - _mitkIpPicTagsElement_t *current; - - if( !tag ) - return( NULL ); - - sprintf( name, "%.*s", _mitkIpPicTAGLEN, tag ); - for( i=strlen(name); i<_mitkIpPicTAGLEN; i++ ) - name[i] = ' '; - - current = head; - while( current != NULL ) - { - if( strncmp( current->tsv->tag, name, _mitkIpPicTAGLEN) == 0 ) - return( current ); - - current = current->next; - } - - return( NULL ); -} diff --git a/Utilities/IpPic/ipPicSize.c b/Utilities/IpPic/ipPicSize.c deleted file mode 100755 index 1e7644effa0..00000000000 --- a/Utilities/IpPic/ipPicSize.c +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * calculates the size of the image data - */ - -#ifndef lint - static char *what = { "@(#)_mitkIpPicSize\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** calculates the size of the image data - * @param pic pointer to image - * @return size of image data - * - * $Log$ - * Revision 1.7 2004/07/02 11:40:49 max - * Fixed bug resulting in mitkIpUInt4_t range overflow using float volumes of a size larger than 512x512x512. - * - * Revision 1.6 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.4 2000/05/04 12:52:41 ivo - * inserted BSD style license - * - * Revision 1.3 2000/05/04 12:36:01 ivo - * some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:20 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.0 1993/04/26 15:28:03 andre - * Initial revision, NO error checking - */ - -mitkIpUInt4_t _mitkIpPicSize( -#if defined(__cplusplus) || defined(c_plusplus) - const -#endif - mitkIpPicDescriptor *pic ) -{ - mitkIpUInt4_t i; - mitkIpUInt4_t elements; - mitkIpUInt4_t bytesPerElement; - if( pic->dim == 0 ) - return( 0 ); - - elements = pic->n[0]; - for( i = 1; i < pic->dim; i++ ) - elements *= pic->n[i]; - - bytesPerElement = pic->bpe / 8; - - return( elements * bytesPerElement ); -} diff --git a/Utilities/IpPic/ipPicTSVElements.c b/Utilities/IpPic/ipPicTSVElements.c deleted file mode 100755 index c29b670ce95..00000000000 --- a/Utilities/IpPic/ipPicTSVElements.c +++ /dev/null @@ -1,79 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * calculates the number of elements in the TSV's value - */ - -#ifndef lint - static char *what = { "@(#)_mitkIpPicTSVElements\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - - /** calculates the number of elements in the TSV's value - * @param tsv the tsv - * - * @return the number of elements in the tsv - * - * - * AUTHOR & DATE - * Andre Schroeter 23.01.95 - * - * UPDATES - * none - */ - - - -mitkIpUInt4_t _mitkIpPicTSVElements( mitkIpPicTSV_t *tsv ) -{ - mitkIpUInt4_t i; - mitkIpUInt4_t elements; - - if( tsv->dim == 0 ) - return( 0 ); - - elements = tsv->n[0]; - for( i = 1; i < tsv->dim; i++ ) - elements *= tsv->n[i]; - - return( elements ); -} diff --git a/Utilities/IpPic/ipPicTSVSize.c b/Utilities/IpPic/ipPicTSVSize.c deleted file mode 100755 index 30328fa5f41..00000000000 --- a/Utilities/IpPic/ipPicTSVSize.c +++ /dev/null @@ -1,78 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * calculates the size of the TSV's value in bytes - */ - -#ifndef lint - static char *what = { "@(#)_mitkIpPicTSVSize\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - - /** calculates the size of the TSV's value in bytes - * @param tsv the tsv - * - * @return the size of the tsv in bytes - * - * - * AUTHOR & DATE - * Andre Schroeter 23.01.95 - * - * UPDATES - * none - */ - - -mitkIpUInt4_t _mitkIpPicTSVSize( mitkIpPicTSV_t *tsv ) -{ - mitkIpUInt4_t i; - mitkIpUInt4_t elements; - - if( tsv->dim == 0 ) - return( 0 ); - - elements = tsv->n[0]; - for( i = 1; i < tsv->dim; i++ ) - elements *= tsv->n[i]; - - return( elements * tsv->bpe / 8 ); -} diff --git a/Utilities/IpPic/ipPicType.c b/Utilities/IpPic/ipPicType.c deleted file mode 100755 index 3964719ca54..00000000000 --- a/Utilities/IpPic/ipPicType.c +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - * initialisation of an array that maps the - * mitkIpPicType_t types to printable strings - */ - -#ifndef lint - static char *what = { "@(#)mitkIpPicType\t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -#include "mitkIpPic.h" - -/** initialisation of an array that maps the - * mitkIpPicType_t types to printable strings - * - * @param type the type - * - * @return the printable string - * - * AUTHOR & DATE - * Andre Schroeter 08.05.94 - * - * UPDATES - * none - * - */ - -static const char *_mitkIpPicTypeName[_mitkIpPicTypeMax] = -{ - "mitkIpPicUnknown", - "mitkIpPicBool", - "mitkIpPicASCII", - "mitkIpPicInt", - "mitkIpPicUInt", - "mitkIpPicFloat", - "mitkIpPicUnknown", - "mitkIpPicNonUniform", - "mitkIpPicTSV" -}; - -const char *mitkIpPicTypeName( mitkIpUInt4_t type ) -{ - if( type > _mitkIpPicTypeMax ) - return( _mitkIpPicTypeName[0] ); - else - return( _mitkIpPicTypeName[type] ); -} diff --git a/Utilities/IpPic/ipWin.c b/Utilities/IpPic/ipWin.c deleted file mode 100755 index 5add62deb62..00000000000 --- a/Utilities/IpPic/ipWin.c +++ /dev/null @@ -1,64 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -#ifdef WIN -#include -#include - -DWORD hfread(LPSTR ptr, DWORD size, DWORD n, FILE *stream) -{ - if( (size < 0xffff) && (n < 0xffff) ) - return fread( ptr, (WORD)size, (WORD)n, stream ); - else - { - DWORD Bytes; - BYTE huge *lpwork; - - Bytes = size*n; - - for( lpwork = ptr; Bytes > 0xffff; Bytes-=0xffff, lpwork+=0xffff ) - fread( (char far*)lpwork, 0xffff, 1, stream ); - - return fread( (char far*)lpwork, (WORD)Bytes, 1, stream ); - } -} -#endif - diff --git a/Utilities/IpPic/mitkIpPic.h b/Utilities/IpPic/mitkIpPic.h deleted file mode 100644 index 38b790247b5..00000000000 --- a/Utilities/IpPic/mitkIpPic.h +++ /dev/null @@ -1,892 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file - */ - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * public defines for the pic-format - * - * $Log$ - * Revision 1.3 2007/03/22 13:41:29 nolden - * FIX: resolve problems with chili plugin - * - * Revision 1.2 2007/03/07 17:23:18 nolden - * fixes for chili plugin build - * - * Revision 1.1 2006/12/13 11:54:43 nolden - * *** empty log message *** - * - * Revision 1.47 2006/11/20 16:09:18 nolden - * FIX/CHG: different mangling of zlib names for ITK 3.x - * - * Revision 1.46 2006/09/20 11:38:17 nolden - * CHG: use itk zlib header from itkzlib subdir of ipPic if USE_ITKZLIB is defined - * - * Revision 1.45 2006/04/20 12:56:00 nolden - * FIX/CHG/ENH: added PPC-Mac definitions - * - * Revision 1.44 2005/10/11 19:06:41 ivo - * FIX: typo - * - * Revision 1.43 2005/10/11 18:35:34 ivo - * FIX: typo - * - * Revision 1.42 2005/10/11 18:19:46 ivo - * ENH: trying to fix zlib problems: use renamed itk zlib methods (itk_gzread etc) - * - * Revision 1.41 2005/04/29 15:41:46 ivo - * FIX: qchili compatibility for version of 21/4/05 - * - * Revision 1.40 2004/04/06 14:59:39 nolden - * moved win32 compatibility settings from mitkIpPic.h to ipPic.pro - * - * Revision 1.39 2004/03/25 18:35:05 andre - * bug fix - * - * Revision 1.38 2003/12/02 11:54:31 tobiask - * Added setters and getters for rgb pixels. - * - * Revision 1.37 2003/11/28 14:24:45 tobiask - * Fixed bugs in macros mitkIpPicGET_PIXEL and mitkIpPicPUT_PIXEL. - * - * Revision 1.36 2003/09/30 20:12:50 tobiask - * Added macros for getting and setting pixel values. - * - * Revision 1.35 2003/02/18 12:28:23 andre - * write compressed pic files - * - * Revision 1.34 2002/11/13 17:52:59 ivo - * new ipPic added. - * - * Revision 1.32 2002/10/31 10:00:30 ivo - * zlib.lib including headers now in win32. gz-extension should work now on every windows. - * WIN32 define changed to standard _WIN32. - * - * Revision 1.31 2002/05/16 13:14:30 peter - * changed include path to ipPic/mitkIpPic.h - * - * Revision 1.30 2002/04/18 19:09:13 ivo - * compression (zlib) activated. - * - * Revision 1.1.1.1 2002/04/18 18:38:43 ivo - * no message - * - * Revision 1.29 2002/02/27 08:54:43 andre - * zlib changes - * - * Revision 1.28 2000/06/26 16:02:05 andre - * pPicFORALL_x bug fix - * - * Revision 1.27 2000/05/24 14:10:51 tobiask - * Removed ipPic/ from the include directives. - * - * Revision 1.26 2000/05/04 12:52:35 ivo - * inserted BSD style license - * - * Revision 1.25 2000/05/04 12:35:58 ivo - * some doxygen comments. - * - * Revision 1.24 1999/12/09 19:17:46 andre - * *** empty log message *** - * - * Revision 1.23 1999/12/09 19:11:51 andre - * *** empty log message *** - * - * Revision 1.22 1999/11/29 09:41:39 andre - * *** empty log message *** - * - * Revision 1.21 1999/11/29 09:34:34 andre - * *** empty log message *** - * - * Revision 1.20 1999/11/28 16:29:43 andre - * *** empty log message *** - * - * Revision 1.19 1999/11/28 16:27:21 andre - * *** empty log message *** - * - * Revision 1.18 1999/11/27 23:59:45 andre - * *** empty log message *** - * - * Revision 1.17 1999/11/27 19:15:08 andre - * *** empty log message *** - * - * Revision 1.16 1999/11/27 12:47:52 andre - * *** empty log message *** - * - * Revision 1.15 1999/08/20 08:25:42 andre - * *** empty log message *** - * - * Revision 1.14 1998/09/16 18:35:16 andre - * *** empty log message *** - * - * Revision 1.13 1998/09/16 18:32:53 andre - * *** empty log message *** - * - * Revision 1.12 1998/07/16 12:33:18 andre - * *** empty log message *** - * - * Revision 1.11 1998/07/14 11:16:16 andre - * *** empty log message *** - * - * Revision 1.10 1998/06/23 15:56:40 andre - * *** empty log message *** - * - * Revision 1.9 1998/06/18 09:12:14 andre - * *** empty log message *** - * - * Revision 1.8 1998/06/09 12:38:30 andre - * added mitkIpPicDelSubTag - * - * Revision 1.7 1998/06/09 11:34:32 andre - * *** empty log message *** - * - * Revision 1.6 1998/06/09 10:58:25 andre - * added mitkIpPicAddSubTag - * - * Revision 1.5 1998/05/09 18:30:23 andre - * *** empty log message *** - * - * Revision 1.4 1998/05/06 14:13:15 andre - * added info->pixel_start_in_file - * - * Revision 1.3 1997/10/20 13:35:40 andre - * *** empty log message *** - * - * Revision 1.2 1997/09/15 10:24:12 andre - * mitkIpPicPut now returns status - * - * Revision 0.2 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.1 1993/03/31 11:44:35 andre - * added 'GetSlice' - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision - * - * - *-------------------------------------------------------------------- - * - */ - -#define USE_ITKZLIB - -#ifndef _mitkIpPic_h -#define _mitkIpPic_h - - -#ifndef NO_DEBUG -# define mitkIpPicDEBUG -#endif - - -#include -#include -#include - -#ifdef sun -# include -#endif - - - -#ifdef WIN -# include -extern DWORD ipWinFread(LPSTR ptr, DWORD size, DWORD n, FILE *stream); -#endif - - - -#include /**/ - -#include - - -#ifdef mitkIpPicDEBUG -#endif - - -/* -** defines -*/ -#define mitkIpPicVERSION "PIC VERSION 3.00 " -#define mitkIpPicVERSIONe "PIC VERSION 3.00e " -#define _mitkIpPicNDIM 8 -#define _mitkIpPicTAGLEN 32 - - -#if (THIS_IS_BIG_ENDIAN) || defined (_IBMR2) || (mc68000) || (sun) || (__convex__) || (__hppa) || (_MIPSEB) || defined ( __PPC__) -# define _mitkIpENDIAN_IS_BIG -#else -# define _mitkIpENDIAN_IS_LITTLE -#endif - - -#define mitkIpPicVersionMajor(pic) (mitkIpUInt1_t)(pic->info->version[12] - '0') -#define mitkIpPicVersionMinor(pic) (mitkIpUInt1_t)(10 * (pic->info->version[14]-'0' ) \ - + pic->info->version[15]-'0') -#define mitkIpPicEncryptionType(pic) (pic->info->version[16]) - -/*#define mitkIpPicIsPic(pic) (( (pic)->magic == mitkIpPicPicDescriptor_m) \ - ? mitkIpTrue : mitkIpFalse )*/ - - -#define mitkIpPicDR(type,len) (mitkIpUInt4_t)( ((type)<<16) + (len) ) - -#define mitkIpPicFOR_TYPE( _ipPIC_TYPE, _ipPIC_CMD, _ipPIC_PIC) \ - _ipPIC_CMD(_ipPIC_TYPE,_ipPIC_PIC) - -#define mitkIpPicFORALL( _ipPIC_CMD, _ipPIC_PIC ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_1( _ipPIC_CMD, _ipPIC_PIC, A1 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_2( _ipPIC_CMD, _ipPIC_PIC, A1, A2 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1, A2); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1, A2); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_3( _ipPIC_CMD, _ipPIC_PIC, A1, A2, A3 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1, A2, A3); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_4( _ipPIC_CMD, _ipPIC_PIC, A1, A2, A3, A4 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1, A2, A3, A4); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_5( _ipPIC_CMD, _ipPIC_PIC, A1, A2, A3, A4, A5 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1, A2, A3, A4, A5); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define mitkIpPicFORALL_6( _ipPIC_CMD, _ipPIC_PIC, A1, A2, A3, A4, A5, A6 ) \ - switch( mitkIpPicDR((_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe) ) \ - { \ - case mitkIpPicDR( mitkIpPicInt, 8 ): \ - _ipPIC_CMD(mitkIpInt1_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 8 ): \ - _ipPIC_CMD(mitkIpUInt1_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 16 ): \ - _ipPIC_CMD(mitkIpInt2_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 16 ): \ - _ipPIC_CMD(mitkIpUInt2_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicInt, 32 ): \ - _ipPIC_CMD(mitkIpInt4_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicUInt, 32 ): \ - _ipPIC_CMD(mitkIpUInt4_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 32 ): \ - _ipPIC_CMD(mitkIpFloat4_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - case mitkIpPicDR( mitkIpPicFloat, 64 ): \ - _ipPIC_CMD(mitkIpFloat8_t, _ipPIC_PIC, A1, A2, A3, A4, A5, A6); \ - break; \ - default: \ - fprintf( stderr, \ - "sorry, %s: datatype (%i/%i) not supported for %s.\n", \ - __FILE__, (_ipPIC_PIC)->type, (_ipPIC_PIC)->bpe, #_ipPIC_CMD ); \ - break; \ - } - -#define _mitkIpPicGET_PIXEL(TYPE,PIC,X,Y,RESULT) \ -{ \ - TYPE* data = (TYPE *) (PIC)->data \ - + (X) + (Y) * (PIC)->n[0]; \ - RESULT = *data; \ -} - -#define _mitkIpPicPUT_PIXEL(TYPE,PIC,X,Y,VALUE) \ -{ \ - TYPE* data = (TYPE *) (PIC)->data \ - + (X) + (Y) * (PIC)->n[0]; \ - *data = VALUE; \ -} - -#define mitkIpPicGET_PIXEL(PIC,X,Y,RESULT) \ -{ \ - mitkIpPicFORALL_3(_mitkIpPicGET_PIXEL,PIC,X,Y,RESULT); \ -} - -#define mitkIpPicPUT_PIXEL(PIC,X,Y,RESULT) \ -{ \ - mitkIpPicFORALL_3(_mitkIpPicPUT_PIXEL,PIC,X,Y,RESULT); \ -} - -#define _mitkIpPicGET_PIXEL_RGB(TYPE,PIC,X,Y,R,G,B) \ -{ \ - mitkIpUInt4_t skip = (PIC)->n[0] * (PIC)->n[1]; \ - TYPE* data = (TYPE *) (PIC)->data + (X) + (Y) * (PIC)->n[0]; \ - R = *(data); \ - G = *(data + skip); \ - B = *(data + skip + skip); \ -} - -#define _mitkIpPicPUT_PIXEL_RGB(TYPE,PIC,X,Y,R,G,B) \ -{ \ - mitkIpUInt4_t skip = (PIC)->n[0] * (PIC)->n[1]; \ - TYPE* data = (TYPE *) (PIC)->data + (X) + (Y) * (PIC)->n[0]; \ - *data = (R); \ - *(data + skip) = (G); \ - *(data + skip + skip) = (B); \ -} - -#define mitkIpPicGET_PIXEL_RGB(PIC,X,Y,R,G,B) \ -{ \ - mitkIpPicFORALL_5(_mitkIpPicGET_PIXEL_RGB,PIC,X,Y,R,G,B); \ -} - -#define mitkIpPicPUT_PIXEL_RGB(PIC,X,Y,R,G,B) \ -{ \ - mitkIpPicFORALL_5(_mitkIpPicPUT_PIXEL_RGB,PIC,X,Y,R,G,B); \ -} - -#define USE_ZLIB /**/ -#ifdef USE_ZLIB -#ifdef USE_ITKZLIB -# define mitkIpPicFile_t gzFile -# define mitkIpPicFOpen gzopen -# define mitkIpPicFTell gztell -# define mitkIpPicFSeek gzseek -# define mitkIpPicFRead(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize))) -# define mitkIpPicFWrite _mitkIpPicFWrite -# define mitkIpPicFEOF gzeof -# define mitkIpPicFClose gzclose -# include "itk_zlib.h" -#else -# define mitkIpPicFile_t gzFile -# define mitkIpPicFOpen gzopen -# define mitkIpPicFTell gztell -# define mitkIpPicFSeek gzseek -# define mitkIpPicFRead(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize))) -# define mitkIpPicFWrite _mitkIpPicFWrite -# define mitkIpPicFEOF gzeof -# define mitkIpPicFClose gzclose -# include -#endif -#else -# define mitkIpPicFile_t FILE * -# define mitkIpPicFOpen fopen -# define mitkIpPicFTell ftell -# define mitkIpPicFSeek fseek -# define mitkIpPicFRead fread -# define mitkIpPicFWrite fwrite -# define mitkIpPicFEOF feof -# define mitkIpPicFClose fclose -#endif - - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpPicFReadLE mitkIpPicFRead -# define mitkIpPicFReadBE mitkIpPicFReadCvt -#else -# define mitkIpPicFReadLE mitkIpPicFReadCvt -# define mitkIpPicFReadBE mitkIpPicFRead -#endif - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpPicFWriteLE mitkIpPicFWrite -# define mitkIpPicFWriteBE mitkIpPicFWriteCvt -#else -# define mitkIpPicFWriteLE mitkIpPicFWriteCvt -# define mitkIpPicFWriteBE mitkIpPicFWrite -#endif - - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpFReadLE fread -# define mitkIpFReadBE mitkIpFReadCvt -#else -# define mitkIpFReadLE mitkIpFReadCvt -# define mitkIpFReadBE fread -#endif - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpFWriteLE fwrite -# define mitkIpFWriteBE mitkIpFWriteCvt -#else -# define mitkIpFWriteLE mitkIpFWriteCvt -# define mitkIpFWriteBE fwrite -#endif - - -#ifdef WIN -# undef mitkIpFReadLE -# define mitkIpFReadLE fread -#endif - - - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpCvtFromLE(data, len, bytes) -# define mitkIpCvtFromBE(data, len, bytes) _mitkIpCvtEndian( (data), (len), (bytes) ) -#else -# define mitkIpCvtFromLE(data, len, bytes) _mitkIpCvtEndian( (data), (len), (bytes) ) -# define mitkIpCvtFromBE(data, len, bytes) -#endif - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpCpFromLE(source, destination, len, bytes) _mitkIpCp( (source), (destination), (len) ) -# define mitkIpCpFromBE(source, destination, len, bytes) _mitkIpCpCvtEndian( (source), (destination), (len), (bytes) ) -#else -# define mitkIpCpFromLE(source, destination, len, bytes) _mitkIpCpCvtEndian( (source), (destination), (len), (bytes) ) -# define mitkIpCpFromBE(source, destination, len, bytes) _mitkIpCp( (source), (destination), (len) ) -#endif - -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpCpToLE(source, destination, len, bytes) _mitkIpCp( (source), (destination), (len) ) -# define mitkIpCpToBE(source, destination, len, bytes) _mitkIpCpCvtEndian( (source), (destination), (len), (bytes) ) -#else -# define mitkIpCpToLE(source, destination, len, bytes) _mitkIpCpCvtEndian( (source), (destination), (len), (bytes) ) -# define mitkIpCpToBE(source, destination, len, bytes) _mitkIpCp( (source), (destination), (len) ) -#endif - - -#define mitkIpEndianSwap2(x) ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00)) - -#define mitkIpEndianSwap4(x) ((((x) >> 24) & 0x000000FF) | (((x) << 24) & 0xFF000000)) \ - | ((((x) >> 8) & 0x0000FF00) | (((x) << 8) & 0x00FF0000)) - -/* -** NOTE: these macros *DO NOT* work for in-place transformations. -*/ -/* -** maybe ipEndianSwap should be used -*/ -#ifdef _mitkIpENDIAN_IS_LITTLE -# define mitkIpInt2FromLE(from, to) *((mitkIpInt2_t *)(to)) = *((mitkIpInt2_t *)(from)) -# define mitkIpInt4FromLE(from, to) *((mitkIpInt4_t *)(to)) = *((mitkIpInt4_t *)(from)) -# define mitkIpUInt2FromLE(from, to) mitkIpInt2FromLE(from, to) -# define mitkIpUInt4FromLE(from, to) mitkIpInt4FromLE(from, to) -# define mitkIpFloat4FromLE(from, to) mitkIpInt4FromLE(from, to) -# define mitkIpFloat8FromLE(from, to) *((mitkIpFloat8_t *)(to)) = *((mitkIpFloat8_t *)(from)) -#else -# define mitkIpInt2FromLE(from, to) ((char *)(to))[0] = ((char *)(from))[1]; \ - ((char *)(to))[1] = ((char *)(from))[0]; - -# define mitkIpInt4FromLE(from, to) ((char *)(to))[0] = ((char *)(from))[3]; \ - ((char *)(to))[1] = ((char *)(from))[2]; \ - ((char *)(to))[2] = ((char *)(from))[1]; \ - ((char *)(to))[3] = ((char *)(from))[0]; -# define mitkIpUInt2FromLE(from, to) mitkIpInt2FromLE(from, to) -# define mitkIpUInt4FromLE(from, to) mitkIpInt4FromLE(from, to) -# define mitkIpFloat4FromLE(from, to) mitkIpInt4FromLE(from, to) -# define mitkIpFloat8FromLE(from, to) ((char *)(to))[0] = ((char *)(from))[7]; \ - ((char *)(to))[1] = ((char *)(from))[6]; \ - ((char *)(to))[2] = ((char *)(from))[5]; \ - ((char *)(to))[3] = ((char *)(from))[4]; \ - ((char *)(to))[4] = ((char *)(from))[3]; \ - ((char *)(to))[5] = ((char *)(from))[2]; \ - ((char *)(to))[6] = ((char *)(from))[1]; \ - ((char *)(to))[7] = ((char *)(from))[0]; -#endif /* _mitkIpENDIAN_IS_LITTLE */ - -/* -** NOTE: Most architectures are symmetrical with respect to conversions. -*/ -#define mitkIpInt2ToLE(from, to) mitkIpInt2FromLE(from, to) -#define mitkIpInt4ToLE(from, to) mitkIpInt4FromLE(from, to) -#define mitkIpUInt2ToLE(from, to) mitkIpUInt2FromLE(from, to) -#define mitkIpUInt4ToLE(from, to) mitkIpUInt4FromLE(from, to) -#define mitkIpFloat4ToLE(from, to) mitkIpFloat4FromLE(from, to) -#define mitkIpFloat8ToLE(from, to) mitkIpFloat8FromLE(from, to) - - -/* -** types for the pic format -*/ - -typedef char mitkIpPicTag_t[_mitkIpPicTAGLEN]; - -typedef enum - { - mitkIpPicUnknown = 0, - mitkIpPicBool = 1, - mitkIpPicASCII = 2, - mitkIpPicInt = 3, - mitkIpPicUInt = 4, - mitkIpPicFloat = 5, - mitkIpPicNonUniform = 7, - mitkIpPicTSV = 8, - /* ---- add new types before this line !!! ----*/ - /* ---- don't forget to add a new type also to mitkIpPicType.c !!! ----*/ - _mitkIpPicTypeMax - } mitkIpPicType_t; - -/* -typedef enum - { - mitkIpPicUnknown_m = 0, - mitkIpPicDescriptor_m = 0xDDDD - } _mitkIpPicMagic_t; -*/ - - -typedef struct - { - char tag[_mitkIpPicTAGLEN+1]; /* name of this tag */ - mitkIpPicType_t type; /* datatype of the value */ - mitkIpUInt4_t bpe; /* bits per element */ - mitkIpUInt4_t dim; /* number of dimensions */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* size of dimension n[i] */ - void *value; /* the value */ - } mitkIpPicTSV_t; /* Tag Structure Value */ - -typedef struct _mitkIpPicTagsElement_s - { - mitkIpPicTSV_t *tsv; - struct _mitkIpPicTagsElement_s *prev; - struct _mitkIpPicTagsElement_s *next; - } _mitkIpPicTagsElement_t; - -typedef struct - { - mitkIpPicTag_t version; - _mitkIpPicTagsElement_t *tags_head; - mitkIpBool_t write_protect; - long pixel_start_in_file; - struct mitkIpPicDescriptor *lender; /* lender of image data */ - mitkIpUInt4_t borrower; /* borrower of image data */ - mitkIpUInt4_t ref; /* reference counter */ - } _mitkIpPicInfo_t; - -typedef struct mitkIpPicDescriptor - { - void *data; /* pointer to 'image' data */ - _mitkIpPicInfo_t *info; /* pointer to the PicInfo structure */ - mitkIpPicType_t type; /* datatype of the data */ - mitkIpUInt4_t bpe; /* bits per element */ - mitkIpUInt4_t dim; /* number of dimensions */ - mitkIpUInt4_t n[_mitkIpPicNDIM]; /* size of dimension n[i] */ -#ifdef WIN - HANDLE hdata; -#endif - } mitkIpPicDescriptor; - - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -extern _mitkIpEndian_t _mitkIpEndian( void ); - -extern void _mitkIpCp( void *source, void *destination, unsigned long int len ); -extern void _mitkIpCvtEndian( void *data, unsigned long int len, unsigned char bytes ); -extern void _mitkIpCpCvtEndian( void *source, void *destination, unsigned long int len, unsigned char bytes ); - -extern mitkIpPicFile_t _mitkIpPicOpenPicFileIn( const char *path ); -extern int mitkIpPicAccess( const char *path, int mode ); -extern int mitkIpPicRemoveFile( const char *path ); - -extern mitkIpBool_t mitkIpPicGetWriteCompression( void ); -extern mitkIpBool_t mitkIpPicSetWriteCompression( mitkIpBool_t compression ); - -extern size_t mitkIpFReadCvt( void *ptr, size_t size, size_t nitems, FILE *stream ); -extern size_t _mitkIpFWrite( void *ptr, size_t size, size_t nitems, FILE *stream ); - -#define _mitkIpPicHAS_CAN_READ_COMPRESSED -extern mitkIpBool_t _mitkIpPicCanReadCompressed; -extern size_t mitkIpPicFReadCvt( void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream ); - -#define _mitkIpPicHAS_CAN_WRITE_COMPRESSED -extern mitkIpBool_t _mitkIpPicCanWriteCompressed; -extern size_t mitkIpPicFWriteCvt( void *ptr, size_t size, size_t nitems, mitkIpPicFile_t stream ); - -extern mitkIpPicDescriptor *mitkIpPicNew( void ); -extern void mitkIpPicClear( mitkIpPicDescriptor *pic ); -extern void mitkIpPicFree( mitkIpPicDescriptor *pic ); - -extern mitkIpUInt4_t _mitkIpPicSize( -#if defined(__cplusplus) || defined(c_plusplus) - const -#endif - mitkIpPicDescriptor *pic ); - -extern mitkIpUInt4_t _mitkIpPicElements( mitkIpPicDescriptor *pic ); - -extern mitkIpUInt4_t _mitkIpPicTSVSize( mitkIpPicTSV_t *tsv ); -extern mitkIpUInt4_t _mitkIpPicTSVElements( mitkIpPicTSV_t *tsv ); - -extern mitkIpPicDescriptor *mitkIpPicClone( mitkIpPicDescriptor *pic ); - -extern mitkIpPicDescriptor *_mitkIpPicCopySlice( mitkIpPicDescriptor *pic, mitkIpPicDescriptor *pic_in, mitkIpUInt4_t slice ); - -extern mitkIpPicDescriptor *_mitkIpPicOldGet( FILE *infile, mitkIpPicDescriptor *pic ); -extern mitkIpPicDescriptor *_mitkIpPicOldGetHeader( FILE *infile, mitkIpPicDescriptor *pic ); -extern mitkIpPicDescriptor *_mitkIpPicOldGetSlice( FILE *infile, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ); - - -extern mitkIpPicDescriptor *mitkIpPicCopyHeader( mitkIpPicDescriptor *pic, mitkIpPicDescriptor *pic_new ); - -extern mitkIpPicDescriptor *mitkIpPicGet( const char *picfile_name, mitkIpPicDescriptor *pic ); -extern mitkIpPicDescriptor *mitkIpPicGetHeader( const char *picfile_name, mitkIpPicDescriptor *pic ); -extern mitkIpPicDescriptor *mitkIpPicGetSlice( const char *picfile_name, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ); - -extern _mitkIpPicTagsElement_t *_mitkIpPicReadTags( _mitkIpPicTagsElement_t *head, mitkIpUInt4_t bytes_to_read, FILE *stream, char encryption_type ); -extern _mitkIpPicTagsElement_t *_mitkIpPicInsertTag( _mitkIpPicTagsElement_t *head, mitkIpPicTSV_t *tsv ); -extern _mitkIpPicTagsElement_t *_mitkIpPicFindTag( _mitkIpPicTagsElement_t *head, const char *tag ); -extern mitkIpUInt4_t _mitkIpPicTagsSize( _mitkIpPicTagsElement_t *head ); -extern mitkIpUInt4_t _mitkIpPicTagsNumber( _mitkIpPicTagsElement_t *head ); -extern void _mitkIpPicWriteTags( _mitkIpPicTagsElement_t *head, FILE *stream, char encryption_type ); -extern void _mitkIpPicFreeTags( _mitkIpPicTagsElement_t *head ); -extern mitkIpPicTSV_t *_mitkIpPicCloneTag( mitkIpPicTSV_t *source ); -extern _mitkIpPicTagsElement_t *_mitkIpPicCloneTags( _mitkIpPicTagsElement_t *head ); - -extern void mitkIpPicAddTag( mitkIpPicDescriptor *pic, mitkIpPicTSV_t *tsv ); -extern void mitkIpPicAddSubTag( mitkIpPicTSV_t *parent, mitkIpPicTSV_t *tsv ); -extern mitkIpPicTSV_t * mitkIpPicDelTag( mitkIpPicDescriptor *pic, const char *tag ); -extern mitkIpPicTSV_t * mitkIpPicDelSubTag( mitkIpPicTSV_t *parent, const char *tag ); -extern mitkIpPicDescriptor *mitkIpPicGetTags( const char *picfile_name, mitkIpPicDescriptor *pic ); -extern mitkIpPicTSV_t *mitkIpPicQueryTag( mitkIpPicDescriptor *pic, const char *t ); -extern mitkIpPicTSV_t *mitkIpPicQuerySubTag( mitkIpPicTSV_t *parent, const char *t ); -extern void mitkIpPicFreeTag( mitkIpPicTSV_t *tsv ); - - -extern _mitkIpPicTagsElement_t * _mitkIpPicReadTagsMem( _mitkIpPicTagsElement_t *head, mitkIpUInt4_t bytes_to_read, mitkIpUInt1_t **mem_ptr, char encryption_type ); -extern mitkIpPicDescriptor *mitkIpPicGetMem( mitkIpUInt1_t *mem_pic ); -extern void _mitkIpPicWriteTagsMem( _mitkIpPicTagsElement_t *head, mitkIpUInt1_t **mem_ptr ); -extern mitkIpUInt1_t *mitkIpPicPutMem( mitkIpPicDescriptor *pic, int *mem_size ); - - -extern int mitkIpPicPut( const char *picfile_name, mitkIpPicDescriptor *pic ); -extern void mitkIpPicPutSlice( const char *picfile_name, mitkIpPicDescriptor *pic, mitkIpUInt4_t slice ); - -#define _mitkIpPicInfoNORMAL 0 -#define _mitkIpPicInfoSHORT (1 << 0) -void _mitkIpPicInfo( FILE *stream, mitkIpPicDescriptor *pic, mitkIpUInt4_t flags ); -void _mitkIpPicInfoPrintTags( FILE *stream, _mitkIpPicTagsElement_t* head, mitkIpUInt4_t level, mitkIpUInt4_t flags ); - -extern const char *mitkIpPicTypeName( mitkIpUInt4_t type ); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - - -#endif /* _mitkIpPic_h */ diff --git a/Utilities/IpPic/mitkIpPicOldP.h b/Utilities/IpPic/mitkIpPicOldP.h deleted file mode 100755 index 5a3e07f31c6..00000000000 --- a/Utilities/IpPic/mitkIpPicOldP.h +++ /dev/null @@ -1,92 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * the old pic header - * - * $Log$ - * Revision 1.5 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.3 2000/05/04 12:52:40 ivo - * inserted BSD style license - * - * Revision 1.2 2000/05/04 12:36:01 ivo - * some doxygen comments. - * - * Revision 1.1.1.1 1997/09/06 19:09:59 andre - * initial import - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision - * - * - *-------------------------------------------------------------------- - * - */ - -#ifndef _mitkIpPicOldP_h -#define _mitkIpPicOldP_h - -typedef struct - { - mitkIpUInt4_t id, - dummy1, - dummy2, - conv, - rank, - n1, - n2, - n3, - n4, - n5, - n6, - n7, - n8, - type, - ntxt, - ltxt; - } _mitkIpPicOldHeader; -#endif /* ifdef _mitkIpPicOldP_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/mitkIpPicTypeMultiplex.h b/Utilities/IpPic/mitkIpPicTypeMultiplex.h deleted file mode 100644 index 7c515e335a7..00000000000 --- a/Utilities/IpPic/mitkIpPicTypeMultiplex.h +++ /dev/null @@ -1,730 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/** @file -* -*Module Name:mitkIpPicTypeMultiplex -* -*Module Klasse: ADT -* -*Beschreibung:Multiplexing a method with the image datatyp. -*The image is the first parameter. -*The method must be about a template method. -*The number of parameter is constricted by 16 -* -*Method with two parameter and without a return value: -*mitkIpPicTypeMultiplex2( funktionsname, parameter1, Parameter2 ); -* -*Method with one parameter and a return value: -*mitkIpPicTypeMultiplexR1( funktionsname, rückgabewert, parameter ); -* -*If R is set the method return a value -*The number set the count of parameter -* -*exported classes and methods: -*no one -* -*imported classes and methods: -*std::complex -* -*@warning These module is not finished -* -* -*@version 1.0 -* -* @date 07.09.2000 -* -* @author Marcus Vetter -* -*/ - -#ifndef IP_PIC_TYPE_MULTIPLEX_H -#define IP_PIC_TYPE_MULTIPLEX_H - -#include "mitkIpPic.h" -//#include - -#define mitkIpPicTypeMultiplex0( function, pic ) \ -{ \ -if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic ); \ -} \ -} - -#define mitkIpPicTypeMultiplex1( function, pic, param1 ) \ -{ \ -if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1 ); \ -} \ -} -/* -else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1 ); -} -*/ - -#define mitkIpPicTypeMultiplex2( function, pic, param1, param2 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2 ); \ -} \ -} -/* -else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2 ); -} -*/ -#define mitkIpPicTypeMultiplex3( function, pic, param1, param2, param3 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3 ); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3 ); -}*/ - -#define mitkIpPicTypeMultiplex4( function, pic, param1, param2, param3, param4 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4 ); \ -} \ -} -/* -else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4 ); -}*/ - -#define mitkIpPicTypeMultiplex5( function, pic, param1, param2, param3, param4, param5 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5 ); \ -} \ -} -/* else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5 ); -} -*/ -#define mitkIpPicTypeMultiplex6( function, pic, param1, param2, param3, param4, param5, param6 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6 ); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex7( function, pic, param1, param2, param3, param4, param5, param6, param7 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex7( function, pic, param1, param2, param3, param4, param5, param6, param7 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex8( function, pic, param1, param2, param3, param4, param5, param6, param7, param8) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex9( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex10( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ - -#define mitkIpPicTypeMultiplex16( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \ -} \ -} -/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){ -function >( pic, param1, param2, param3, param4, param5, param6 ); -}*/ -/** -* with return value -*/ - -#define mitkIpPicTypeMultiplexR0( function, pic, returnValue ) \ -{ \ -if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR1( function, pic, returnValue, param1 ) \ -{ \ -if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR2( function, pic, returnValue, param1, param2 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR3( function, pic, returnValue, param1, param2, param3 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR4( function, pic, returnValue, param1, param2, param3, param4 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR5( function, pic, returnValue, param1, param2, param3, param4, param5 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR6( function, pic, returnValue, param1, param2, param3, param4, param5, param6 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR7( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR8( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7, param8 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \ -} \ -} - -#define mitkIpPicTypeMultiplexR9( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7, param8, param9 ) \ -{ \ -if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \ - returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \ -returnValue = function( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \ -} \ -} - -#endif // IP_PIC_TYPE_MULTIPLEX_H diff --git a/Utilities/IpPic/mitkIpTypes.h b/Utilities/IpPic/mitkIpTypes.h deleted file mode 100755 index 5927d88ba01..00000000000 --- a/Utilities/IpPic/mitkIpTypes.h +++ /dev/null @@ -1,122 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *-------------------------------------------------------------------- - * DESCRIPTION - * defines the ipTypes - * - *-------------------------------------------------------------------- - */ - -#ifndef _mitkIpTypes_h -#define _mitkIpTypes_h - -#if defined (__mips) || (_IBMR2) || (sun) || (__i386__) || (__convex__) || (__alpha) || (__hppa) || (WIN32) || (_WIN32) || defined (__PPC__) || defined (__x86_64__) || defined (__APPLE__) - typedef signed char mitkIpInt1_t; - typedef signed short mitkIpInt2_t; - typedef signed int mitkIpInt4_t; - typedef unsigned char mitkIpUInt1_t; - typedef unsigned short mitkIpUInt2_t; - typedef unsigned int mitkIpUInt4_t; - typedef float mitkIpFloat4_t; - typedef double mitkIpFloat8_t; -#endif - -#ifdef DOS - typedef signed char mitkIpInt1_t; - typedef signed int mitkIpInt2_t; - typedef signed long int mitkIpInt4_t; - typedef unsigned char mitkIpUInt1_t; - typedef unsigned int mitkIpUInt2_t; - typedef unsigned long int mitkIpUInt4_t; - typedef float mitkIpFloat4_t; - typedef double mitkIpFloat8_t; -#endif - -/* -** this boolean is NOT a 1 bit value !!! -** it is NOT intended for 1 bit images !!! -*/ -typedef enum - { mitkIpFalse = 0, - mitkIpTrue = 1 - } mitkIpBool_t; - -typedef enum - { - mitkIpError = -1, /* general error */ - mitkIpOK = 0, /* no error */ - mitkIpEDIM = 1000 /* wrong number of dimensions */ - } mitkIpError_t; - - -typedef enum - { - _mitkIpEndianUnknown = 0, - _mitkIpEndianLittle = 1, - _mitkIpEndianBig = 2 - } _mitkIpEndian_t; - -typedef enum - { - mitkIpTypeUnknown = 0, - mitkIpTypeStringPtr, - mitkIpTypeString, - mitkIpTypeInt1, - mitkIpTypeInt2, - mitkIpTypeInt4, - mitkIpTypeUInt1, - mitkIpTypeUInt2, - mitkIpTypeUInt4, - mitkIpTypeFloat4, - mitkIpTypeFloat8, - mitkIpTypeNBytes, - mitkIpTypeArray, - mitkIpTypeList, - mitkIpTypePic, - mitkIpTypePicTag, - _mitkIpTypeMAX - } mitkIpType_t; - -#endif /* _mitkIpTypes_h */ -/* DON'T ADD ANYTHING AFTER THIS #endif */ diff --git a/Utilities/IpPic/pic2seq.c b/Utilities/IpPic/pic2seq.c deleted file mode 100755 index ecaaa6fef27..00000000000 --- a/Utilities/IpPic/pic2seq.c +++ /dev/null @@ -1,274 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - -/********************************************************************* / -/ pic2seq / -/ -------------------------------------------------------------------- / -/ DESCRIPTION / -/ / -/ converts a pic-seq to single pic-files / -/ / -/ / -/ FUNCTION DECLARATION / -/ / -/ / -/ PROTOTYPE CALL / -/ / -/ / -/ PARAMETER / -/ / -/ / -/ RETURN VALUES / -/ / -/ 0 - no error occured / -/ -1 - error oocured / -/ / -/ AUTHOR & DATE / -/ / -/ Andre Schroeter 08.06.1992 / -/ / -/ UPDATES / -/ / -/ / -/ / -/**********************************************************************/ -static char *what[] = { - "@(#)seqtopic \t06/92\tGerman Cancer Research Center (DKFZ)\t08.06.1992", -}; -/* standard include files */ -#include -#include -#include - -#include - - -#ifndef FILENAME_MAX -# define FILENAME_MAX 1024 -#endif - -#ifndef Bool -typedef char Bool; -# define True 1 -# define False 0 -#endif - -void main( int argc, char *argv[] ) -{ - int i; - - int n_infiles; - char **infile_names; - - unsigned int n; - Bool is_number; - Bool scan_error; - Bool use_stdin; - Bool use_stdout; - Bool use_textfile; - - Bool append; - int soffset; - int aoffset; - - char outfile_name[FILENAME_MAX], - outfile_string[FILENAME_MAX]; - - mitkIpPicDescriptor *pic = NULL,*header; - - - /*--------------- commandline scaning starts here -----------*/ - append = False; - use_stdin = True; - use_stdout = True; - scan_error = False; - use_textfile = False; - - aoffset = 0; - soffset = 0; - - n = 1; - while( n < argc ) - { - if( *argv[n] == '-' ) - switch( *(argv[n]+1) ) - { - case 'a': append = True; - ++aoffset; - break; - /*case 'o': use_stdout = False; - strcpy( outfile_string, argv[n]+2 ); - if( outfile_string[0] == '\0' ) - scan_error = True; - break;*/ - case 'h': - case 'H': scan_error = True; - break; - case 'f': use_textfile = True; - ++aoffset; - break; - default: fprintf( stderr, - "%s: sorry, unknown option -%c\n", - argv[0], *(argv[n]+1) ); - scan_error = True; - break; - } - else - { - use_stdin = False; - strcpy( outfile_string, argv[n] ); - } - n++; - } - - if( scan_error ) - { - fprintf( stderr, "Usage: %s -a -f outfile infiles \n", argv[0] ); - fprintf( stderr, " -a appends the infiles to outfile\n" ); - fprintf( stderr, " -f \"infiles\" is a text file containing the list of inputfiles\n" ); - fprintf( stderr, " outfile the outputfile to create\n" ); - fprintf( stderr, " infiles a list of inputfiles\n" ); - exit( -1 ); - } - - /*--------------- commandline scaning ends here -------------*/ - - /* read text file, if specified*/ - if(use_textfile) - { - char tmp[FILENAME_MAX]; - FILE *f; - - n_infiles=0; - - f=fopen(argv[aoffset+2], "rt"); - if(f==NULL) - { - fprintf( stderr, "Couldn't open text file containing the list of inputfiles.\n", argv[0] ); - exit( -2 ); - } - - while(!feof(f)) - { - fgets(tmp, 255, f); - ++n_infiles; - } - - infile_names=malloc(n_infiles*sizeof(char*)); - - rewind(f); - - i=0; - while(!feof(f)) - { - char *nl; - infile_names[i]=malloc(FILENAME_MAX*sizeof(char)); - fgets(infile_names[i], FILENAME_MAX, f); - nl=infile_names[i]+strlen(infile_names[i])-1; - if(*nl=='\n') *nl=0; - if(mitkIpPicAccess(infile_names[i], 4)==0) - ++i; - else - { - free(infile_names[i]); - --n_infiles; - } - } - } - else - { - n_infiles=argc-2-aoffset; - if(n_infiles<=0) - exit( -3 ); - - infile_names=malloc(n_infiles*sizeof(char*)); - for(i=0;in[pic->dim-1]; - else - soffset = 0; - } - - header=mitkIpPicGetHeader( infile_names[0], NULL); - header = mitkIpPicGetTags( infile_names[0], header ); - - for( i=0; iinfo->write_protect = mitkIpFalse; - pic->info->tags_head = _mitkIpPicCloneTags(header->info->tags_head ); - if((i==0) && (!append)) - { - pic->dim++; pic->n[pic->dim-1]=1; - mitkIpPicPut(argv[aoffset+1], pic); - } - else - mitkIpPicPutSlice( argv[aoffset+1], - pic, - soffset + i + 1 ); - - } - - exit( 0 ); -} diff --git a/Utilities/IpPic/picinfo.c b/Utilities/IpPic/picinfo.c deleted file mode 100755 index eeb361ad7d0..00000000000 --- a/Utilities/IpPic/picinfo.c +++ /dev/null @@ -1,309 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -/* - * $RCSfile$ - *--------------------------------------------------------------- - * DESCRIPTION - * prints information about a picfile - * - * $Log$ - * Revision 1.7 2002/11/13 17:53:00 ivo - * new ipPic added. - * - * Revision 1.6 2002/10/31 10:00:30 ivo - * zlib.lib including headers now in win32. gz-extension should work now on every windows. - * WIN32 define changed to standard _WIN32. - * - * Revision 1.5 2002/04/18 19:09:13 ivo - * compression (zlib) activated. - * - * Revision 1.4 2000/05/04 12:52:42 ivo - * inserted BSD style license - * - * Revision 1.3 2000/05/04 12:36:02 ivo - * some doxygen comments. - * - * Revision 1.2 1997/09/15 13:21:22 andre - * switched to new what string format - * - * Revision 1.1.1.1 1997/09/06 19:10:00 andre - * initial import - * - * Revision 0.1 1993/04/02 16:18:39 andre - * now works on PC, SUN and DECstation - * - * Revision 0.0 1993/03/26 12:56:26 andre - * Initial revision, NO error checking - * - * - *--------------------------------------------------------------- - * - */ -#ifndef lint - static char *what = { "@(#)picinfo \t\tGerman Cancer Research Center (DKFZ)\t"__DATE__"\t$Revision$" }; -#endif - -/* -** defines -*/ - -/* -** standard includes -*/ -#include -#include - -#ifndef _WIN32 -#include -#else -#include -#endif - -#include - -/* -** ip includefiles -*/ -#include "mitkIpPic.h" - -/* -** typedefs -*/ -typedef int Bool; -#define TRUE 1 -#define FALSE 0 - -/* -** private macros -*/ -#define Min(x, y) (((x) < (y)) ? (x) : (y)) -#define Max(x, y) (((x) > (y)) ? (x) : (y)) - - -#define MIN_MAX(min, max, type) \ - for( i=0; i<_mitkIpPicElements(pic); i++ ) \ - { \ - type pixel = ((type *)pic->data)[i]; \ - \ - if( pixel < min ) \ - min = pixel; \ - else if( pixel > max ) \ - max = pixel; \ - } - -/* -** the action starts here -*/ -int main( int argc, char *argv[] ) -{ - int i; - - long min_i = LONG_MAX, - max_i = LONG_MIN; - double min_f = LONG_MAX, - max_f = LONG_MIN; - - int n; - Bool scan_error; - Bool use_stdin; - - Bool show_extrema; - mitkIpUInt4_t flags; - -#ifndef FILENAME_MAX -#define FILENAME_MAX 256 -#endif - - char picfile_name[FILENAME_MAX]; - - mitkIpPicDescriptor *pic; - - - /*--------------- commandline scaning starts here -----------*/ - use_stdin = TRUE; - scan_error = FALSE; - - show_extrema = FALSE; - flags = _mitkIpPicInfoNORMAL; - - n = 1; - while( n < argc ) - { - if( *argv[n] == '-' ) - switch( *(argv[n]+1) ) - { - case 'e': - show_extrema = TRUE; - break; - case 's': - flags |= _mitkIpPicInfoSHORT; - break; - case 'h': - case 'H': - scan_error = TRUE; - break; - default: fprintf( stderr, "%s: sorry, unknown option -%c\n", argv[0], *(argv[n]+1) ); - scan_error = TRUE; - break; - } - else - { - if( use_stdin ) - { - use_stdin = FALSE; - strcpy( picfile_name, argv[n] ); - } - else - scan_error = TRUE; - } - n++; - } - - if( scan_error ) - { - fprintf( stderr, "Usage: %s -e -s [picfile]\n", argv[0] ); - fprintf( stderr, " -e calculate the extrema\n" ); - fprintf( stderr, " -s short output\n" ); - fprintf( stderr, " picfile the picfile to examine, if not given stdin is used\n" ); - exit( mitkIpError ); - } - - /*--------------- commandline scaning ends here -------------*/ - - /* make filenames */ - if( !use_stdin) - if( (strrchr(picfile_name, '/') >= strrchr(picfile_name, '.')) ) - strcat( picfile_name, ".pic" ); - - /* read picfile */ - if( use_stdin ) - pic = mitkIpPicGetHeader( "stdin", - NULL ); - else - { - pic = mitkIpPicGetHeader( picfile_name, - NULL ); - pic = mitkIpPicGetTags( picfile_name, - pic ); - } - - if( pic == NULL ) - { - fprintf( stderr, "sorry, can't read %s\n", picfile_name ); - exit( mitkIpError ); - } - - printf( "\n" ); - printf( "%s\n",picfile_name ); - - printf( "%.*s\n", _mitkIpPicTAGLEN, pic->info->version ); - printf( "--------------------\n" ); - - printf( "type: %s [%i]\n", mitkIpPicTypeName(pic->type), pic->type ); - - printf( "bpe : %i\n", pic->bpe ); - - printf( "dim : %i ", pic->dim ); - for( i=0; idim; i++ ) - printf( "[%i] ", pic->n[i] ); - printf( "\n" ); - - if( pic != NULL - && pic->info->tags_head != NULL ) - printf( "--------------------\n" ); - - _mitkIpPicInfoPrintTags( stdout, - pic->info->tags_head, - 1, - flags ); - - printf( "--------------------\n" ); - printf( "size of the image data: %u\n", _mitkIpPicSize( pic ) ); - - - if( show_extrema ) - { - pic = mitkIpPicGet( picfile_name, - pic ); - - switch( mitkIpPicDR( pic->type, pic->bpe ) ) - { - case mitkIpPicDR( mitkIpPicUInt, 8 ): - { - MIN_MAX( min_i, max_i, mitkIpUInt1_t ); - printf( "min: %li, max: %li\n", min_i, max_i ); - } - break; - case mitkIpPicDR( mitkIpPicInt, 16 ): - { - MIN_MAX( min_i, max_i, mitkIpInt2_t ); - printf( "min: %li, max: %li\n", min_i, max_i ); - } - break; - case mitkIpPicDR( mitkIpPicInt, 32 ): - { - MIN_MAX( min_i, max_i, mitkIpInt4_t ); - printf( "min: %li, max: %li\n", min_i, max_i ); - } - break; - case mitkIpPicDR( mitkIpPicFloat, 32 ): - { - MIN_MAX( min_f, max_f, mitkIpFloat4_t ); - printf( "min: %f, max: %f\n", min_f, max_f ); - } - break; - case mitkIpPicDR( mitkIpPicFloat, 64 ): - { - MIN_MAX( min_f, max_f, mitkIpFloat8_t ); - printf( "min: %f, max: %f\n", min_f, max_f ); - } - break; - default : - printf( "sorry, datatype not supported. (min,max)\n" ); - break; - } - } - - mitkIpPicFree( pic ); - - return( 0 ); -} diff --git a/Utilities/IpPic/test.c b/Utilities/IpPic/test.c deleted file mode 100755 index a96d506f4bd..00000000000 --- a/Utilities/IpPic/test.c +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================ - - Copyright (c) German Cancer Research Center (DKFZ) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - All advertising materials mentioning features or use of this software must - display the following acknowledgement: - - "This product includes software developed by the German Cancer Research - Center (DKFZ)." - - - Neither the name of the German Cancer Research Center (DKFZ) nor the names - of its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND - CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN - CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -============================================================================*/ - - -#include -#include - -#include "mitkIpPic.h" -#include "mitkIpPicAnnotation.h" - -int main( int argc, char *argv[] ) -{ - mitkIpPicDescriptor *pic; - mitkIpPicDescriptor *pic2; - mitkIpPicTSV_t *tsv; - mitkIpPicTSV_t *tsv2; - mitkIpPicTSV_t *tsv3; - mitkIpPicAnnotation_t a; - char buff[] = "test test"; - - printf( "%s\n", _mitkIpEndian()==_mitkIpEndianBig?"BigEndian":"LittleEndian" ); - - if( argc != 3 ) - exit(-1); - - pic = mitkIpPicGet( argv[1], - NULL ); - - mitkIpPicSetWriteCompression( mitkIpTrue ); - mitkIpPicPut( argv[2], - pic ); - - mitkIpPicFree( pic ); - - return(0); -} diff --git a/Utilities/IpSegmentation/CMakeLists.txt b/Utilities/IpSegmentation/CMakeLists.txt deleted file mode 100644 index fb533b5b9ab..00000000000 --- a/Utilities/IpSegmentation/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(module_options NO_INIT GCC_DEFAULT_VISIBILITY WARNINGS_NO_ERRORS) -if(MITK_WIN32_FORCE_STATIC) - list(APPEND module_options FORCE_STATIC) -endif() - -MITK_CREATE_MODULE( - DEPENDS MitkIpPic MitkIpFunc - PACKAGE_DEPENDS ANN - ${module_options} -) diff --git a/Utilities/IpSegmentation/GraphicsGems.h b/Utilities/IpSegmentation/GraphicsGems.h deleted file mode 100644 index 3bd91ad5e48..00000000000 --- a/Utilities/IpSegmentation/GraphicsGems.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * This code is taken from the Graphics Gems book series by Academic Press. - * - * For information on the books and more of the source code - * you can visit http://tog.acm.org/GraphicsGems/ - * - * The following note on license is taken from the mentions website: - * - * EULA: The Graphics Gems code is copyright-protected. - * In other words, you cannot claim the text of the code - * as your own and resell it. Using the code is permitted - * in any program, product, or library, non-commercial or - * commercial. Giving credit is not required, though is - * a nice gesture. The code comes as-is, and if there are - * any flaws or problems with any Gems code, nobody involved - * with Gems - authors, editors, publishers, or webmasters - * - are to be held responsible. Basically, don't be a jerk, - * and remember that anything free comes with no guarantee. - * -*/ - -/* - * GraphicsGems.h - * Version 1.0 - Andrew Glassner - * from "Graphics Gems", Academic Press, 1990 - */ - -#ifndef GG_H - -#define GG_H 1 - -/*********************/ -/* 2d geometry types */ -/*********************/ - -typedef struct Point2Struct { /* 2d point */ - double x, y; -} Point2; -typedef Point2 Vector2; - -typedef struct IntPoint2Struct { /* 2d integer point */ - int x, y; -} IntPoint2; - -typedef struct Matrix3Struct { /* 3-by-3 matrix */ - double element[3][3]; -} Matrix3; - -typedef struct Box2dStruct { /* 2d box */ - Point2 min, max; -} Box2; - - -/*********************/ -/* 3d geometry types */ -/*********************/ - -typedef struct Point3Struct { /* 3d point */ - double x, y, z; -} Point3; -typedef Point3 Vector3; - -typedef struct IntPoint3Struct { /* 3d integer point */ - int x, y, z; -} IntPoint3; - - -typedef struct Matrix4Struct { /* 4-by-4 matrix */ - double element[4][4]; -} Matrix4; - -typedef struct Box3dStruct { /* 3d box */ - Point3 min, max; -} Box3; - - - -/***********************/ -/* one-argument macros */ -/***********************/ - -/* absolute value of a */ -#define ABS(a) (((a)<0) ? -(a) : (a)) - -/* round a to nearest int */ -#define ROUND(a) ((a)>0 ? (int)((a)+0.5) : -(int)(0.5-(a))) - -/* take sign of a, either -1, 0, or 1 */ -#define ZSGN(a) (((a)<0) ? -1 : (a)>0 ? 1 : 0) - -/* take binary sign of a, either -1, or 1 if >= 0 */ -#define SGN(a) (((a)<0) ? -1 : 1) - -/* shout if something that should be true isn't */ -#define ASSERT(x) \ -if (!(x)) fprintf(stderr," Assert failed: x\n"); - -/* square a */ -#define SQR(a) ((a)*(a)) - - -/***********************/ -/* two-argument macros */ -/***********************/ - -/* find minimum of a and b */ -#define MIN(a,b) (((a)<(b))?(a):(b)) - -/* find maximum of a and b */ -#define MAX(a,b) (((a)>(b))?(a):(b)) - -/* swap a and b (see Gem by Wyvill) */ -#define SWAP(a,b) { a^=b; b^=a; a^=b; } - -/* linear interpolation from l (when a=0) to h (when a=1)*/ -/* (equal to (a*h)+((1-a)*l) */ -#define LERP(a,l,h) ((l)+(((h)-(l))*(a))) - -/* clamp the input to the specified range */ -#define CLAMP(v,l,h) ((v)<(l) ? (l) : (v) > (h) ? (h) : v) - - -/****************************/ -/* memory allocation macros */ -/****************************/ - -/* create a new instance of a structure (see Gem by Hultquist) */ -#define NEWSTRUCT(x) (struct x *)(malloc((unsigned)sizeof(struct x))) - -/* create a new instance of a type */ -#define NEWTYPE(x) (x *)(malloc((unsigned)sizeof(x))) - - -/********************/ -/* useful constants */ -/********************/ - -#define PI 3.141592 /* the venerable pi */ -#define PITIMES2 6.283185 /* 2 * pi */ -#define PIOVER2 1.570796 /* pi / 2 */ -#define E 2.718282 /* the venerable e */ -#define SQRT2 1.414214 /* sqrt(2) */ -#define SQRT3 1.732051 /* sqrt(3) */ -#define GOLDEN 1.618034 /* the golden ratio */ -#define DTOR 0.017453 /* convert degrees to radians */ -#define RTOD 57.29578 /* convert radians to degrees */ - - -/************/ -/* booleans */ -/************/ - -#define TRUE 1 -#define FALSE 0 -#define ON 1 -#define OFF 0 -typedef int boolean; /* boolean data type */ -typedef boolean flag; /* flag data type */ - -extern double V2SquaredLength(), V2Length(); -extern double V2Dot(), V2DistanceBetween2Points(); -extern Vector2 *V2Negate(), *V2Normalize(), *V2Scale(), *V2Add(), *V2Sub(); -extern Vector2 *V2Lerp(), *V2Combine(), *V2Mul(), *V2MakePerpendicular(); -extern Vector2 *V2New(), *V2Duplicate(); -extern Point2 *V2MulPointByMatrix(); -extern Matrix3 *V2MatMul(); - -extern double V3SquaredLength(), V3Length(); -extern double V3Dot(), V3DistanceBetween2Points(); -extern Vector3 *V3Normalize(), *V3Scale(), *V3Add(), *V3Sub(); -extern Vector3 *V3Lerp(), *V3Combine(), *V3Mul(), *V3Cross(); -extern Vector3 *V3New(), *V3Duplicate(); -extern Point3 *V3MulPointByMatrix(); -extern Matrix4 *V3MatMul(); - -extern double RegulaFalsi(), NewtonRaphson(), findroot(); - -#endif diff --git a/Utilities/IpSegmentation/empty.xpm b/Utilities/IpSegmentation/empty.xpm deleted file mode 100644 index ba49885034a..00000000000 --- a/Utilities/IpSegmentation/empty.xpm +++ /dev/null @@ -1,89 +0,0 @@ -/* XPM */ -static const char *empty_xpm [] = { -/* width height num_colors chars_per_pixel */ -" 80 80 2 1", -/* colors */ -". c #000000", -"# c #c4c4c4", -/* pixels */ -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"..............................................#.................................", -".....................##...##..#.##.##..####..######..##.##......................", -"...................##....#..#..#..#..#..#..#..#...#..#....##....................", -".................##......####..#..#..#..#..#..#...#.##......##..................", -"...................##....#.....#..#..#..#..#..#...#.#.....##....................", -".....................##..##..#.#..#..#..#..#..#....##...##......................", -"..........................###.###.##.##.###....##..#............................", -"........................................#..........#............................", -"........................................#.........#.............................", -".......................................###.......##.............................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................", -"................................................................................" -}; diff --git a/Utilities/IpSegmentation/files.cmake b/Utilities/IpSegmentation/files.cmake deleted file mode 100644 index 6452f6aec47..00000000000 --- a/Utilities/IpSegmentation/files.cmake +++ /dev/null @@ -1,19 +0,0 @@ -set(H_FILES - -) - -set(CPP_FILES - ipSegmentationError.c - ipSegmentationNew.c - ipSegmentationFree.c - ipSegmentationClear.c - ipSegmentationCombineRegion.c - ipSegmentationRegionGrower.cpp - ipSegmentationContourExtraction.cpp - ipSegmentationReplaceRegion.cpp - ipSegmentationRegionCutter.cpp - ipSegmentationGrowerHistory.cpp - ipSegmentationContourUtils.cpp - ipSegmentationInterpolate.c - ipSegmentationUndo.c -) diff --git a/Utilities/IpSegmentation/ipSegmentation.h b/Utilities/IpSegmentation/ipSegmentation.h deleted file mode 100644 index 092ba392523..00000000000 --- a/Utilities/IpSegmentation/ipSegmentation.h +++ /dev/null @@ -1,209 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -/*! \mainpage - - \author Tobias Kunert, Thomas Boettger, Tobias Heimann - \date October 2002 - - The ipMITKSegmentation library manages the results of the - segmentation process. It provides basic capabilities - to modify segmentation images. It includes also an - undo mechanism which allows to trace back the changes. - -*/ - -#ifndef IPSEGMENTATION_H -#define IPSEGMENTATION_H - -#include - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" -{ -#endif - - /*! - \brief Defines the data type of the segmentation images. - */ -#define ipMITKSegmentationTYPE mitkIpUInt1_t -#define ipMITKSegmentationTYPE_ID mitkIpPicUInt -#define ipMITKSegmentationBPE 8 -#define tagSEGMENTATION_EMPTY "SEGMENTATION_EMPTY" - - /*! - \brief Initializes the segmentation. - @param image the original image which will be segmented - @return the segmentation. - */ - extern mitkIpPicDescriptor* ipMITKSegmentationNew (mitkIpPicDescriptor* image); - - /*! - \brief Destroys the segmentation. - @param segmentation the segmentation. - */ - extern void ipMITKSegmentationFree (mitkIpPicDescriptor* segmentation); - - /*! - \brief Clears the segmentation data, i.e. the pixels will - be set to zero. - @param segmentation the segmentation - */ - extern void ipMITKSegmentationClear (mitkIpPicDescriptor* segmentation); - - /*! - \brief Interpolates the shape of segmentations. - @param pic1,pic2 the images of the segmentation - @param ratio the ratio of the images, the ratios 0.0 and 1.0 will - produce pic1 and pic2, accordingly. - */ - extern mitkIpPicDescriptor* ipMITKSegmentationInterpolate (mitkIpPicDescriptor* pic1, mitkIpPicDescriptor* pic2, const mitkIpFloat4_t ratio); - - /*! - \brief The type of logical operation. - */ - enum LogicalOp { - IPSEGMENTATION_OP /*! copy of input image */, - IPSEGMENTATION_AND /*! logical and operator */, - IPSEGMENTATION_OR /*! the or operator */, - IPSEGMENTATION_XOR /*! the exclusive-or operator */ - }; - - /*! - \brief Combines the region with the segmentation image. - @param points the array of points, each point is represented - by a 2-D vector (x, y) - @param segmentation the segmentation. - @param num the number of points - @param mask the image which restricts the operation to a particular region - @param operation the operation which will be performed (see above) - @param value the operand value of the operation - \note The last point is automatically connected with the first one. - */ - extern void ipMITKSegmentationCombineRegion (mitkIpPicDescriptor* segmentation, const mitkIpInt4_t* const points, const int num, mitkIpPicDescriptor* mask, const int operation, int value); - - /*! - \brief Enables the undo operation for the specified segmentation. - @param segmentation the segmentation - @param level the number of undo levels - */ - extern void ipMITKSegmentationUndoEnable (mitkIpPicDescriptor* segmentation, const mitkIpUInt1_t level); - - /*! - \brief Disables the undo operation for the specified segmentation. - The available data will be discarded. - @param segmentation the segmentation - */ - extern void ipMITKSegmentationUndoDisable (mitkIpPicDescriptor* segmentation); - - /*! - \brief Checks if the undo operation is enabled. - @param segmentation the segmentation - */ - extern mitkIpBool_t ipMITKSegmentationUndoIsEnabled (mitkIpPicDescriptor* segmentation); - - /*! - \brief Checks if any data for undo is available. - pending? - */ - extern mitkIpBool_t ipMITKSegmentationUndoAvailable (mitkIpPicDescriptor* segmentation); - - /*! - \brief Save the segmentation image before it is changed. - @param segmentation the segmentation - */ - extern void ipMITKSegmentationUndoSave (mitkIpPicDescriptor* segmentation); - - /*! - \brief Steps to the previous undo level. The data which has been saved - before the last modifications will be restored. - */ - extern void ipMITKSegmentationUndo (mitkIpPicDescriptor* segmentation); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -/*! - Starts a 4 neighbourhood region growing at startOfs (y*picWidth+x) of the 2D image src. - If relativeBounds is true, the region grows in [base-lowerBound, base+upperBound], in which base is the average - color of the 9 pixels around startOfs. If relativeBounds is false, the region grows in [lowerBound, upperBound]. - If maxIterations is > 0, the growing process is stopped after maxIterations. - If segBuffer is 0, new memory for the segmented image is allocated and returned, else the segBuffer is used - to store the result (has to be an 8-bit datatype, e.g. mitkIpUInt1_t). - histBuffer must be 0 or a pointer to a 16-bit mitkIpPicUInt image of the same size as src. In case of the latter, - history data is written to that buffer: the seed pixel gets a 1, all direct neighbours 2 etc. The buffer is - not cleared in this function and can thus hold history data of several growing processes in different areas. - */ -extern mitkIpPicDescriptor* ipMITKSegmentationGrowRegion4N( mitkIpPicDescriptor *src, int startOfs, bool relativeBounds, float lowerBound, float upperBound, int maxIterations, mitkIpPicDescriptor *segBuffer, mitkIpPicDescriptor *histBuffer=nullptr ); - -/*! - Same as the other ipMITKSegmentationGrowRegion4N with two additional return values: - contourOfs holds the lowest point of the resulting region and is thus guaranteed to be part of the contour - Take care: if the region could not grow at all (e.g. with fixed borders) contourOfs will be -1 !!! - startCol holds the color that was used as base if relativeBounds is true - */ -extern mitkIpPicDescriptor* ipMITKSegmentationGrowRegion4N( mitkIpPicDescriptor *src, int startOfs, bool relativeBounds, float lowerBound, float upperBound, int maxIterations, mitkIpPicDescriptor *segBuffer, int &contourOfs, float &startCol, mitkIpPicDescriptor *histBuffer=nullptr ); - -/*! - Replaces the 4 neighbourhood region around startOfs (y*picWidth+x) of the 2D segmented image seg with newValue. - Seg has to be an 8-bit datatype, e.g. mitkIpUInt1_t. - Returns the number of replaced pixels. If newValue is the same as the old value, the function returns 0. - */ -extern int ipMITKSegmentationReplaceRegion4N( mitkIpPicDescriptor *seg, int startOfs, mitkIpInt1_t newValue ); - -/*! - Same as above, but for the 8 neighbourhood contour. - */ -extern float* ipMITKSegmentationGetContour8N( const mitkIpPicDescriptor *seg, int startOfs, int &numPoints, int &sizeBuffer, float *pointBuffer=nullptr ); - - -typedef struct { - float *traceline; // x/y points describing the calculated path - memory has to be freed! - bool *onGradient; // flags for each point if path was calculated based on gradient (true) or on max distance (false) - memory has to be freed! - int numPoints; // number of points in the path - int absMin; // indexes the point at the narrowest part of the path - bool cutIt; // true if a leak has been found - float cutCoords[4]; // x1,y1,x2,y2 of the two contour points where the leak can be cut - float *deleteCurve; // x/y points of the closed contour describing the leak region - int deleteSize; // number of points in this contour -} tCutResult; - -/*! - Calculates a path from ofs to the origin of the growing process, when possible on the skeleton of the - segmented area. The narrowest part of this path is used to create two cut points that are part of the contour - and can later be used to split the segmentation. This funtion is useful for detecting and removing leaks in - region growing. - */ -extern tCutResult ipMITKSegmentationGetCutPoints( mitkIpPicDescriptor *seg, mitkIpPicDescriptor *history, int ofs ); - -/*! - Creates a grower history (i.e. the order in which a region grower would have segmented the area) of the given - segmentation, origin of the grower is startOfs. histBuffer must be a 16bit unsigned int or 0, in the latter - case the pic is created. - */ -extern mitkIpPicDescriptor* ipMITKSegmentationCreateGrowerHistory( mitkIpPicDescriptor *seg, int startOfs, mitkIpPicDescriptor *histBuffer ); - -/*! - Splits a contour in two parts. contour is the original contour, cutCoords a pointer to an x1-y1-x2-y2 array that - specifies the two points where the contour should be cut (these cutpoints must be points of the original contour!). - part1 and part2 have to be float arrays of a sufficient size to store the two parts. The sizes of the two parts - are returned in size1 and size2. - */ -extern void ipMITKSegmentationSplitContour( float *contour, int sizeContour, float *cutCoords, float *part1, int &size1, float *part2, int &size2 ); - -/*! - Returns true if the specified point lies insede the contour, else returns false. - */ -extern bool ipMITKSegmentationIsInsideContour( float *contour, int sizeContour, float x, float y ); - -#endif diff --git a/Utilities/IpSegmentation/ipSegmentationClear.c b/Utilities/IpSegmentation/ipSegmentationClear.c deleted file mode 100644 index 663164c73bf..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationClear.c +++ /dev/null @@ -1,76 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ -#include -#include "empty.xpm" -#include "ipSegmentationP.h" - -void -ipMITKSegmentationClear (mitkIpPicDescriptor* segmentation) -{ - ipMITKSegmentationTYPE *cur, *last; - mitkIpPicTSV_t* tag; - const char *src; - mitkIpUInt1_t *dst; - mitkIpUInt4_t i, j; - - assert (segmentation); - if (ipMITKSegmentationUndoIsEnabled (segmentation)) { - ipMITKSegmentationUndoSave (segmentation); - } - - /* clear the image data */ - - cur = (ipMITKSegmentationTYPE *) segmentation->data; - last = cur + _mitkIpPicElements (segmentation); - while (cur < last) { - *cur++ = 0; - } - - /* create an 'empty' tag */ - - tag = mitkIpPicQueryTag (segmentation, tagSEGMENTATION_EMPTY); - if (!tag) { - tag = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - strcpy (tag->tag, tagSEGMENTATION_EMPTY); - tag->type = mitkIpPicBool; - tag->bpe = sizeof (mitkIpBool_t) / 8; - tag->dim = 1; - tag->n[0] = 1; - tag->value = malloc (sizeof (mitkIpBool_t)); - *((mitkIpBool_t *) tag->value) = mitkIpTrue; - mitkIpPicAddTag (segmentation, tag); - } - - /* create an `empty` icon */ - - tag = mitkIpPicQueryTag (segmentation, "ICON80x80"); - if (!tag) { - tag = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - tag->type = mitkIpPicUInt; - tag->bpe = 8; - tag->dim = 2; - tag->n[0] = 80; - tag->n[1] = 80; - tag->value = malloc (tag->n[0] * tag->n[1] * sizeof (mitkIpUInt1_t)); - strcpy (tag->tag, "ICON80x80"); - mitkIpPicAddTag (segmentation, tag); - } - dst = (mitkIpUInt1_t *) tag->value; - for (i = 0; i < 80; i++) { - src = empty_xpm [3+i]; - for (j = 0; j < 80; j++) { - *dst = (*src == '.' ? 0 : 196); - src++; - dst++; - } - } -} diff --git a/Utilities/IpSegmentation/ipSegmentationCombineRegion.c b/Utilities/IpSegmentation/ipSegmentationCombineRegion.c deleted file mode 100644 index 439358f2853..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationCombineRegion.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * This code is in part (the CONCAVE macro) a minimal variation - * of the code from the Graphics Gems book series. - * - * The method ipMITKSegmentationCombineRegion is by Tobias Kunert, DKFZ - * - * For information on the Graphics Gems books and more of - * the source code you can visit http://tog.acm.org/GraphicsGems/ - * - * The following note on license is taken from the mentions website: - * - * EULA: The Graphics Gems code is copyright-protected. - * In other words, you cannot claim the text of the code - * as your own and resell it. Using the code is permitted - * in any program, product, or library, non-commercial or - * commercial. Giving credit is not required, though is - * a nice gesture. The code comes as-is, and if there are - * any flaws or problems with any Gems code, nobody involved - * with Gems - authors, editors, publishers, or webmasters - * - are to be held responsible. Basically, don't be a jerk, - * and remember that anything free comes with no guarantee. - * -*/ - -#include -#include -#include -#include "GraphicsGems.h" -#include "ipSegmentationP.h" - -// changed "for (x=XL; x < XR ; x++)" to "for (x=XL; x <= XR ; x++)" -> correct segmentation results -#define DRAWPROC(TYPE, PIC, MSK, XL, XR, Y, VALUE, CMD) \ -{ \ - int x; \ - for (x=XL; x <= XR ; x++) \ - MASK (TYPE, PIC, MSK, VALUE, x, Y, CMD) \ -} - -/* - * Concave Polygon Scan Conversion - * by Paul Heckbert - * from "Graphics Gems", Academic Press, 1990 - */ - -/* - * concave: scan convert nvert-sided concave non-simple polygon with vertices at - * (point[i].x, point[i].y) for i in [0..nvert-1] within the window win by - * calling spanproc for each visible span of pixels. - * Polygon can be clockwise or counterclockwise. - * Algorithm does uniform point sampling at pixel centers. - * Inside-outside test done by Jordan's rule: a point is considered inside if - * an emanating ray intersects the polygon an odd number of times. - * drawproc should fill in pixels from xl to xr inclusive on scanline y, - * e.g: - * drawproc(y, xl, xr) - * int y, xl, xr; - * { - * int x; - * for (x=xl; x<=xr; x++) - * pixel_write(x, y, pixelvalue); - * } - * - * Paul Heckbert 30 June 81, 18 Dec 89 - */ - - -#define ALLOC(ptr, type, n) ASSERT(ptr = (type *)malloc((n)*sizeof(type))) - -typedef struct { /* window: a discrete 2-D rectangle */ - int x0, y0; /* xmin and ymin */ - int x1, y1; /* xmax and ymax (inclusive) */ -} Window; - -typedef struct { /* a polygon edge */ - double x; /* x coordinate of edge's intersection with current scanline */ - double dx; /* change in x with respect to y */ - int i; /* edge number: edge i goes from pt[i] to pt[i+1] */ -} Edge; - -static int n; /* number of vertices */ -static Point2 *pt; /* vertices */ - -static int nact; /* number of active edges */ -static Edge *active; /* active edge list:edges crossing scanline y */ - -int compare_ind(const void* /*u*/, const void* /*v*/), \ - compare_active(const void* /*u*/, const void* /*v*/); - -#define CONCAVE(TYPE, PIC, MSK, POINT, NVERT, WINDOW, VALUE, CMD) \ -{ \ - \ - int k, y0, y1, y, i, j, xl, xr; \ - int *ind; /* list of vertex indices, sorted by pt[ind[j]].y */ \ - \ - n = (int)NVERT; \ - pt = POINT; \ - if (n<=0) return; \ - ALLOC(ind, int, n); \ - ALLOC(active, Edge, n); \ - \ - /* create y-sorted array of indices ind[k] into vertex list */ \ - for (k=0; ky0, ceil(pt[ind[0]].y-.5)); /* ymin of polygon */ \ - y1 = MIN(win->y1, floor(pt[ind[n-1]].y-.5)); /* ymax of polygon */ \ - \ - for (y=y0; y<=y1; y++) { /* step through scanlines */ \ - /* scanline y is at y+.5 in continuous coordinates */ \ - /* check vertices between previous scanline and current one, if any */ \ - for (; k0 ? i-1 : n-1; /* vertex previous to i */ \ - if (pt[j].y <= y-.5) /* old edge, remove from active list */ \ - cdelete(j); \ - else if (pt[j].y > y+.5) /* new edge, add to active list */ \ - cinsert(j, y); \ - j = i y+.5) /* new edge, add to active list */ \ - cinsert(i, y); \ - } \ - \ - /* sort active edge list by active[j].x */ \ - qsort(active, nact, sizeof active[0], compare_active); \ - \ - /* draw horizontal segments for scanline y */ \ - for (j=0; jx0) xl = win->x0; \ - xr = floor(active[j+1].x-.5); /* right end of span */ \ - if (xr>win->x1) xr = win->x1; \ - if (xl<=xr) \ - DRAWPROC(TYPE, PIC, MSK, xl, xr, y, VALUE, CMD);/* draw pixels in span */ \ - active[j].x += active[j].dx; /* increment edge coords */ \ - active[j+1].x += active[j+1].dx; \ - } \ - } \ -} \ - -static void cdelete(i) /* remove edge i from active list */ -int i; -{ - int j; - - for (j=0; j=nact) return; /* edge not in active list; happens at win->y0*/ - nact--; - memmove( &active[j], &active[j+1], (nact-j)*sizeof active[0]); -} - -static void cinsert(i, y) /* append edge i to end of active list */ -int i, y; -{ - int j; - double dx; - Point2 *p, *q; - - j = ix-p->x)/(q->y-p->y); - active[nact].x = dx*(y+.5-p->y)+p->x; - active[nact].i = i; - nact++; -} - -/* comparison routines for qsort */ -int compare_ind(arg1, arg2) const void *arg1, *arg2; -{ - int* u = (int*)arg1; - int* v = (int*)arg2; - return pt[*u].y <= pt[*v].y ? -1 : 1; -} - -int compare_active(arg1, arg2) const void *arg1, *arg2; -{ - Edge* u = (Edge*)arg1; - Edge* v = (Edge*)arg2; - return u->x <= v->x ? -1 : 1; -} - - -void ipMITKSegmentationCombineRegion (mitkIpPicDescriptor* segmentation, const mitkIpInt4_t* const points, const int num, mitkIpPicDescriptor* mask, const int operation, int value) -{ - int idx; - Point2* pl; - Window *win; - mitkIpPicTSV_t* tag; - - assert (segmentation); - if (ipMITKSegmentationUndoIsEnabled (segmentation)) { - ipMITKSegmentationUndoSave (segmentation); - } - tag = mitkIpPicQueryTag (segmentation, tagSEGMENTATION_EMPTY); - tag = mitkIpPicDelTag (segmentation, tagSEGMENTATION_EMPTY); - if (tag) { - mitkIpPicFreeTag (tag); - } - - win = (Window *) malloc (sizeof (Window)); - if (!win) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - win->x0 = 0; - win->y0 = 0; - win->x1 = (int) segmentation->n[0] - 1; - win->y1 = (int) segmentation->n[1] - 1; - - pl = (Point2 *) malloc (num * sizeof (Point2)); - if (!pl) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - - for (idx = 0; idx < num; idx++) - { - pl[idx].x = points[2*idx]; - pl[idx].y = points[2*idx+1]; - } - - switch (operation) { - - case IPSEGMENTATION_OP: - //mitkIpPicFORALL_6(CONCAVE, segmentation, mask, pl, num, win, value, OP ) ; - CONCAVE(ipMITKSegmentationTYPE, segmentation, mask, pl, num, win, value, OP); - break; - - case IPSEGMENTATION_AND: - //mitkIpPicFORALL_6(CONCAVE, segmentation, mask, pl, num, win, value, AND ) ; - CONCAVE(ipMITKSegmentationTYPE, segmentation, mask, pl, num, win, value, AND); - break; - - case IPSEGMENTATION_OR: - //mitkIpPicFORALL_6(CONCAVE, segmentation, mask, pl, num, win, value, OR ) ; - CONCAVE(ipMITKSegmentationTYPE, segmentation, mask, pl, num, win, value, OR); - break; - - case IPSEGMENTATION_XOR: - //mitkIpPicFORALL_6(CONCAVE, segmentation, mask, pl, num, win, value, XOR ) ; - CONCAVE(ipMITKSegmentationTYPE, segmentation, mask, pl, num, win, value, XOR); - break; - - default: - assert (0); // never get here! - } -} diff --git a/Utilities/IpSegmentation/ipSegmentationContourExtraction.cpp b/Utilities/IpSegmentation/ipSegmentationContourExtraction.cpp deleted file mode 100755 index c3442d29bd7..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationContourExtraction.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include "ipSegmentation.h" - - -// only make macros available in local scope: -namespace { - -// returns true if segmentation pixel at ofs is set, includes check for border pixels, i.e. border pixels do not result in returning true -#define SEGSET(ofs) ( \ -((ofs)>=0 && (ofs)data) + (ofs)) != 0 ) && \ -( (ofs)%line != 0 || (pos+1)%line != 0 ) && \ -( (ofs+1)%line != 0 || (pos)%line != 0 ) \ -) - - -// appends a point to result, sets finished to true if this point is the same as the first one -// allocates new momory if necessary -#define ADD_CONTOUR_POINT \ -result[numPts*2] = xPos+xCorner[dir]; \ -result[numPts*2+1] = yPos+yCorner[dir]; \ -if (result[numPts*2]==result[0] && result[numPts*2+1]==result[1] && numPts>0) finished = true; \ -numPts++; \ -if (numPts==resSize) { \ - resSize+=16+resSize/2; \ - result = (float*)realloc( result, resSize*2*sizeof(float) ); \ - if (!result) finished = true; \ -} - -} - -template -float* tmGetContour4N( const mitkIpPicDescriptor *seg, int startOfs, int &numPts, int &resSize, float *result ) -// returns the number of contour points (xy-pairs) in result -// optimized macros: DON'T TOUCH THE CODE (removed smiley, this is not funny but cruel for any maintainer!) -{ - numPts = 0; - int line = seg->n[0]; - int maxOfs = seg->n[0] * seg->n[1]; - - int straight[4] = { 1, -line, -1, line }; - int right[4] = { line, 1, -line, -1 }; - float xMod[4] = { 1.0, 0.0, -1.0, 0.0 }; - float yMod[4] = { 0.0, -1.0, 0.0, 1.0 }; - float xCorner[4] = { 1.0, 1.0, 0.0, 0.0 }; - float yCorner[4] = { 1.0, 0.0, 0.0, 1.0 }; - - int dir = 0; - int pos = startOfs; - float xPos = (float)(pos % line); - float yPos = (float)(pos / line); - - while ( dir<4 && SEGSET( pos+right[dir] ) ) dir++; - if (dir==4) return result; // no contour pixel - - bool finished = false; - if (result==nullptr) { - resSize = 2048; - result = (float*)malloc( resSize*2*sizeof(float) ); - } - - do { - if ( SEGSET( pos+right[dir] ) ) { - // modify direction (turn right): - dir = (dir-1) & 3; - // modify position: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - } - else if ( SEGSET( pos+straight[dir] ) ) { - ADD_CONTOUR_POINT - // modify position: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - } - else { - ADD_CONTOUR_POINT - // modify direction (turn left): - dir = (dir+1) & 3; - } - } while (!finished); - return result; -} - - -float* ipMITKSegmentationGetContour4N( const mitkIpPicDescriptor *seg, int startOfs, int &numPoints, int &sizeBuffer, float *pointBuffer ) -{ - float *newBuffer = nullptr; - mitkIpPicTypeMultiplexR4( tmGetContour4N, seg, newBuffer, startOfs, numPoints, sizeBuffer, pointBuffer ); - return newBuffer; -} - - -template -float* tmGetContour8N( const mitkIpPicDescriptor *seg, int startOfs, int &numPts, int &resSize, float *result ) -// returns the number of contour points (xy-pairs) in result -// optimized macros: DON'T TOUCH THE CODE ;-) -{ - numPts = 0; - int line = seg->n[0]; // width of segmentation in pixels - int maxOfs = seg->n[0] * seg->n[1]; // memory offset of pixel just beyond bottom-right-most pixel of segmentation (not a valid offset) - - int straight[4] = { 1, -line, -1, line }; // right, top, left, down (memory offsets) - int right[4] = { line, 1, -line, -1 }; // down, right, top, left - float xMod[4] = { 1.0, 0.0, -1.0, 0.0 }; - float yMod[4] = { 0.0, -1.0, 0.0, 1.0 }; - float xCorner[4] = { 1.0, 1.0, 0.0, 0.0 }; - float yCorner[4] = { 1.0, 0.0, 0.0, 1.0 }; - - int dir = 0; - int pos = startOfs; // initial position, this is where the contour search starts - float xPos = (float)(pos % line); // calculate x and y from the memory offset - float yPos = (float)(pos / line); - - while ( dir<4 && SEGSET( pos+right[dir] ) ) dir++; - if (dir==4) { - // check diagonal pixels: - dir = 0; - while ( dir<4 && SEGSET( pos+right[dir]+straight[dir] ) ) dir++; - if (dir==4) return result; // no contour pixel - // chose next suitable neighbour: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - } - - bool finished = false; - if (result==nullptr) { - resSize = 2048; - result = (float*)malloc( resSize*2*sizeof(float) ); - } - - // here xPos,yPos are on some pixel next to a segmentation pixel. Where is "next to"? This is defined by the value of dir and the offsets in right[dir]. - - // tries to complete the contour until a point is added that is identical to the first point - do { - if ( SEGSET( pos+right[dir] ) ) { // valgrind complaint: jump dependent on uninitialized value (from my current understanding this could only be some pixel value outside the image - // modify direction (turn right): // this if will evaluate to true during the first iteration - dir = (dir-1) & 3; // ok, some weird logic selects a new direction - // modify position: - pos += straight[dir]; // definitions of right and straight (plus xMod and yMod) lead to a counter-clockwise movement around the contour - xPos += xMod[dir]; - yPos += yMod[dir]; - } - else if ( SEGSET( pos+straight[dir] ) ) { - ADD_CONTOUR_POINT - // modify position: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - } - else if ( SEGSET( pos+right[dir]+straight[dir] ) ) { // valgrind complaint: jump dependent on uninitialized value - ADD_CONTOUR_POINT - // modify position: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - // modify direction (turn right): - dir = (dir-1) & 3; - // modify position second time: - pos += straight[dir]; - xPos += xMod[dir]; - yPos += yMod[dir]; - } - else { - ADD_CONTOUR_POINT - // modify direction (turn left): - dir = (dir+1) & 3; - } - } while (!finished); - return result; -} - - -float* ipMITKSegmentationGetContour8N( const mitkIpPicDescriptor *seg, int startOfs, int &numPoints, int &sizeBuffer, float *pointBuffer ) -{ - float *newBuffer = nullptr; - mitkIpPicTypeMultiplexR4( tmGetContour8N, seg, newBuffer, startOfs, numPoints, sizeBuffer, pointBuffer ); - return newBuffer; -} diff --git a/Utilities/IpSegmentation/ipSegmentationContourUtils.cpp b/Utilities/IpSegmentation/ipSegmentationContourUtils.cpp deleted file mode 100755 index 22a5dc05630..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationContourUtils.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "ipSegmentation.h" - - -/** - * Input: one contour (start and end point identical). array of floats. [x1 y1 x2 y2 ...] - * Output: two contours (start and end point not neccessarily identical) - * cutCoords: two points that define the cut (must not [should not be] be identical) - * - * S.....O - * . . - * . . - * . . - * . ------C2 S: Start of contour (two times in the array) - * . ------- . C1: cut point 1 - * C1------ . C2: cut point 2 - * . O - * . .. - * . .. - * . .. - * . .. - * O - */ -void ipMITKSegmentationSplitContour( float *contour, int sizeContour, float *cutCoords, float *part1, int &size1, float *part2, int &size2 ) -{ - int cut1, cut2, i=0; - bool cutReached; - size1 = 0; - size2 = 0; - - do { - part1[2*size1] = contour[2*i]; - part1[2*size1+1] = contour[2*i+1]; - i++; - size1++; - cutReached = ( (cutCoords[0]==contour[2*i] && cutCoords[1]==contour[2*i+1]) || - (cutCoords[2]==contour[2*i] && cutCoords[3]==contour[2*i+1]) ); - } while (!cutReached); - cut1 = i; - part1[2*size1] = contour[2*i]; - part1[2*size1+1] = contour[2*i+1]; - size1++; - - do { - part2[2*size2] = contour[2*i]; - part2[2*size2+1] = contour[2*i+1]; - i++; - size2++; - cutReached = ( (cutCoords[0]==contour[2*i] && cutCoords[1]==contour[2*i+1]) || - (cutCoords[2]==contour[2*i] && cutCoords[3]==contour[2*i+1]) ); - } while (!cutReached); - cut2 = i; - part2[2*size2] = contour[2*i]; - part2[2*size2+1] = contour[2*i+1]; - size2++; - - do { - part1[2*size1] = contour[2*i]; - part1[2*size1+1] = contour[2*i+1]; - i++; - size1++; - } while (i -#include "ipSegmentationP.h" - -static const char* messages [] = { - "ok.", - "sorry, out of memory.", - "sorry, wrong data type of segmentation image.", - "sorry, undo is disabled.", - "sorry, PIC descriptor is null.", - "sorry, unknown error occurred." -}; - -void -ipMITKSegmentationError (int error) -{ - switch (error) { - case ipMITKSegmentationOK: - case ipMITKSegmentationOUT_OF_MEMORY: - case ipMITKSegmentationWRONG_TYPE: - case ipMITKSegmentationUNDO_DISABLED: - printf ("ipMITKSegmentation: %s\n", messages [error]); - break; - default: - printf ("ipMITKSegmentation: %s\n", messages [ipMITKSegmentationUNKNOWN_ERROR]); - break; - } - if (error > 0) { - exit (-1); - } -} - -void -ipMITKSegmentationCheckImage (mitkIpPicDescriptor* segmentation) -{ - if ((segmentation->type != ipMITKSegmentationTYPE_ID) || (segmentation->bpe != ipMITKSegmentationBPE)) { - ipMITKSegmentationError (ipMITKSegmentationWRONG_TYPE); - } - if (!segmentation->data) { - ipMITKSegmentationError (ipMITKSegmentationUNKNOWN_ERROR); - } -} diff --git a/Utilities/IpSegmentation/ipSegmentationError.h b/Utilities/IpSegmentation/ipSegmentationError.h deleted file mode 100644 index 864218516f4..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationError.h +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ -#ifndef IPSEGMENTATION_ERROR_H -#define IPSEGMENTATION_ERROR_H - -enum { - ipMITKSegmentationOK = 0 /*! No errors at all. */, - ipMITKSegmentationOUT_OF_MEMORY /*! Not enough memory available. */, - ipMITKSegmentationWRONG_TYPE /*! Segmentation image has a wrong type. */, - ipMITKSegmentationUNDO_DISABLED /*! Undo cannot be performed. */, - ipMITKSegmentationPIC_NULL /*! PIC descriptor is null. */, - ipMITKSegmentationUNKNOWN_ERROR /*! Some unknown error occurred. */ -}; - -/*! -\brief Prints an error message and exits -if an error has occurred. -@param error error code -*/ -void ipMITKSegmentationError (int error); - -/*! -\brief Checks the segmentation image. -@param segmentation the segmentation image. -*/ -void ipMITKSegmentationCheck (mitkIpPicDescriptor* segmentation); - -#endif diff --git a/Utilities/IpSegmentation/ipSegmentationFree.c b/Utilities/IpSegmentation/ipSegmentationFree.c deleted file mode 100644 index 106d8562ff3..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationFree.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include - -void ipMITKSegmentationFree (mitkIpPicDescriptor* segmentation) -{ - if (!segmentation) return; - - mitkIpPicFree (segmentation); -} - - diff --git a/Utilities/IpSegmentation/ipSegmentationGrowerHistory.cpp b/Utilities/IpSegmentation/ipSegmentationGrowerHistory.cpp deleted file mode 100755 index 577441d829f..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationGrowerHistory.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include "ipSegmentation.h" - - -mitkIpPicDescriptor* -ipMITKSegmentationCreateGrowerHistory( mitkIpPicDescriptor *seg, int startOfs, mitkIpPicDescriptor *histBuffer ) -{ - std::queue ofsQueue; - - if (!seg) return nullptr; - if (!histBuffer) { - histBuffer = mitkIpPicCopyHeader( seg, histBuffer ); - histBuffer->type = mitkIpPicUInt; - histBuffer->bpe = 16; - mitkIpUInt4_t size = _mitkIpPicSize( histBuffer ); - histBuffer->data = malloc( size ); - memset( histBuffer->data, 0, size ); // clear buffer - } - else { - // check if dimension of histBuffer is valid, if not: change it! - if (histBuffer->n[0] != seg->n[0] || histBuffer->n[1] != seg->n[1]) { - histBuffer->n[0] = seg->n[0]; - histBuffer->n[1] = seg->n[1]; - mitkIpUInt4_t size = _mitkIpPicSize( histBuffer ); - histBuffer->data = realloc( histBuffer->data, size ); - if (histBuffer->data == nullptr) return nullptr; - memset( histBuffer->data, 0, size ); // clear buffer - } - } - - // create a clear buffer to check wether a point has already been visited - // (seg cannot be modifier and histBuffer can contain any value) - mitkIpPicDescriptor *flagBuffer = mitkIpPicCopyHeader( seg, nullptr ); - mitkIpUInt4_t size = _mitkIpPicSize( flagBuffer ); - flagBuffer->data = malloc( size ); - memset( flagBuffer->data, 0, size ); - *((mitkIpUInt1_t*)flagBuffer->data+startOfs) = 1; // flag pixel as visited - - int line = seg->n[0]; - int maxOfs = (int)(line * seg->n[1]); - int testOfs; - mitkIpUInt1_t segVal, flagVal; - int iteration = 0; - int currentWave = 1; - int nextWave = 0; - - ofsQueue.push( startOfs ); - - while (!ofsQueue.empty()) { - int nextOfs = ofsQueue.front(); - ofsQueue.pop(); - currentWave--; - *((mitkIpUInt2_t*)histBuffer->data+nextOfs) = (mitkIpUInt2_t)(iteration+1); // seed point should get history = 1 - - // check right: - testOfs = nextOfs+1; - if (testOfs%line!=0) { - segVal = *((mitkIpUInt1_t*)seg->data+testOfs); - flagVal = *((mitkIpUInt1_t*)flagBuffer->data+testOfs); - if ( segVal != 0 && flagVal == 0) { - ofsQueue.push( testOfs ); - *((mitkIpUInt1_t*)flagBuffer->data+testOfs) = 1; // flag pixel as visited - nextWave++; - } - } - // check top: - testOfs = nextOfs-line; - if (testOfs > 0) { - segVal = *((mitkIpUInt1_t*)seg->data+testOfs); - flagVal = *((mitkIpUInt1_t*)flagBuffer->data+testOfs); - if ( segVal != 0 && flagVal == 0) { - ofsQueue.push( testOfs ); - *((mitkIpUInt1_t*)flagBuffer->data+testOfs) = 1; // flag pixel as visited - nextWave++; - } - } - // check left: - testOfs = nextOfs-1; - if (nextOfs%line!=0) { - segVal = *((mitkIpUInt1_t*)seg->data+testOfs); - flagVal = *((mitkIpUInt1_t*)flagBuffer->data+testOfs); - if ( segVal != 0 && flagVal == 0) { - ofsQueue.push( testOfs ); - *((mitkIpUInt1_t*)flagBuffer->data+testOfs) = 1; // flag pixel as visited - nextWave++; - } - } - // check bottom: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - segVal = *((mitkIpUInt1_t*)seg->data+testOfs); - flagVal = *((mitkIpUInt1_t*)flagBuffer->data+testOfs); - if ( segVal != 0 && flagVal == 0) { - ofsQueue.push( testOfs ); - *((mitkIpUInt1_t*)flagBuffer->data+testOfs) = 1; // flag pixel as visited - nextWave++; - } - } - // check for number of iterations: - if (currentWave == 0) { - currentWave = nextWave; - nextWave = 0; - iteration++; - } - } - - mitkIpPicFree( flagBuffer ); - return histBuffer; -} diff --git a/Utilities/IpSegmentation/ipSegmentationInterpolate.c b/Utilities/IpSegmentation/ipSegmentationInterpolate.c deleted file mode 100644 index 8962636e76f..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationInterpolate.c +++ /dev/null @@ -1,319 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include -#include -#include "ipSegmentationP.h" - -/*! -The algorithm implements the shape-based interpolation technique. -Further detailed information can be found in: - -G.T. Herman, J. Zheng, C.A. Bucholtz: "Shape-based interpolation" -IEEE Computer Graphics & Applications, pp. 69-79,May 1992 -*/ - -#define MAX 2048 - -extern float truncf (float x); -static mitkIpPicDescriptor* setup (mitkIpPicDescriptor* pic_old); -static mitkIpInt2_t distance (const mitkIpInt2_t* const old_distance, const mitkIpInt2_t* mask_dist, const mitkIpInt2_t* mask_offset, const mitkIpUInt4_t mask_elements); - -// DON'T ever touch this code again - rather rewrite it! Then use ITK or some other library! - -// Works ONLY with 2D images. -mitkIpPicDescriptor* -ipMITKSegmentationPadBy1Pixel (mitkIpPicDescriptor* pic_in) -{ - //prepare the images - mitkIpPicDescriptor* pic_out; - ipMITKSegmentationTYPE* out_pixel_pointer; - ipMITKSegmentationTYPE* in_pixel_pointer; - unsigned int x, y; - - pic_out = mitkIpPicCopyHeader(pic_in, NULL); - if (pic_out == NULL) - { - ipMITKSegmentationError (ipMITKSegmentationPIC_NULL); - } - - if ((pic_out->type != ipMITKSegmentationTYPE_ID) || (pic_out->bpe != ipMITKSegmentationBPE)) - { - ipMITKSegmentationError (ipMITKSegmentationWRONG_TYPE); - } - - // pad by 1 pixel - pic_out->n[0] += 4; - pic_out->n[1] += 4; - - // allocate image data - pic_out->data = malloc ( pic_out->n[0] * pic_out->n[1] * ((pic_out->bpe)/8) ); - // copy pixel data - out_pixel_pointer = (ipMITKSegmentationTYPE*) (pic_out->data); - in_pixel_pointer = (ipMITKSegmentationTYPE*) (pic_in->data); - - for (y = 0; y < pic_out->n[1]; ++y) - for (x = 0; x < pic_out->n[0]; ++x) - { - if ( x < 2 || y < 2 || (x > pic_out->n[0]-3) || (y > pic_out->n[1]-3) ) // set border pixels to 0 - { - *out_pixel_pointer = 0; - } - else - { - *out_pixel_pointer = *in_pixel_pointer; - ++in_pixel_pointer; - } - ++out_pixel_pointer; - } - - return pic_out; -} - -// Works ONLY with 2D images. -mitkIpPicDescriptor* -ipMITKSegmentationShrinkBy1Pixel (mitkIpPicDescriptor* pic_in ) -{ - mitkIpPicDescriptor* pic_out; - ipMITKSegmentationTYPE* out_pixel_pointer; - ipMITKSegmentationTYPE* in_pixel_pointer; - unsigned int x, y; - - //prepare the images - pic_out = mitkIpPicCopyHeader(pic_in, NULL); - if (pic_out == NULL) { - ipMITKSegmentationError (ipMITKSegmentationPIC_NULL); - } - - if ((pic_out->type != ipMITKSegmentationTYPE_ID) || (pic_out->bpe != ipMITKSegmentationBPE)) - { - ipMITKSegmentationError (ipMITKSegmentationWRONG_TYPE); - } - - // pad by 1 pixel - pic_out->n[0] -= 4; - pic_out->n[1] -= 4; - - // allocate image data - pic_out->data = malloc ( pic_out->n[0] * pic_out->n[1] * (pic_out->bpe/8) ); - - // copy pixel data - out_pixel_pointer = pic_out->data; - in_pixel_pointer = pic_in->data; - - for (y = 0; y < pic_in->n[1]; ++y) - for (x = 0; x < pic_in->n[0]; ++x) - { - if ( x < 2 || y < 2 || (x > pic_in->n[0]-3) || (y > pic_in->n[1]-3) ) // ignore border pixels - { - } - else - { - *out_pixel_pointer = *in_pixel_pointer; - ++out_pixel_pointer; - } - ++in_pixel_pointer; - } - - return pic_out; -} - -mitkIpPicDescriptor* -ipMITKSegmentationInterpolate (mitkIpPicDescriptor* pPic1, mitkIpPicDescriptor* pPic2, const mitkIpFloat4_t ratio) -{ - mitkIpPicDescriptor *pic_out, *pic[2]; /* pointer to image data */ - mitkIpUInt4_t frame [_mitkIpPicNDIM]; /* pointer for definition of frame-size */ - mitkIpInt4_t x, y; - mitkIpUInt4_t i; /* loop counters */ - mitkIpFloat4_t weight[] = {1.0f-ratio, ratio}; /* weights of the interpolants */ - mitkIpInt2_t mask_width = 1; /* mask width from center to border */ - mitkIpInt2_t mask_x[] = {0, -1, +1, 0, -1}; /* relativ position in x-axis of mask */ - mitkIpInt2_t mask_y[] = {0, 0, -1, -1, -1}; /* relativ position in y-axis of mask */ - mitkIpInt2_t mask_dist[] = {0, 10, 14, 10, 14};/* distance to central element */ - mitkIpInt2_t mask_offset [5]; /* relative start position in given image */ - mitkIpUInt4_t mask_elements = 5; /* elements in distance mask */ - mitkIpInt2_t first_x, first_y; /* first pixel for distance calculation in enlarged image version */ - mitkIpInt2_t last_x, last_y; /* last pixel for distance calculation in enlarged image version */ - mitkIpInt2_t *pixel[2]; /* pointer to the current pixels */ - ipMITKSegmentationTYPE* pixel_out; - mitkIpPicDescriptor* returnImage; - - mitkIpPicDescriptor* pic1 = ipMITKSegmentationPadBy1Pixel( pPic1 ); - mitkIpPicDescriptor* pic2 = ipMITKSegmentationPadBy1Pixel( pPic2 ); - - /* prepare the images */ - pic_out = mitkIpPicCopyHeader(pic1, NULL); - if (pic_out == NULL) { - ipMITKSegmentationError (ipMITKSegmentationPIC_NULL); - } - if ((pic_out->type != ipMITKSegmentationTYPE_ID) || (pic_out->bpe != ipMITKSegmentationBPE)) { - ipMITKSegmentationError (ipMITKSegmentationWRONG_TYPE); - } - pic_out->data = malloc (_mitkIpPicSize (pic_out)); - for (i = 0; i < pic1->dim; i++) { - frame [i] = 1; - } - pic[0] = setup (pic1); - pic[1] = setup (pic2); - - /* apply the mask in both directions */ - for (i=0; i< mask_elements; i++) { - mask_offset [i] = mask_x[i] + mask_y[i]*pic[0]->n[0]; - } - first_x = mask_width; - first_y = mask_width; - last_x = pic[0]->n[0] - mask_width-1; - last_y = pic[0]->n[1] - mask_width-1; - /* top-left to bottom-right, borders are neglected */ - for (y = first_y; y <= last_y; y++) { - pixel [0] = (mitkIpInt2_t *) pic [0]->data + (first_x + y * pic [0]->n [0]); - pixel [1] = (mitkIpInt2_t *) pic [1]->data + (first_x + y * pic [1]->n [0]); - for (x = first_x; x <= last_x; x++) { - *(pixel [0])++ = distance (pixel [0], mask_dist, mask_offset, mask_elements); - *(pixel [1])++ = distance (pixel [1], mask_dist, mask_offset, mask_elements); - } - } - /* bottom-right to top-left, borders are neglected */ - for (i=0; i< mask_elements; i++) { - mask_offset [i] = -mask_offset [i]; - } - pixel_out = (ipMITKSegmentationTYPE *) pic_out->data + _mitkIpPicElements(pic_out) - 1; - for (y = last_y; y >= first_y; y--) { - pixel [0] = (mitkIpInt2_t *) pic [0]->data + (last_x + y * pic [0]->n [0]); - pixel [1] = (mitkIpInt2_t *) pic [1]->data + (last_x + y * pic [1]->n [0]); - for (x = last_x; x >= first_x; x--) { - *(pixel [0]) = distance (pixel [0], mask_dist, mask_offset, mask_elements); - *(pixel [1]) = distance (pixel [1], mask_dist, mask_offset, mask_elements); - *pixel_out-- = (weight [0] * *(pixel [0]) + weight [1] * *(pixel[1]) > 0 ? 1 : 0); - pixel[0]--; - pixel[1]--; - } - } - mitkIpPicFree(pic [0]); - mitkIpPicFree(pic [1]); - - mitkIpPicFree(pic1); - mitkIpPicFree(pic2); - - returnImage = ipMITKSegmentationShrinkBy1Pixel( pic_out ); - - mitkIpPicFree(pic_out); - - return returnImage; -} - -static mitkIpPicDescriptor* -setup (mitkIpPicDescriptor* pic_old) -{ - mitkIpPicDescriptor* pic; - ipMITKSegmentationTYPE* src; - mitkIpInt2_t* dst; - mitkIpUInt4_t x, y; - - /* Allocate new image for distance transform */ - - pic = mitkIpPicCopyHeader (pic_old, NULL); - pic->type = mitkIpPicInt; - pic->bpe = 16; - pic->n[0] += 2; - pic->n[1] += 2; - pic->data = malloc (_mitkIpPicSize (pic)); - - /* Set the frame to -1 */ - - dst = (mitkIpInt2_t *) pic->data; - for (x = 0; x < pic->n[0]; x++) { - *dst++ = -MAX; - } - dst = (mitkIpInt2_t *) pic->data + _mitkIpPicElements (pic) - pic->n[0]; - for (x = 0; x < pic->n[0]; x++) { - *dst++ = -MAX; - } - dst = (mitkIpInt2_t *) pic->data; - for (y = 0; y < pic->n[1]; y++) { - *dst = -MAX; - dst += pic->n[0]; - } - dst = (mitkIpInt2_t *) pic->data + (pic->n[0] - 1); - for (y = 0; y < pic->n[1]; y++) { - *dst = -MAX; - dst += pic->n[0]; - } - - /* Set the image data to initial values */ - - src = (ipMITKSegmentationTYPE *) pic_old->data; - dst = (mitkIpInt2_t *) pic->data + (1 + pic->n[0]); - for (y = 0; y < pic_old->n[1]; y++) { - for (x = 0; x < pic_old->n[0]; x++) { - *dst++ = (*src++ > 0 ? MAX : -MAX); - } - dst += 2; - } - dst = (mitkIpInt2_t *) pic->data + (1 + pic->n[0]); - for (y = 0; y < pic_old->n[1]; y++) { - for (x = 0; x < pic_old->n[0]; x++) { - if ((dst[0] < dst[1]) || (dst[0] < dst[pic->n[0]])) { - *dst = -5; - } else if ((dst[0] > dst[1]) || (dst[0] > dst[pic->n[0]])) { - *dst = 5; - } - dst++; - } - dst += 2; - } - dst -= 2; - for (y = 0; y < pic_old->n[1]; y++) { - for (x = 0; x < pic_old->n[0]; x++) { - dst--; - if (abs (dst[0]) > 5) { - if ((dst[0] < dst[-1]) || (dst[0] < dst[-(int)(pic->n[0])])) { - *dst = -5; - } else if ((dst[0] > dst[-1]) || (dst[0] > dst[-(int)(pic->n[0])])) { - *dst = 5; - } - } - } - } - return pic; -} - -static mitkIpInt2_t distance (const mitkIpInt2_t* const old_distance, const mitkIpInt2_t* mask_dist, const mitkIpInt2_t* mask_offset, const mitkIpUInt4_t mask_elements) -{ - mitkIpInt2_t cur_distance, new_distance; - mitkIpUInt4_t i; - - cur_distance = old_distance [0]; - if (abs (cur_distance) != 5) { - if (cur_distance > 0) { - for (i = 0; i < mask_elements; i++) { - new_distance = *mask_dist + old_distance [*mask_offset]; - if (new_distance < cur_distance) { - cur_distance = new_distance; - } - mask_dist++; - mask_offset++; - } - } else if (cur_distance < 0) { - for (i = 0; i < mask_elements; i++) { - new_distance = old_distance [*mask_offset] - *mask_dist; - if (new_distance > cur_distance) { - cur_distance = new_distance; - } - mask_dist++; - mask_offset++; - } - } - } - return cur_distance; -} diff --git a/Utilities/IpSegmentation/ipSegmentationNew.c b/Utilities/IpSegmentation/ipSegmentationNew.c deleted file mode 100644 index 58f543fcc0a..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationNew.c +++ /dev/null @@ -1,30 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "ipSegmentationP.h" - -mitkIpPicDescriptor* -ipMITKSegmentationNew (mitkIpPicDescriptor* image) -{ - mitkIpPicDescriptor* s = NULL; - - if (image) { - s = mitkIpPicNew (); - s->type = ipMITKSegmentationTYPE_ID; - s->bpe = ipMITKSegmentationBPE; - s->dim = 2; - s->n[0] = image->n[0]; - s->n[1] = image->n[1]; - s->data = malloc (_mitkIpPicSize (s)); - } - return s; -} diff --git a/Utilities/IpSegmentation/ipSegmentationP.h b/Utilities/IpSegmentation/ipSegmentationP.h deleted file mode 100644 index fdfc7128d2a..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationP.h +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ -#ifndef IPSEGMENTATIONP_H -#define IPSEGMENTATIONP_H - -#include -#include "ipSegmentationError.h" - -#ifndef IPSEGMENTATION_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" -{ -#endif - -#define ipMITKSegmentationTYPE mitkIpUInt1_t -#define ipMITKSegmentationTYPE_ID mitkIpPicUInt -#define ipMITKSegmentationBPE 8 -#define tagSEGMENTATION_EMPTY "SEGMENTATION_EMPTY" - -enum LogicalOp { - IPSEGMENTATION_OP /*! copy of input image */, - IPSEGMENTATION_AND /*! logical and operator */, - IPSEGMENTATION_OR /*! the or operator */, - IPSEGMENTATION_XOR /*! the exclusive-or operator */ -}; - -extern void ipMITKSegmentationUndoSave (mitkIpPicDescriptor* segmentation); -extern mitkIpBool_t ipMITKSegmentationUndoIsEnabled (mitkIpPicDescriptor* segmentation); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* IPSEGMTATION_H */ - -#define AND(TYPE, PIC, VALUE, X, Y) \ -{ \ - TYPE* data = (TYPE*) (PIC)->data; \ - mitkIpUInt4_t width = (PIC)->n[0]; \ - int temp = (int) data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X]; \ - temp &= (int) VALUE; \ - data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X] = temp; \ -} \ - -#define OR(TYPE, PIC, VALUE, X, Y) \ -{ \ - TYPE* data = (TYPE*) (PIC)->data; \ - mitkIpUInt4_t width = (PIC)->n[0]; \ - int temp = (int) data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X]; \ - temp |= (int) VALUE; \ - data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X] = temp; \ -} \ - -#define XOR(TYPE, PIC, VALUE, X, Y) \ -{ \ - TYPE* data = (TYPE*) (PIC)->data; \ - mitkIpUInt4_t width = (PIC)->n[0]; \ - int temp = (int) data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X]; \ - temp ^= (int) VALUE; \ - data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X] = temp; \ -} \ - -#define OP(TYPE, PIC, VALUE, X, Y) \ -{ \ - TYPE* data = (TYPE*) (PIC)->data; \ - mitkIpUInt4_t width = (PIC)->n[0]; \ - data [width * (mitkIpUInt4_t) Y + (mitkIpUInt4_t) X] = VALUE; \ -} \ - -#define MASK(TYPE, PIC, MSK, VALUE, X, Y, CMD) \ -{ \ -if (!(MSK) || (((ipMITKSegmentationTYPE *)(MSK)->data)[(PIC)->n[0] * (mitkIpUInt4_t) (Y) + (mitkIpUInt4_t) (X)] > 0.0)) \ -CMD(TYPE, PIC, VALUE, X, Y) \ -} - -#endif diff --git a/Utilities/IpSegmentation/ipSegmentationRegionCutter.cpp b/Utilities/IpSegmentation/ipSegmentationRegionCutter.cpp deleted file mode 100755 index b9518ac97f7..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationRegionCutter.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include -#include "ipSegmentation.h" - - - -static ANNkd_tree *annTree; -static ANNpoint queryPt; -static ANNidxArray nnIdx; -static ANNdistArray dists; - - - -// find next pixel in ANN: -#define QUERY_DIST(qOfs) \ - queryPt[0] = (float)(qOfs % line) + 0.5; \ - queryPt[1] = (float)(qOfs / line) + 0.5; \ - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - - -#define PROCESS_PIXEL \ - histVal = *((mitkIpUInt2_t*)history->data+testOfs); \ - segVal = *((mitkIpUInt1_t*)seg->data+testOfs); \ - if ( segVal > 0 && histVal <= maxHist && testOfs!=oldOfs ) { \ - grad = ipMITKSegmentationGetDistGradient( testOfs, seg ); \ - QUERY_DIST(testOfs) \ - if (grad maxDist) { \ - maxDist = dists[0]; \ - candOfs = testOfs; \ - } \ - } - - -float ipMITKSegmentationGetDistGradient( int ofs, mitkIpPicDescriptor *seg ) -{ - mitkIpUInt4_t unsignedOfs = ofs < 0 ? seg->n[0]*seg->n[1] - seg->n[0] : ofs; - if (unsignedOfs < seg->n[0] || unsignedOfs >= seg->n[0]*seg->n[1] - seg->n[0]) // exclude image borders - { - return 1.0; // initialization value of minGrad (high gradient) - } - float x = (float)(ofs % seg->n[0]) + 0.5; - float y = (float)(ofs / seg->n[0]) + 0.5; - mitkIpUInt1_t segVal = 0; // initialize to stop valgrind's warning about "Conditional jump or move depends on uninitialised value(s)" - - queryPt[0] = x+1; queryPt[1] = y; - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - float d1 = sqrt( dists[0] ); // right dist - segVal = *((mitkIpUInt1_t*)seg->data+ofs+1); - if (!segVal) d1 = -10.0; - queryPt[0] = x-1; queryPt[1] = y; - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - float d2 = sqrt( dists[0] ); // left dist - segVal = *((mitkIpUInt1_t*)seg->data+ofs-1); - if (!segVal) d2 = -10.0; - queryPt[0] = x; queryPt[1] = y+1; - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - float d3 = sqrt( dists[0] ); // lower dist - segVal = *((mitkIpUInt1_t*)seg->data+ofs+seg->n[0]); - if (!segVal) d3 = -10.0; - queryPt[0] = x; queryPt[1] = y-1; - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - float d4 = sqrt( dists[0] ); // upper dist - segVal = *((mitkIpUInt1_t*)seg->data+ofs-seg->n[0]); - if (!segVal) d4 = -10.0; - float res = 0.5*(float)sqrt( (d1-d2)*(d1-d2) + (d3-d4)*(d3-d4) ); - return res; -} - - - -tCutResult ipMITKSegmentationGetCutPoints( mitkIpPicDescriptor *seg, mitkIpPicDescriptor *history, int ofs ) -{ - bool debug(false); - tCutResult res; - int resContourSize = 5000; - res.traceline = (float*)malloc( resContourSize*sizeof(float)*2 ); - res.onGradient = (bool*)malloc( resContourSize*sizeof(bool) ); - res.numPoints = 0; - res.absMin = 0; - res.cutIt = false; - res.deleteCurve = nullptr; - - if (!history) return res; // no history! - if (*((mitkIpUInt2_t*)history->data + ofs) == 0) return res; // ofs not inside known history - - // get one point on the contour: - mitkIpUInt1_t *ptr = (mitkIpUInt1_t*)seg->data + ofs; - int endLine = ((ofs / seg->n[0]) + 1) * seg->n[0] -1; - int contourOfs = ofs; - while (contourOfs!=endLine && *ptr!=0) { - ptr++; - contourOfs++; - } - if (*ptr == 0) contourOfs--; // get back on the contour! - - // extract the contour: - int sizeContour, sizeBuffer; - float *contour = ipMITKSegmentationGetContour8N( seg, contourOfs, sizeContour, sizeBuffer ); - // init ANN tree with contour points: - queryPt = annAllocPt( 2 ); - ANNpointArray dataPts = annAllocPts( sizeContour, 2 ); - nnIdx = new ANNidx[10]; - dists = new ANNdist[10]; - for (int i=0; in[0]; - - int maxOfs = line * history->n[1]; - QUERY_DIST(ofs) - float maxDist = dists[0]; - float minDist = 10000; // current minimum distance from border - float oldDist = 0; - int candOfs = ofs; - int nextOfs = -1; - int oldOfs, testOfs, gradCand=-1; - float grad, minGrad; - bool skelettonReached = false; - mitkIpUInt2_t histVal; - mitkIpUInt1_t segVal; - mitkIpUInt2_t maxHist = 10000; - if (maxHist==0 && debug) printf( "maxHist = 0!\n" ); - do { - oldOfs = nextOfs; - nextOfs = candOfs; - // store point info: - if (res.numPoints < resContourSize) { - res.traceline[2*res.numPoints] = (float)(nextOfs % line) + 0.5; - res.traceline[2*res.numPoints+1] = (float)(nextOfs / line) + 0.5; - if (nextOfs==gradCand) res.onGradient[res.numPoints] = true; - else res.onGradient[res.numPoints] = false; - - if (debug) - { - printf( "(%.f,%.f): H=%i, G=%i\n", res.traceline[2*res.numPoints], - res.traceline[2*res.numPoints+1], - *((mitkIpUInt2_t*)history->data+nextOfs), - res.onGradient[res.numPoints] ); - } - res.numPoints++; - - if (res.numPoints == resContourSize) - { - resContourSize *= 2; // explodes, but such contours must be very strange - res.traceline = (float*)realloc( res.traceline, resContourSize*sizeof(float)*2 ); - res.onGradient = (bool*)realloc( res.onGradient, resContourSize*sizeof(bool) ); - if ((res.traceline == nullptr) || (res.onGradient == nullptr)) - { - res.numPoints = 0; - res.cutIt = false; - return res; - } - } - } - - maxHist = *((mitkIpUInt2_t*)history->data + nextOfs); // don't exceed this history! - maxDist = 0; // clear maxDist - minGrad = 1.0; // clear minGrad - - int traceSinceMin = res.numPoints - 1 - res.absMin; - float weight = 20.0 / (20.0+traceSinceMin); - if (weight < 0.5) weight = 0.5; - QUERY_DIST(nextOfs) - if (!skelettonReached && dists[0] < oldDist) { - skelettonReached = true; - if (debug) printf( "skeletton reached at %i, oldDist=%.1f, currentDist=%.1f\n", - res.numPoints - 1, oldDist, dists[0] ); - } - oldDist = dists[0]; - if (skelettonReached && weight*dists[0] < minDist) { - minDist = dists[0]; - res.absMin = res.numPoints - 1; // has already been increased - } - - // check right: - testOfs = nextOfs+1; - if (testOfs%line!=0) { - // check top right: - PROCESS_PIXEL - testOfs = nextOfs-line; - if (testOfs > 0) { - testOfs++; - PROCESS_PIXEL - } - // check bottom right: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - testOfs++; - PROCESS_PIXEL - } - } - // check top: - testOfs = nextOfs-line; - if (testOfs > 0) { - PROCESS_PIXEL - } - // check left: - testOfs = nextOfs-1; - if (nextOfs%line!=0) { - PROCESS_PIXEL - // check top left: - testOfs = nextOfs-line; - if (testOfs > 0) { - testOfs--; - PROCESS_PIXEL - } - // check bottom left: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - testOfs--; - PROCESS_PIXEL - } - } - // check bottom: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - PROCESS_PIXEL - } - // check for run on gradient: - if (minGrad < 0.5) { - candOfs = gradCand; - if (debug) printf( "." ); - } - else if (debug) printf( "x" ); - } while (candOfs != nextOfs && maxHist > 0); - - if (res.absMin < (res.numPoints-10)) { - res.absMin += (int)(sqrt(minDist)/2.0); -// int cutX = (int)(res.traceline[2*res.absMin]-0.5); -// int cutY = (int)(res.traceline[2*res.absMin+1]-0.5); -// int cutOfs = cutX + line*cutY; -// histVal = *((mitkIpUInt2_t*)history->data+cutOfs); -// printf( "histVal at Cut=%i\n", histVal ); -// if (histVal > 1) { - res.cutIt = true; - float cutXf = (float)res.traceline[2*res.absMin]; - float cutYf = (float)res.traceline[2*res.absMin+1]; - queryPt[0] = cutXf; - queryPt[1] = cutYf; - annTree->annkSearch( queryPt, 1, nnIdx, dists ); - int cutIdx1 = nnIdx[0]; - res.cutCoords[0] = contour[2*cutIdx1]; - res.cutCoords[1] = contour[2*cutIdx1+1]; - int cutIdx2 = cutIdx1; - float minDist = 100000000; - int testCnt = 0; - for (int i=0; i (sizeContour/2)) idxDif = sizeContour - idxDif; - if ( idxDif > 50 ) { - float dist = (cutXf-contour[2*i])*(cutXf-contour[2*i]) + (cutYf-contour[2*i+1])*(cutYf-contour[2*i+1]); - if (dist < minDist) { - minDist = dist; - cutIdx2 = i; - } - } - else testCnt++; - } - res.cutCoords[2] = contour[2*cutIdx2]; - res.cutCoords[3] = contour[2*cutIdx2+1]; - if (debug) printf( "idx1=%i, idx2=%i, %i pts not evaluated.\n", cutIdx1, cutIdx2, testCnt ); - - if ((res.cutCoords[0] == res.cutCoords[2]) && - (res.cutCoords[1] == res.cutCoords[3])) - { - free( contour ); - // free ANN stuff: - annDeallocPt( queryPt ); - annDeallocPts( dataPts ); - delete[] nnIdx; - delete[] dists; - delete annTree; - - res.cutIt = false; - - return res; - } - float *curve1 = (float*)malloc( 2*sizeof(float)*sizeContour ); - float *curve2 = (float*)malloc( 2*sizeof(float)*sizeContour ); - int sizeCurve1, sizeCurve2; - ipMITKSegmentationSplitContour( contour, sizeContour, res.cutCoords, curve1, sizeCurve1, curve2, sizeCurve2 ); - float clickX = (float)(ofs % line) + 0.5; - float clickY = (float)(ofs / line) + 0.5; - if (ipMITKSegmentationIsInsideContour( curve1, sizeCurve1, clickX, clickY )) { - res.deleteCurve = curve1; - res.deleteSize = sizeCurve1; - free( curve2 ); - } - else { - res.deleteCurve = curve2; - res.deleteSize = sizeCurve2; - free( curve1 ); - } - } - - - free( contour ); - // free ANN stuff: - annDeallocPt( queryPt ); - annDeallocPts( dataPts ); - delete[] nnIdx; - delete[] dists; - delete annTree; - - return res; -} diff --git a/Utilities/IpSegmentation/ipSegmentationRegionGrower.cpp b/Utilities/IpSegmentation/ipSegmentationRegionGrower.cpp deleted file mode 100755 index f4779482f5b..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationRegionGrower.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include -#include -#include "ipSegmentation.h" - -/* -Starts a 4 neighbourhood region growing at startOfs (y*picWidth+x) of the 2D image src. -If relativeBounds is true, the region grows in [base-lowerBound, base+upperBound], in which base is the average -color of the 9 pixels around startOfs. If relativeBounds is false, the region grows in [lowerBound, upperBound]. -If maxIterations is > 0, the growing process is stopped after maxIterations. -If segBuffer is 0, new memory for the segmented image is allocated and returned, else the segBuffer is used -to store the result (has to be an 8-bit datatype, e.g. mitkIpUInt1_t). -histBuffer must be 0 or a pointer to a 16-bit mitkIpUInt1_t image of the same size as src. In case of the latter, -history data is written to that buffer: the seed pixel gets a 1, all direct neighbours 2 etc. The buffer is -not cleared in this function and can thus hold history data of several growing processes in different areas. -*/ -template -mitkIpPicDescriptor* -tmGrowRegion4N( mitkIpPicDescriptor *src, int startOfs, bool relativeBounds, float lowerBoundFlt, float upperBoundFlt, int maxIterations, mitkIpPicDescriptor *segBuffer, int &contourOfs, float &startCol, mitkIpPicDescriptor *histBuffer ) -{ - PicType lowerBound = static_cast(lowerBoundFlt); - PicType upperBound = static_cast(upperBoundFlt); - std::queue ofsQueue; - - if (maxIterations <= 0) maxIterations = 32000; - if (!src) return nullptr; - if (!segBuffer) { - segBuffer = mitkIpPicCopyHeader( src, segBuffer ); - segBuffer->type = mitkIpPicUInt; - segBuffer->bpe = 8; - mitkIpUInt4_t size = _mitkIpPicSize( segBuffer ); - segBuffer->data = malloc( size ); - } - else { - // check if dimension of segBuffer is valid, if not: change it! - if (segBuffer->n[0] != src->n[0] || segBuffer->n[1] != src->n[1]) { - segBuffer->n[0] = src->n[0]; - segBuffer->n[1] = src->n[1]; - mitkIpUInt4_t size = _mitkIpPicSize( segBuffer ); - segBuffer->data = realloc( segBuffer->data, size ); - if (segBuffer->data == nullptr) return nullptr; - } - } - if (histBuffer) { - // check if dimension of histBuffer is valid, if not: change it! - if (histBuffer->n[0] != src->n[0] || histBuffer->n[1] != src->n[1]) { - histBuffer->n[0] = src->n[0]; - histBuffer->n[1] = src->n[1]; - mitkIpUInt4_t size = _mitkIpPicSize( histBuffer ); - histBuffer->data = realloc( histBuffer->data, size ); - if (histBuffer->data == nullptr) return nullptr; - memset( histBuffer->data, 0, size ); // clear buffer - } - } - - int line = segBuffer->n[0]; - int maxOfs = (int)(line * segBuffer->n[1]); - //PicType *start = ((PicType*)src->data) + startOfs; - // init borders: - PicType lowest, highest; - if (relativeBounds) { - - // average base color from 3x3 block: - // check for edges of image - int offset; - int numberOfValidOffsets = 0; - int baseCol = 0; - offset = startOfs; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs+1; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs+1-line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs-line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs-1-line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs-1; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs-1+line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs+line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - offset = startOfs+1+line; if ( (offset >= 0) && (offset < (int)(src->n[0] * src->n[1])) ) { baseCol += *((PicType*)(src->data)+offset); ++numberOfValidOffsets; } - - if ( numberOfValidOffsets > 0 ) - baseCol = (PicType)( (float)baseCol / (float)numberOfValidOffsets ); - - lowest = baseCol - lowerBound; - highest = baseCol + upperBound; - startCol = (float)baseCol; - } - else { - lowest = lowerBound; - highest = upperBound; - startCol = 0.0f; - } - - memset( segBuffer->data, 0, _mitkIpPicSize(segBuffer) ); // clear buffer - - PicType value = *((PicType*)src->data+startOfs); - if ( value >=lowest && value <=highest ) { - ofsQueue.push( startOfs ); - } - - contourOfs = -1; - int testOfs; - mitkIpUInt1_t segVal; - int iteration = 0; - int currentWave = 1; - int nextWave = 0; - - while (!ofsQueue.empty() && iteration<=maxIterations) { - int nextOfs = ofsQueue.front(); - ofsQueue.pop(); - currentWave--; - *((mitkIpUInt1_t*)segBuffer->data+nextOfs) = 1; - if (histBuffer) { - *((mitkIpUInt2_t*)histBuffer->data+nextOfs) = (mitkIpUInt2_t)(iteration+1); // seed point should get history = 1 - } - if (nextOfs > contourOfs) contourOfs = nextOfs; - // check right: - testOfs = nextOfs+1; - if (testOfs%line!=0) { - segVal = *((mitkIpUInt1_t*)segBuffer->data+testOfs); - if ( segVal == 0 ) { - value = *((PicType*)src->data+testOfs); - if ( value >=lowest && value <=highest ) { - ofsQueue.push( testOfs ); - nextWave++; - *((mitkIpUInt1_t*)segBuffer->data+testOfs) = 2; - } - } - } - // check top: - testOfs = nextOfs-line; - if (testOfs > 0) { - segVal = *((mitkIpUInt1_t*)segBuffer->data+testOfs); - if ( segVal == 0 ) { - value = *((PicType*)src->data+testOfs); - if ( value >=lowest && value <=highest ) { - ofsQueue.push( testOfs ); - nextWave++; - *((mitkIpUInt1_t*)segBuffer->data+testOfs) = 2; - } - } - } - // check left: - testOfs = nextOfs-1; - if (nextOfs%line!=0) { - segVal = *((mitkIpUInt1_t*)segBuffer->data+testOfs); - if ( segVal == 0 ) { - value = *((PicType*)src->data+testOfs); - if ( value >=lowest && value <=highest ) { - ofsQueue.push( testOfs ); - nextWave++; - *((mitkIpUInt1_t*)segBuffer->data+testOfs) = 2; - } - } - } - // check bottom: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - segVal = *((mitkIpUInt1_t*)segBuffer->data+testOfs); - if ( segVal == 0 ) { - value = *((PicType*)src->data+testOfs); - if ( value >=lowest && value <=highest ) { - ofsQueue.push( testOfs ); - nextWave++; - *((mitkIpUInt1_t*)segBuffer->data+testOfs) = 2; - } - } - } - // check for number of iterations: - if (currentWave == 0) { - currentWave = nextWave; - nextWave = 0; - iteration++; - } - } - - return segBuffer; -} - - -mitkIpPicDescriptor* -ipMITKSegmentationGrowRegion4N( mitkIpPicDescriptor *src, int startOfs, bool relativeBounds, float lowerBound, float upperBound, int maxIterations, mitkIpPicDescriptor *segBuffer, mitkIpPicDescriptor *histBuffer ) -{ - mitkIpPicDescriptor *result = nullptr; - int contourOfs; - float startCol; - - if (ipMITKSegmentationUndoIsEnabled (segBuffer)) { - ipMITKSegmentationUndoSave (segBuffer); - } - - mitkIpPicTypeMultiplexR9( tmGrowRegion4N, src, result, startOfs, relativeBounds, lowerBound, upperBound, maxIterations, segBuffer, contourOfs, startCol, histBuffer ); - return result; -} - - - -mitkIpPicDescriptor* -ipMITKSegmentationGrowRegion4N( mitkIpPicDescriptor *src, int startOfs, bool relativeBounds, float lowerBound, float upperBound, int maxIterations, mitkIpPicDescriptor *segBuffer, int &contourOfs, float &startCol, mitkIpPicDescriptor *histBuffer ) -{ - mitkIpPicDescriptor *result = nullptr; - - if (ipMITKSegmentationUndoIsEnabled (segBuffer)) { - ipMITKSegmentationUndoSave (segBuffer); - } - - mitkIpPicTypeMultiplexR9( tmGrowRegion4N, src, result, startOfs, relativeBounds, lowerBound, upperBound, maxIterations, segBuffer, contourOfs, startCol, histBuffer ); - return result; -} diff --git a/Utilities/IpSegmentation/ipSegmentationReplaceRegion.cpp b/Utilities/IpSegmentation/ipSegmentationReplaceRegion.cpp deleted file mode 100755 index e697b93e6d6..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationReplaceRegion.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include "ipSegmentation.h" - -int -ipMITKSegmentationReplaceRegion4N( mitkIpPicDescriptor *seg, int startOfs, mitkIpInt1_t newValue ) -{ - mitkIpPicTSV_t* tag; - - std::queue ofsQueue; - - if (ipMITKSegmentationUndoIsEnabled (seg)) { - ipMITKSegmentationUndoSave (seg); - } - tag = mitkIpPicDelTag (seg, tagSEGMENTATION_EMPTY); - if (tag) { - mitkIpPicFreeTag (tag); - } - - if (seg->bpe != 8) return 0; - - int line = seg->n[0]; - int maxOfs = (int)(line * seg->n[1]); - int testOfs; - mitkIpInt1_t replaceMe = *((mitkIpInt1_t*)seg->data + startOfs); - if (replaceMe == newValue) return 0; - - mitkIpInt1_t segVal; - ofsQueue.push( startOfs ); - *((mitkIpInt1_t*)seg->data+startOfs) = newValue; - int regionSize = 0; - - while (!ofsQueue.empty()) { - int nextOfs = ofsQueue.front(); - ofsQueue.pop(); - regionSize++; - // check right: - testOfs = nextOfs+1; - if (testOfs%line!=0) { - segVal = *((mitkIpInt1_t*)seg->data+testOfs); - if ( segVal == replaceMe ) { - ofsQueue.push( testOfs ); - *((mitkIpInt1_t*)seg->data+testOfs) = newValue; - } - } - // check top: - testOfs = nextOfs-line; - if (testOfs >= 0) { - segVal = *((mitkIpInt1_t*)seg->data+testOfs); - if ( segVal == replaceMe ) { - ofsQueue.push( testOfs ); - *((mitkIpInt1_t*)seg->data+testOfs) = newValue; - } - } - // check left: - testOfs = nextOfs-1; - if (nextOfs%line!=0) { - segVal = *((mitkIpInt1_t*)seg->data+testOfs); - if ( segVal == replaceMe ) { - ofsQueue.push( testOfs ); - *((mitkIpInt1_t*)seg->data+testOfs) = newValue; - } - } - // check bottom: - testOfs = nextOfs+line; - if (testOfs < maxOfs) { - segVal = *((mitkIpInt1_t*)seg->data+testOfs); - if ( segVal == replaceMe ) { - ofsQueue.push( testOfs ); - *((mitkIpInt1_t*)seg->data+testOfs) = newValue; - } - } - } - return regionSize; -} diff --git a/Utilities/IpSegmentation/ipSegmentationUndo.c b/Utilities/IpSegmentation/ipSegmentationUndo.c deleted file mode 100644 index 0f7e1a75ecb..00000000000 --- a/Utilities/IpSegmentation/ipSegmentationUndo.c +++ /dev/null @@ -1,240 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include -#include -#include "ipSegmentationP.h" - -static char* tagUNDO = "SEGMENTATION_UNDO"; -static char* tagUNDO_DATA = "DATA"; -static char* tagUNDO_LEVEL = "LEVEL"; - -// Implemented in mitkIpPicDelT.c -static mitkIpPicTSV_t *_mitkIpPicRemoveTag( _mitkIpPicTagsElement_t **head, - _mitkIpPicTagsElement_t *which, - char *tag ); - -void -ipMITKSegmentationUndoEnable (mitkIpPicDescriptor* segmentation, const mitkIpUInt1_t level) -{ - mitkIpPicTSV_t *undo, *data, *max; - - assert (segmentation); - undo = mitkIpPicQueryTag (segmentation, tagUNDO); - if (!undo) { - undo = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - if (!undo) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - strcpy (undo->tag, tagUNDO); - undo->type = mitkIpPicTSV; - undo->bpe = 32; - undo->dim = 1; - undo->n[0] = 0; - undo->value = NULL; - mitkIpPicAddTag (segmentation, undo); - } - - data = mitkIpPicQuerySubTag (undo, tagUNDO_DATA); - if (!data) { - data = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - if (!data) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - strcpy (data->tag, tagUNDO_DATA); - data->type = mitkIpPicTSV; - data->bpe = 32; - data->dim = 1; - data->n[0] = 0; - data->value = NULL; - mitkIpPicAddSubTag (undo, data); - } - if (data->n[0] > level) { - /* remove levels which exceed the maximum */ - mitkIpUInt1_t i; - - for (i = data->n[0] - level; i > 0; i--) { - _mitkIpPicTagsElement_t *head = (_mitkIpPicTagsElement_t *) data->value; - mitkIpPicTSV_t* tag = _mitkIpPicRemoveTag (&head, head, head->tsv->tag); - data->value = head; - data->n[0]--; - mitkIpPicFreeTag (tag); - } - } - - max = mitkIpPicQuerySubTag (undo, tagUNDO_LEVEL); - if (max) { - /* change the maximum of levels */ - mitkIpUInt1_t* value = (mitkIpUInt1_t *) max->value; - *value = level; - } else { - mitkIpUInt1_t* value = (mitkIpUInt1_t *) malloc (sizeof (mitkIpUInt1_t)); - if (!value) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - *value = level; - - max = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - if (!max) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - strcpy (max->tag, tagUNDO_LEVEL); - max->type = mitkIpPicUInt; - max->bpe = 8; - max->dim = 1; - max->n[0] = 1; - max->value = value; - mitkIpPicAddSubTag (undo, max); - } -} - -void -ipMITKSegmentationUndoDisable (mitkIpPicDescriptor* segmentation) -{ - mitkIpPicTSV_t *undo; - - assert (segmentation); - undo = mitkIpPicDelTag (segmentation, tagUNDO); - mitkIpPicFreeTag (undo); -} - -mitkIpBool_t -ipMITKSegmentationUndoIsEnabled (mitkIpPicDescriptor* segmentation) -{ - mitkIpPicTSV_t *undo = NULL; - - if (segmentation) { - undo = mitkIpPicQueryTag (segmentation, tagUNDO); - } - return (undo ? mitkIpTrue : mitkIpFalse); -} - -void -ipMITKSegmentationUndoSave (mitkIpPicDescriptor* segmentation) -{ - mitkIpPicTSV_t *undo, *data, *level, *tag; - - assert (segmentation); - undo = mitkIpPicQueryTag (segmentation, tagUNDO); - if (!undo) { - ipMITKSegmentationError (ipMITKSegmentationUNDO_DISABLED); - } - - /* if no level is available ... */ - data = mitkIpPicQuerySubTag (undo, tagUNDO_DATA); - level = mitkIpPicQuerySubTag (undo, tagUNDO_LEVEL); - if (*((mitkIpUInt1_t *) level->value) > 0) { - if (data->n[0] == *((mitkIpUInt1_t *) level->value)) { - /* ... remove the first one. */ - _mitkIpPicTagsElement_t* head = (_mitkIpPicTagsElement_t *) data->value; - mitkIpPicTSV_t* tag = _mitkIpPicRemoveTag (&head, head, head->tsv->tag); - data->value = head; - data->n[0]--; - mitkIpPicFreeTag (tag); - } - /* build and store the level */ - tag = (mitkIpPicTSV_t *) malloc (sizeof (mitkIpPicTSV_t)); - if (!tag) { - ipMITKSegmentationError (ipMITKSegmentationOUT_OF_MEMORY); - } - strcpy (tag->tag, "IMAGE"); - tag->type = segmentation->type; - tag->bpe = segmentation->bpe; - tag->dim = segmentation->dim; - tag->n[0] = segmentation->n[0]; - tag->n[1] = segmentation->n[1]; - tag->value = malloc (_mitkIpPicSize (segmentation)); - memmove (tag->value, segmentation->data, _mitkIpPicSize (segmentation)); - mitkIpPicAddSubTag (data, tag); - } -} - -void -ipMITKSegmentationUndo (mitkIpPicDescriptor* segmentation) -{ - mitkIpPicTSV_t *undo, *data; - - assert (segmentation); - undo = mitkIpPicQueryTag (segmentation, tagUNDO); - if (!undo) { - ipMITKSegmentationError (ipMITKSegmentationUNDO_DISABLED); - } - - /* if any level is stored ... */ - data = mitkIpPicQuerySubTag (undo, tagUNDO_DATA); - if (data->n[0]) { - /* ... replace the image data and remove this level */ - _mitkIpPicTagsElement_t* head = (_mitkIpPicTagsElement_t *) data->value; - _mitkIpPicTagsElement_t* current = head; - mitkIpPicTSV_t* tag; - - while( current->next != NULL ) { - current = current->next; - } - tag = _mitkIpPicRemoveTag (&head, current, current->tsv->tag); - data->value = head; - data->n[0]--; - memmove (segmentation->data, tag->value, _mitkIpPicSize (segmentation)); - mitkIpPicFreeTag (tag); - - tag = mitkIpPicDelTag (segmentation, tagSEGMENTATION_EMPTY); - if (tag) { - mitkIpPicFreeTag (tag); - } - } -} - -mitkIpBool_t -ipMITKSegmentationUndoAvailable (mitkIpPicDescriptor* segmentation) -{ - mitkIpPicTSV_t *undo, *data; - - assert (segmentation); - undo = mitkIpPicQueryTag (segmentation, tagUNDO); - if (!undo) { - ipMITKSegmentationError (ipMITKSegmentationUNDO_DISABLED); - } - data = mitkIpPicQuerySubTag (undo, tagUNDO_DATA); - return (data->n[0] ? mitkIpTrue : mitkIpFalse); -} - -mitkIpPicTSV_t * -_mitkIpPicRemoveTag( _mitkIpPicTagsElement_t **head, _mitkIpPicTagsElement_t *which, char *tag) -{ - mitkIpPicTSV_t *tsv = NULL; - - if( which != NULL ) - { - tsv = which->tsv; - - if( which->prev == NULL ) /* which is the current head */ - { - *head = which->next; - - if( *head ) - (*head)->prev = NULL; - } - else if( which->next == NULL ) /* which is the current tail */ - { - which->prev->next = NULL; - } - else /* which is somewhere if the list */ - { - which->prev->next = which->next; - which->next->prev = which->prev; - } - - free( which ); - } - - return( tsv ); -}