[ITK] itk extract filter not working properly

weiehome at sina.com weiehome at sina.com
Tue May 24 02:46:08 EDT 2016


Hi itk experts,

I need to reduce the size of a 3d ct volume from original [512,512,64] to [256,256,12].
i was trying to apply a simple ExtractimageFilter with Index [128,128,0] and size [128,128,12],and it keeps showing me the exception " Extraction Region not consistent with Output image"?

I checked my input 3d image volume is corret , but what is the problem with the exception?

Thank you !



weiehome at sina.com
 
From: community-request
Date: 2016-05-24 10:09
To: community
Subject: Community Digest, Vol 32, Issue 52
 
Send Community mailing list submissions to
community at itk.org
 
To subscribe or unsubscribe via the World Wide Web, visit
http://public.kitware.com/mailman/listinfo/community
or, via email, send a message with subject or body 'help' to
community-request at itk.org
 
You can reach the person managing the list at
community-owner at itk.org
 
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Community digest..."
 
 
Today's Topics:
 
   1. Re: [ITK-dev] installed ITK cannot be moved due to absolute
      path (Matt McCormick)
   2. Re: [ITK-users] cannot save transform to file: Can't Create
      IO object (Sebastian Ordas)
   3. Re: [ITK-users] reading 3D temporal MRA dicom: miss ordered
      (ebasafa)
   4. [ITK-users] suppressing print statements when using Python
      wrappers (Harnish, Roy)
 
 
----------------------------------------------------------------------
 
Message: 1
Date: Mon, 23 May 2016 19:21:39 -0400
From: Matt McCormick <matt.mccormick at kitware.com>
To: Rashad Kanavath <mohammedrashadkm at gmail.com>
Cc: ITK <insight-developers at itk.org>
Subject: Re: [ITK] [ITK-dev] installed ITK cannot be moved due to
absolute path
Message-ID:
<CALzTN-Q-Q9Ho4fmG99B4RUSwrpYCiihA3fiD_7WpKe5Kt24gtg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
 
Hi Rashad,
 
It looks like MXE is configured to use system versions of EXPAT, HDF5,
JPEG, PNG, TIFF, and ZLIB:
 
  https://github.com/mxe/mxe/blob/4135f9b1227ba56b92ceb8a982016370ad5c8894/src/itk.mk#L28-L33
 
USE_SYSTEM could be disabled for these libraries.
 
Or, it may be possible for the module system to learn relative
locations of these libraries with ITK_USE_SYSTEM*. But, it would work
best if these projects were configured with CMake, create a
<project>Config.cmake or <project>-config.cmake file, and use relative
paths internally.
 
HTH,
Matt
 
On Tue, May 10, 2016 at 5:25 PM, Rashad Kanavath
<mohammedrashadkm at gmail.com> wrote:
>
>
> On Tue, May 10, 2016 at 10:50 PM, D?enan Zuki? <dzenanz at gmail.com> wrote:
>>
>> Hi Rashad,
>>
>> a few months ago relative paths were completely removed from CMake,
>> because they were never fully implemented. Have you followed recommendations
>> from here for cross-compiling?
>
>
> Yes. indeed. I had updated the mxe/src/itk.mk for several versions of ITK!
>
> Regarding relative path in cmake, I don't understand.  I didn't use cmake
> specific REL_PATH.
>>
>>
>> As for integrating your changes into ITK, you should submit a patch
>> following the instructions here. If your changes don't break anything, they
>> are likely to be integrated.
>
>
> issue here is a bit different. For all libitk* stuff the story ends well.
> For thirdparties, zlib, expat etc.. it is good idea to put the full path
> because we don't know if they are in same install directory as ITK or not.
> But this make the installed cmake modules non-portable even to a different
> location on the same disk.
>
> Now if anyone want to provide a distributable setup of ITK. patch the
> generated cmake files with sed and then copy it. This is what I am doing
> right now!
> A simple not perfect solution is to have all thirdparties make
> <LIBRARY>_PREFIX variable inside the ITKConfig.cmake
>
> and for each library we use <LIBRARY>_PREFIX/include and
> <LIBRARY>_PREFIX/lib
>
>
> Another option is to avoid full path directly inside cmake module files and
> put find_package() calls in the install tree.
>
> As these files are autogenerated by cmake, don't know what is possible.
>
>
>
>
>
>>
>> Regards,
>> D?enan
>>
>> On Mon, May 9, 2016 at 4:27 PM, Rashad Kanavath
>> <mohammedrashadkm at gmail.com> wrote:
>>>
>>> Hello all,
>>>
>>> I have some issue when copying ITK install directory to a different
>>> system. I agree this is not usual and may not appear on a linux distro or
>>> windows.
>>>
>>> My requirement is bit different. I cross-compile ITK and then use the
>>> binaries on Windows. Using dll and headers are fine. But the installed cmake
>>> files are a problem. They have absolute path in ITK-4.8/Modules/*.cmake
>>> files. It is not in all .cmake files even though I put a wildcard there..
>>>
>>> For a easy and quick workaround. I rely on mighty sed command to insert
>>> something into installed cmake file.
>>>
>>> For example see this;
>>> lib/cmake/ITK-4.8/ITKTargets-release.cmake
>>>
>>> set(CMAKE_IMPORT_FILE_VERSION 1)
>>> set(LIB_INSTALL_PREFIX)
>>> get_filename_component(CURRENT_FILE_DIR "${CMAKE_CURRENT_LIST_FILE}"
>>> PATH)
>>> get_filename_component(LIB_INSTALL_PREFIX "${CURRENT_FILE_DIR}" PATH)
>>> get_filename_component(LIB_INSTALL_PREFIX "${LIB_INSTALL_PREFIX}" PATH)
>>> get_filename_component(LIB_INSTALL_PREFIX "${LIB_INSTALL_PREFIX}" PATH)
>>>
>>> and at last:
>>>
>>> $(SED) -i 's,$(PREFIX)/$(TARGET),\${LIB_INSTALL_PREFIX},g'
>>> 'lib/cmake/ITK-$(ITK_VER)/ITKTargets-release.cmake'
>>>
>>> I would like to have this patch inside the other .cmake files in the
>>> installation and avoid the sed commands during post-installation
>>>
>>> Here is the list of cmake files that needs this change.
>>> lib/cmake/ITK-4.8/ITKTargets-release.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKZLIB.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKExpat.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKHDF5.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKJPEG.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKTIFF.cmake
>>> lib/cmake/ITK-4.8/Modules/ITKPNG.cmake
>>>
>>> So is it possible to make the change into future version of ITK?
>>>
>>> The major issue here is those cmake files are generated by cmake. Is
>>> there a way cmake could use relative path ?
>>>
>>>
>>> --
>>> Regards,
>>>    Rashad
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/insight-developers
>>>
>>
>
>
>
> --
> Regards,
>    Rashad
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-developers
>
_______________________________________________
Powered by www.kitware.com
 
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
 
Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php
 
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
 
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers
 
------------------------------
 
Message: 2
Date: Mon, 23 May 2016 21:42:38 -0300
From: Sebastian Ordas <sebastian.ordas at gmail.com>
To: "insight-users at itk.org" <insight-users at itk.org>
Subject: Re: [ITK] [ITK-users] cannot save transform to file: Can't
Create IO object
Message-ID: <c12b67b3-73db-9b37-a746-76f75b66abbe at gmail.com>
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
 
Thanks Matt,
 
The retrieved transformIO is null
 
I looked into my ITK 4.9 build and I am trying something like this:
 
itk::TransformFileWriterTemplate<double>::Pointer writer =
     itk::TransformFileWriterTemplate<double>::New();
 
// are .tfm and .txt the right file extensions?
 
itk::TransformIOFactoryTemplate<double>::TransformIOBasePointer 
tranformIO = itk::TransformIOFactoryTemplate<double>::CreateTransformIO( 
"fiducials_transform.tfm", 
itk::TransformIOFactoryFileModeType::WriteMode );
 
   if (tranformIO.IsNull())
   {
     MITK_ERROR << "transform IO is null";
     return;
   }
 
writer->SetTransformIO(tranformIO);
 
writer->SetFileName("fiducials_transform.tfm");
 
writer->SetInput(transform);
 
try
   {
     writer->Update();
   }
   catch (itk::ExceptionObject& e)
   {
     MITK_ERROR << "Caught exception: " << e.GetDescription();
     QMessageBox::information( this, "Save transform", "Could not save 
transform. See error log for details." );
   }
 
thank you
sebastian
 
 
On 23/05/2016 05:35 p.m., Matt McCormick wrote:
> Hello Sebastian,
>
> By running against ITK with this patch checked out:
>
>    http://review.source.kitware.com/#/c/21115/
>
> the error message will state what transform IO classes are registered.
>
> HTH,
> Matt
>
> On Mon, May 23, 2016 at 4:29 PM, Sebastian Ordas
> <sebastian.ordas at gmail.com> wrote:
>> Hello, I am trying to run the code bellow from my application (using ITK
>> 4.9)  but I get the following error :
>>
>> ERROR: Caught exception: itk::ERROR:
>> TransformFileWriterTemplate(000000000CD770E0): Can't Create IO object
>> for file test.tfm
>>
>> I am sure that if I test it from a simple test application this should work,
>> but I am trying to understand what I am missing from within my project
>> (maybe some factory not yet registered or even some registration-related
>> module not yet enabled in cmake?)
>>
>> typedef itk::VersorRigid3DTransform< double > TransformType;
>> TransformType::Pointer trf = TransformType::New();
>> trf->SetIdentity();
>>
>> itk::TransformFileWriterTemplate<double>::Pointer writer =
>>      itk::TransformFileWriterTemplate<double>::New();
>>
>>    writer->SetFileName("test.tfm");
>>    writer->SetInput(trf);
>>
>>    try
>>    {
>>      writer->Update();
>>    }
>>    catch (itk::ExceptionObject& e)
>>    {
>>      std::cerr << "Caught exception: " << e.GetDescription() << std::endl;
>>    }
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/insight-users
>>
 
_____________________________________
Powered by www.kitware.com
 
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
 
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
 
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
 
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
 
 
------------------------------
 
Message: 3
Date: Mon, 23 May 2016 17:54:40 -0700 (MST)
From: ebasafa <basafa at clearguidemedical.com>
To: insight-users at itk.org
Subject: Re: [ITK] [ITK-users] reading 3D temporal MRA dicom: miss
ordered
Message-ID: <1464051280226-7588892.post at n2.nabble.com>
Content-Type: text/plain; charset="us-ascii"
 
Does this mean that all slices have the same location information and you
want them to be ordered based on the time stamp? If so, I am afraid GDCM
might not be able to sort them properly. If all slices have the same
location (Image Position Patient) and orientation (Image Orientation
Patient), the sorting might fail. Take a look at how GDCM sorts DICOM slices
(https://itk.org/Doxygen/html/classitk_1_1GDCMSeriesFileNames.html):
 
"This class generates a sequence of files whose filenames point to a DICOM
file. The ordering is based on the following strategy: Read all images in
the directory (assuming there is only one study/series)
 
1) Extract Image Orientation & Image Position from DICOM images, and then
calculate the ordering based on the 3D coordinate of the slice.
2) If for some reason this information is not found or failed, another
strategy is used: the ordering is based on 'Image Number'.
3) If this strategy also failed, then the filenames are ordered by
lexicographical order."
 
HTH
Ehsan
 
 
 
 
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/ITK-users-reading-3D-temporal-MRA-dicom-miss-ordered-tp7588890p7588892.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
 
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
 
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
 
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
 
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
 
 
------------------------------
 
Message: 4
Date: Tue, 24 May 2016 01:56:31 +0000
From: "Harnish, Roy" <Roy.Harnish at ucsf.edu>
To: "insight-users at itk.org" <insight-users at itk.org>
Subject: [ITK] [ITK-users] suppressing print statements when using
Python wrappers
Message-ID:
<F968C6DCE9D2F04CB8519CB3ACF06E99DEE6221F at ex04.net.ucsf.edu>
Content-Type: text/plain; charset="iso-8859-1"
 
Hi,
 
I'm wondering if anyone else is getting lots output to the console when using the Python wrappers? If I try to run the SNIPPET below with an itkImage:
 
<itkImagePython.itkImageSS3; proxy of <Swig Object of type 'itkImageSS3 *' at 0x7f1ec3bc5060> >
 
I get many lines of print statements. Would like to know how to suppress.
 
Thanks for any info.
 
Roy
 
 
SNIPPET:
 
def itkImage_orient_to_axial(itkImage, itkImageType):
    orienterType = itk.OrientImageFilter[ itkImageType, itkImageType ]
    orienter     = orienterType.New()
    orienter.UseImageDirectionOn()
    orienter.SetGivenCoordinateDirection(itkImage.GetDirection())
    orienter.SetInput( itkImage )
    orienter.SetDesiredCoordinateOrientationToAxial()
    orienter.Update()
    return orienter.GetOutput()
 
itkImage_axial = itkImage_orient_to_axial(itkImage,imageType)
 
 
OUTPUT:
 
itkOrientImageFilterISS3ISS3: 0.343294itkOrientImageFilterISS3ISS3: 0.346615itkOrientImageFilterISS3ISS3: 0.349935itkOrientImageFilterISS3ISS3: 0.353255itkOrientImageFilterISS3ISS3: 0.356575itkOrientImageFilterISS3ISS3: 0.359896itkOrientImageFilterISS3ISS3: 0.363216itkOrientImageFilterISS3ISS3: 0.366536itkOrientImageFilterISS3ISS3: 0.369857itkOrientImageFilterISS3ISS3: 0.373177itkOrientImageFilterISS3ISS3: 0.376497itkOrientImageFilterISS3ISS3: 0.379818itkOrientImageFilterISS3ISS3: 0.383138itkOrientImageFilterISS3ISS3: 0.386458itkOrientImageFilterISS3ISS3: 0.389779itkOrientImageFilterISS3ISS3: 0.393099itkOrientImageFilterISS3ISS3: 0.396419itkOrientImageFilterISS3ISS3: 0.399740itkOrientImageFilterISS3ISS3: 0.403060itkOrientImageFilterISS3ISS3: 0.406380itkOrientImageFilterISS3ISS3: 0.409701itkOrientImageFilterISS3ISS3: 0.413021itkOrientImageFilterISS3ISS3: 0.416341itkOrientImageFilterISS3ISS3: 0.419661itkOrientImageFilterISS3ISS3: 0.422982itkOrientImageFilterISS3ISS3: 0.426302itkOrientI
mageFilterISS3ISS3: 0.429622itkOrientImageFilterISS3ISS3: 0.432943itkOrientImageFilterISS3ISS3: 0.436263itkOrientImageFilterISS3ISS3: 0.439583itkOrientImageFilterISS3ISS3: 0.442904itkOrientImageFilterISS3ISS3: 0.446224itkOrientImageFilterISS3ISS3: 0.449544itkOrientImageFilterISS3ISS3: 0.452865itkOrientImageFilterISS3ISS3: 0.456185itkOrientImageFilterISS3ISS3: 0.459505itkOrientImageFilterISS3ISS3: 0.462825itkOrientImageFilterISS3ISS3: 0.466146itkOrientImageFilterISS3ISS3: 0.469466itkOrientImageFilterISS3ISS3: 0.472786itkOrientImageFilterISS3ISS3: 0.476107itkOrientImageFilterISS3ISS3: 0.479427itkOrientImageFilterISS3ISS3: 0.482747itkOrientImageFilterISS3ISS3: 0.486068itkOrientImageFilterISS3ISS3: 0.489388itkOrientImageFilterISS3ISS3: 0.492708itkOrientImageFilterISS3ISS3: 0.496029itkOrientImageFilterISS3ISS3: 0.499349itkOrientImageFilterISS3ISS3: 0.502669itkOrientImageFilterISS3ISS3: 0.505990itkOrientImageFilterISS3ISS3: 0.509310itkOrientImageFilterISS3ISS3: 0.512630itkOrientImageFilte
rISS3ISS3: 0.515951itkOrientImageFilterISS3ISS3: 0.519271itkOrientImageFilterISS3ISS3: 0.522591itkOrientImageFilterISS3ISS3: 0.525911itkOrientImageFilterISS3ISS3: 0.529232itkOrientImageFilterISS3ISS3: 0.532552itkOrientImageFilterISS3ISS3: 0.535872itkOrientImageFilterISS3ISS3: 0.539193itkOrientImageFilterISS3ISS3: 0.542513itkOrientImageFilterISS3ISS3: 0.545833itkOrientImageFilterISS3ISS3: 0.549154itkOrientImageFilterISS3ISS3: 0.552474itkOrientImageFilterISS3ISS3: 0.555794itkOrientImageFilterISS3ISS3: 0.559115itkOrientImageFilterISS3ISS3: 0.562435itkOrientImageFilterISS3ISS3: 0.565755itkOrientImageFilterISS3ISS3: 0.569075itkOrientImageFilterISS3ISS3: 0.572396itkOrientImageFilterISS3ISS3: 0.575716itkOrientImageFilterISS3ISS3: 0.579036itkOrientImageFilterISS3ISS3: 0.582357itkOrientImageFilterISS3ISS3: 0.585677itkOrientImageFilterISS3ISS3: 0.588997itkOrientImageFilterISS3ISS3: 0.592318itkOrientImageFilterISS3ISS3: 0.595638itkOrientImageFilterISS3ISS3: 0.598958itkOrientImageFilterISS3ISS3
: 0.602279itkOrientImageFilterISS3ISS3: 0.605599itkOrientImageFilterISS3ISS3: 0.608919itkOrientImageFilterISS3ISS3: 0.612240itkOrientImageFilterISS3ISS3: 0.615560itkOrientImageFilterISS3ISS3: 0.618880itkOrientImageFilterISS3ISS3: 0.622200itkOrientImageFilterISS3ISS3: 0.625521itkOrientImageFilterISS3ISS3: 0.628841itkOrientImageFilterISS3ISS3: 0.632161itkOrientImageFilterISS3ISS3: 0.635482itkOrientImageFilterISS3ISS3: 0.638802itkOrientImageFilterISS3ISS3: 0.642122itkOrientImageFilterISS3ISS3: 0.645443itkOrientImageFilterISS3ISS3: 0.648763itkOrientImageFilterISS3ISS3: 0.652083itkOrientImageFilterISS3ISS3: 0.655404itkOrientImageFilterISS3ISS3: 0.658724itkOrientImageFilterISS3ISS3: 0.662044itkOrientImageFilterISS3ISS3: 0.665365itkOrientImageFilterISS3ISS3: 0.666667itkOrientImageFilterISS3ISS3: 0.666667itkOrientImageFilterISS3ISS3: 1.000000
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160524/80bb5a70/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
 
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
 
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
 
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
 
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
 
------------------------------
 
Subject: Digest Footer
 
_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community
 
 
------------------------------
 
End of Community Digest, Vol 32, Issue 52
*****************************************
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160524/09458a8c/attachment-0001.html>


More information about the Community mailing list