From fredrik.hellman at gmail.com Fri Sep 8 09:31:31 2017 From: fredrik.hellman at gmail.com (hellman) Date: Fri, 8 Sep 2017 06:31:31 -0700 (MST) Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? Message-ID: <1504877491197-0.post@n7.nabble.com> Hi, I am using the SliceBySliceImageFilter (to slice against the last dimension) on a 3D image with the following meta data and region settings: orign = [0, 0, 0] direction = identity spacing = [0.3, 0.3, 1] all regions: index = [5, 5, 0] and size = [770, 710, 200] The internal 2D images that are produced after slicing (let's call such an image A) have the following meta data orign = [1.5, 1.5] direction = identity spacing = [0.3, 0.3] regions: index = [5, 5] and size = [770, 710] The filter thus **redefines the origin** but keeps the index for the internal images. This is a problem for me since the filter that I tell SliceBySliceImageFilter to apply to the slices is a BinaryFunctorImageFilter where the second input has been set to an image (let's call it B) with meta-data: orign = [0, 0] direction = identity spacing = [0.3, 0.3] regions: index = [5, 5] and size = [770, 710]. I would like the the images A and B to have the same physical extent after slicing. The BinaryFunctorImageFilter is an ImageToImageFilter where the physical extent of the two images are verified to be the same by comparing Origin, Direction, and Spacing (in function ImageToImageFilter::VerifyInputInformation()). In my case, A and B do not have matching origins (since SliceBySliceImageFilter redefined it), and thus this verification fails. Now, if SliceBySliceImageFilter would set the new origin to the projection of the 3D origin onto the new 2D plane passing through the 3D origin, I believe this would have worked. Can I make it not to have this default behavior? It does not appear like that from the code. The relevant code is on line 216 in SliceBySliceImageFilter.hxx for ITK 4.12.0: Then, inputOrigin (except for the its last component in my case) is set as the origin of the new internal inputs. I would like something like: Perhaps there is a better way to do what I want to do? I am happy to hear any thoughts on this. Best regards, Fredrik Hellman -- Sent from: http://itk-users.7.n7.nabble.com/ From matt.mccormick at kitware.com Fri Sep 8 09:45:36 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 8 Sep 2017 09:45:36 -0400 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1504877491197-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> Message-ID: Hi Fredrik, The Origin set by SlicerBySlicerImageFilter ensures that the slice keeps its position in physical space. An alternative approach to the issue encountered is to inherit from BinaryFunctorImageFilter or SlicerBySliceImageFilter and override VerifyInputInformation so it does not check the Origin. HTH, Matt On Fri, Sep 8, 2017 at 9:31 AM, hellman wrote: > Hi, > > I am using the SliceBySliceImageFilter (to slice against the last dimension) > on a 3D image with the following meta data and region settings: > > orign = [0, 0, 0] > direction = identity > spacing = [0.3, 0.3, 1] > > all regions: index = [5, 5, 0] and size = [770, 710, 200] > > The internal 2D images that are produced after slicing (let's call such an > image A) have the following meta data > > orign = [1.5, 1.5] > direction = identity > spacing = [0.3, 0.3] > > regions: index = [5, 5] and size = [770, 710] > > The filter thus **redefines the origin** but keeps the index for the > internal images. This is a problem for me since the filter that I tell > SliceBySliceImageFilter to apply to the slices is a BinaryFunctorImageFilter > where the second input has been set to an image (let's call it B) with > meta-data: > > orign = [0, 0] > direction = identity > spacing = [0.3, 0.3] > > regions: index = [5, 5] and size = [770, 710]. > > I would like the the images A and B to have the same physical extent after > slicing. The BinaryFunctorImageFilter is an ImageToImageFilter where the > physical extent of the two images are verified to be the same by comparing > Origin, Direction, and Spacing (in function > ImageToImageFilter::VerifyInputInformation()). In my case, A and B do not > have matching origins (since SliceBySliceImageFilter redefined it), and thus > this verification fails. > > Now, if SliceBySliceImageFilter would set the new origin to the projection > of the 3D origin onto the new 2D plane passing through the 3D origin, I > believe this would have worked. Can I make it not to have this default > behavior? > > It does not appear like that from the code. The relevant code is on line 216 > in SliceBySliceImageFilter.hxx for ITK 4.12.0: > > > > Then, inputOrigin (except for the its last component in my case) is set as > the origin of the new internal inputs. I would like something like: > > > > Perhaps there is a better way to do what I want to do? I am happy to hear > any thoughts on this. > > Best regards, > Fredrik Hellman > > > > -- > Sent from: http://itk-users.7.n7.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 From fredrik.hellman at gmail.com Fri Sep 8 10:38:47 2017 From: fredrik.hellman at gmail.com (hellman) Date: Fri, 8 Sep 2017 07:38:47 -0700 (MST) Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: References: <1504877491197-0.post@n7.nabble.com> Message-ID: <1504881527156-0.post@n7.nabble.com> Thanks for the quick reply! (Btw, some code snippets disappeared from my first post, but they are not so important). Perhaps I missed something about the transformation to physical coordinates, but this is my understanding: The physical position P of the [5,5,0]-index pixel in the 3D volume (according to my meta-data above) is: P = O + D*diag(S)*Index = (0, 0, 0) + (0.3*5, 0.3*5, 1*0) = (1.5, 1.5, 0). For a pixel in a different slice, say pixel [5, 5, 20], the physical point is (1.5, 1.5, 20) Now after slicing, the physical position (according to SliceBySliceImageFilter) of the [5, 5]-pixel of any internal image created by slicing is: (recall new origin is (1.5, 1.5)) (1.5, 1.5) + (0.3*5, 0.3*5) = (3, 3). The position of the [5, 5, 0]-pixel is thus (3, 3) after slicing, while it was at (1.5, 1.5, 0) before slicing. Similarly: The position of the [5, 5, 20]-pixel at (3, 3) after slicing, while it was at (1.5, 1.5, 20) before slicing. To me, it would make more sense for them to be at (1.5, 1.5). -- Sent from: http://itk-users.7.n7.nabble.com/ From matt.mccormick at kitware.com Fri Sep 8 10:56:11 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 8 Sep 2017 10:56:11 -0400 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1504881527156-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> Message-ID: Yes, that description is correct, but the index of the slice set to [0, 0] instead of [5, 5]. HTH, Matt On Fri, Sep 8, 2017 at 10:38 AM, hellman wrote: > Thanks for the quick reply! > > (Btw, some code snippets disappeared from my first post, but they are not so > important). > > Perhaps I missed something about the transformation to physical coordinates, > but this is my understanding: > > The physical position P of the [5,5,0]-index pixel in the 3D volume > (according to my meta-data above) is: > > P = O + D*diag(S)*Index = (0, 0, 0) + (0.3*5, 0.3*5, 1*0) = (1.5, 1.5, 0). > > For a pixel in a different slice, say pixel [5, 5, 20], the physical point > is (1.5, 1.5, 20) > > Now after slicing, the physical position (according to > SliceBySliceImageFilter) of the [5, 5]-pixel of any internal image created > by slicing is: > > (recall new origin is (1.5, 1.5)) > > (1.5, 1.5) + (0.3*5, 0.3*5) = (3, 3). > > The position of the [5, 5, 0]-pixel is thus (3, 3) after slicing, while it > was at (1.5, 1.5, 0) before slicing. > Similarly: The position of the [5, 5, 20]-pixel at (3, 3) after slicing, > while it was at (1.5, 1.5, 20) before slicing. > > To me, it would make more sense for them to be at (1.5, 1.5). > > > > > -- > Sent from: http://itk-users.7.n7.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 From fredrik.hellman at gmail.com Fri Sep 8 11:13:24 2017 From: fredrik.hellman at gmail.com (hellman) Date: Fri, 8 Sep 2017 08:13:24 -0700 (MST) Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> Message-ID: <1504883604903-0.post@n7.nabble.com> I am not sure. In SliceBySliceImageFilter.hxx for ITK 4.12.0, on line 188, it says: // copy the requested region to the internal slice region in // dimension order unsigned int internal_i = 0; for ( unsigned int i = 0; internal_i < InternalImageDimension; ++i, ++internal_i ) { if ( i == this->m_Dimension ) { ++i; } internalOutputRegion.SetSize( internal_i, requestedSize[i] ); internalOutputRegion.SetIndex( internal_i, requestedIndex[i] ); internalInputRegion.SetSize( internal_i, this->GetInput(0)->GetRequestedRegion().GetSize(i) ); internalInputRegion.SetIndex( internal_i, this->GetInput(0)->GetRequestedRegion().GetIndex(i) ); } This will copy all indices (except the slicing dimension) of input 0 to internalInputRegion, which is set as the regions for the internal image further down. In my case, the 5s get copied here. I have also stopped in a debugger in ImageToImageFilter (of my BinaryFunctorImageFilter) where the check that the physical regions overlap is performed. At this point, both images have the same region index [5, 5], but one image has origin (0, 0) and the sliced image has origin (1.5, 1.5). -- Sent from: http://itk-users.7.n7.nabble.com/ From matt.mccormick at kitware.com Fri Sep 8 14:30:53 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 8 Sep 2017 14:30:53 -0400 Subject: [ITK-users] Cardiac Deformation using Segmentation and Registration of Ultrasound Images In-Reply-To: References: Message-ID: Hello Thanos, Yes, to add support for additional image formats, add the corresponding ITK module to the find_package(ITK COMPONENTS ... call: https://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR/blob/50acf46da9fa1480eb502a0bb550c36d518893eb/examples/CMakeLists.txt#L8 Thank you for the suggested correction to the usage documentation. It is added here: https://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR/pull/12 A Python package is now available for the module. It can be installed via python -m pip install --upgrade pip python -m pip install itk-anisotropicdiffusionlbr Thanks, Matt On Mon, Aug 14, 2017 at 12:42 PM, thanos thanos wrote: > Hello again, > > Matt, thank you for solving the example issue. I tried to use the filter and > although it worked great for a 2D png image, it failed for a 2D jpg and > dicom images as well as for a 3D nrrd volume. I got the error "Could not > create ImageIO" so maybe that has to do with the ImageIOFactory. > > I liked the suggested and accepted values when I run the .exe but maybe to > avoid confusion you could replace the > "Weickert diffusion type. Accepted values: Edge, Coherence. Default: Edge." > with > Weickert diffusion type. Accepted values: EED cEED CED cCED Isotropic" > > Best regards, > Thanos > > On Fri, Aug 11, 2017 at 6:55 PM, Matt McCormick > wrote: >> >> On Fri, Aug 4, 2017 at 9:36 AM, Matt McCormick >> wrote: >> > Hi Thanos, >> > >> > On Thu, Aug 3, 2017 at 1:00 PM, thanos thanos >> > wrote: >> >> Hello everyone, >> >> >> >> D?enan, Andras and Matt thank you very much for your answers. >> >> To be honest I've tried already in the past registration with Slicer >> >> using >> >> Demons, B-Splines and also Elastix and Plastimach. >> >> >> >> D?enan, I read your last sentence already many times but I can't really >> >> understand what you mean by "initializing registration of time point >> >> n+1 by >> >> resulting transform from time point n." >> >> >> >> Matt, thank you for sharing your thoughts. I already looked at the >> >> AnisotropicDiffusionLBR paper and I have also tried the online >> >> interactive >> >> figures >> >> >> >> (https://insightsoftwareconsortium.github.io/ITKAnisotropicDiffusionLBR/). >> >> Seems to work nicely, but I wasn't sure how to build the project. I >> >> already >> >> configured my ITK by setting the Module_AnisotropicDiffusionLBR at the >> >> CMake >> >> and then I tried to build the CoherenceEnhancingDiffusion from the >> >> C:\ITK\src\Modules\Remote\AnisotropicDiffusionLBR\examples but I got " >> >> Cannot open include file: 'CoherenceEnhancingDiffusionFilter.h': No >> >> such >> >> file or directory " so I guess I am missing something.. >> > >> > Thanks for the note. I will look into this issue and address it next >> > week. >> >> This is addressed here: >> >> http://review.source.kitware.com/#/c/22567/ >> >> https://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR/commit/3d9880d5f52c4c37e3b658abc607a13f3c3d9545 >> >> I will also create a Python package for the module. >> >> Thanks, >> Matt > > From matt.mccormick at kitware.com Fri Sep 8 14:34:50 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 8 Sep 2017 14:34:50 -0400 Subject: [ITK-users] Problems Using GPU Filters In-Reply-To: References: <1498789176254-7590036.post@n2.nabble.com> <1501002308962-7590057.post@n2.nabble.com> <1501611311517-7590114.post@n2.nabble.com> <1501626181039-7590122.post@n2.nabble.com> Message-ID: The failing tests I observed may have been due to local driver issues. These fixes will be available in the 4.12.2 release. Thanks, Matt On Fri, Aug 11, 2017 at 12:22 PM, Matt McCormick wrote: > Following up, I did not have a chance to fully address this. Progress > is started here: > > http://review.source.kitware.com/#/q/topic:gpu-mean-filters > > The GPUMeanImageFilter tests are failing: > > itkGPUMeanImageFilterTest2D > itkGPUMeanImageFilterTest3D > > I will take another look in a few weeks. > > Thanks, > Matt > > On Fri, Aug 4, 2017 at 9:38 AM, Matt McCormick > wrote: >> Hi Andaharoo, >> >> You may have identified a bug. I am also seeing local failures in the >> regression tests for the referenced classes. I will investigate >> further next week. >> >> Thanks, >> Matt >> >> On Tue, Aug 1, 2017 at 6:23 PM, Andaharoo wrote: >>> I can't get the images to go from CPU to GPU on GPUMeanImageFilter, >>> GPUBinaryThresholdImageFilter, and GPUDiscreteGaussianImageFilter. So I >>> can't start my gpu pipeline with these filters. If I apply something like >>> GPUGradientAnisotropicImageFilter (which does work) then I can apply the >>> other filters confirming that it can go GPU to GPU but not CPU to GPU on >>> those 3 filters. Do these 3 filters not support conversion? >>> >>> GPUInputImage::Pointer inPtr = >>> dynamic_cast(this->ProcessObject::GetInput(0)); >>> inPtr was null when I debugged GPUMeanImageFilter. This line also doesn't >>> make sense in terms of using an Image since it would just return null if you >>> gave it an Image that wasn't allocated as a GPUImage. Unless the cpu image >>> gets converted to a gpu image elsewhere beforehand? >>> >>> It seems as though only GPUInPlaceImageFilters work with CPU - GPU >>> conversion for me? I can't quite understand the GPUInPlaceImageFilters >>> source yet so I'm not so sure why GPUGradientAnisotropicImageFilter works. >>> They are, of course, different in terms of how they manage memory. >>> >>> >>> >>> -- >>> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Problems-Using-GPU-Filters-tp7590036p7590122.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 From lasso at queensu.ca Fri Sep 8 14:55:17 2017 From: lasso at queensu.ca (Andras Lasso) Date: Fri, 8 Sep 2017 18:55:17 +0000 Subject: [ITK-users] [ITK] Cardiac Deformation using Segmentation and Registration of Ultrasound Images In-Reply-To: References: Message-ID: FYI, a few weeks ago we added a nice 4D (3D+t) image registration extension to 3D Slicer. It works very well for cardiac volume sequences: it produces a motion-compensated volume sequence and a displacement field sequence. Sequence Registration extension can be installed by a few clicks from the extension manager in recent 3D Slicer nightly versions. See more information and tutorial here: https://github.com/moselhy/SlicerSequenceRegistration Andras -----Original Message----- From: Community [mailto:community-bounces at itk.org] On Behalf Of Matt McCormick Sent: Friday, September 8, 2017 2:31 PM To: thanos thanos Cc: insight-users at itk.org Subject: Re: [ITK] [ITK-users] Cardiac Deformation using Segmentation and Registration of Ultrasound Images Hello Thanos, Yes, to add support for additional image formats, add the corresponding ITK module to the find_package(ITK COMPONENTS ... call: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FInsightSoftwareConsortium%2FITKAnisotropicDiffusionLBR%2Fblob%2F50acf46da9fa1480eb502a0bb550c36d518893eb%2Fexamples%2FCMakeLists.txt%23L8&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=Vqviuh1be7etykTVE1mHIBzmrdv40KfVrsyinYJUKNw%3D&reserved=0 Thank you for the suggested correction to the usage documentation. It is added here: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FInsightSoftwareConsortium%2FITKAnisotropicDiffusionLBR%2Fpull%2F12&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=uZf%2FlQ0EGne0tyyx6v58G%2Bqhh8jKJMgXE%2FYenk%2F4wls%3D&reserved=0 A Python package is now available for the module. It can be installed via python -m pip install --upgrade pip python -m pip install itk-anisotropicdiffusionlbr Thanks, Matt On Mon, Aug 14, 2017 at 12:42 PM, thanos thanos wrote: > Hello again, > > Matt, thank you for solving the example issue. I tried to use the > filter and although it worked great for a 2D png image, it failed for > a 2D jpg and dicom images as well as for a 3D nrrd volume. I got the > error "Could not create ImageIO" so maybe that has to do with the ImageIOFactory. > > I liked the suggested and accepted values when I run the .exe but > maybe to avoid confusion you could replace the "Weickert diffusion > type. Accepted values: Edge, Coherence. Default: Edge." > with > Weickert diffusion type. Accepted values: EED cEED CED cCED Isotropic" > > Best regards, > Thanos > > On Fri, Aug 11, 2017 at 6:55 PM, Matt McCormick > > wrote: >> >> On Fri, Aug 4, 2017 at 9:36 AM, Matt McCormick >> wrote: >> > Hi Thanos, >> > >> > On Thu, Aug 3, 2017 at 1:00 PM, thanos thanos >> > >> > wrote: >> >> Hello everyone, >> >> >> >> D?enan, Andras and Matt thank you very much for your answers. >> >> To be honest I've tried already in the past registration with >> >> Slicer using Demons, B-Splines and also Elastix and Plastimach. >> >> >> >> D?enan, I read your last sentence already many times but I can't >> >> really understand what you mean by "initializing registration of >> >> time point >> >> n+1 by >> >> resulting transform from time point n." >> >> >> >> Matt, thank you for sharing your thoughts. I already looked at the >> >> AnisotropicDiffusionLBR paper and I have also tried the online >> >> interactive figures >> >> >> >> (https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Finsightsoftwareconsortium.github.io%2FITKAnisotropicDiffusionLBR%2F&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=CYJJaN1M6zQUHs9HAlWipN2PrWEZlTL%2Fx4Ad%2FLVZMxk%3D&reserved=0). >> >> Seems to work nicely, but I wasn't sure how to build the project. >> >> I already configured my ITK by setting the >> >> Module_AnisotropicDiffusionLBR at the CMake and then I tried to >> >> build the CoherenceEnhancingDiffusion from the >> >> C:\ITK\src\Modules\Remote\AnisotropicDiffusionLBR\examples but I got " >> >> Cannot open include file: 'CoherenceEnhancingDiffusionFilter.h': >> >> No such file or directory " so I guess I am missing something.. >> > >> > Thanks for the note. I will look into this issue and address it >> > next week. >> >> This is addressed here: >> >> >> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Frevie >> w.source.kitware.com%2F%23%2Fc%2F22567%2F&data=02%7C01%7Classo%40quee >> nsu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb28 >> 38b925c%7C1%7C0%7C636404922819639139&sdata=XjWsPDq1Z%2BxvDcVUm9MFDDLa >> BY%2BQHkuuuAgDhyKwQYg%3D&reserved=0 >> >> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith >> ub.com%2FInsightSoftwareConsortium%2FITKAnisotropicDiffusionLBR%2Fcom >> mit%2F3d9880d5f52c4c37e3b658abc607a13f3c3d9545&data=02%7C01%7Classo%4 >> 0queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4 >> efb2838b925c%7C1%7C0%7C636404922819639139&sdata=NN9XhKvMpJDHHL4DK1g2k >> THZViGfwo6o%2B6wSOJAI7bo%3D&reserved=0 >> >> I will also create a Python package for the module. >> >> Thanks, >> Matt > > _____________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=eK3g%2BnV4Y1xllgOs7u8Wj3VJMHSVeOEKRmYkRWVgerY%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=pktiA7zEmkEVs33%2BkmjL2zGqnwb3QgiyljFcFVfNlGk%3D&reserved=0 Kitware offers ITK Training Courses, for more information visit: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=QPw5ZfDHLfSojDX%2FZa7xGaVVqahv0Sr9e0HXGp9nyHk%3D&reserved=0 Please keep messages on-topic and check the ITK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=MSlPFevAsLgMK1h1RQKZ2Db8gVGQtcvanhoC%2Bhycpl4%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Finsight-users&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=291h4yTpF4VbYSsxzlVgZK2t5iFe0S2Tq6EOcwE2Y5Y%3D&reserved=0 _______________________________________________ Community mailing list Community at itk.org https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcommunity&data=02%7C01%7Classo%40queensu.ca%7C3d7f50e0df534e04dfe708d4f6e7cd61%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636404922819639139&sdata=quNQl4jX7Mm1%2BnF1Mxgjln4W7oZAryrY5OSds3jButw%3D&reserved=0 From matt.mccormick at kitware.com Fri Sep 8 15:08:52 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 8 Sep 2017 15:08:52 -0400 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1504883604903-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> Message-ID: Yes, that is an issue -- good catch! If we change: internalOutputRegion.SetIndex( internal_i, requestedIndex[i] ); to: internalOutputRegion.SetIndex( internal_i, 0 ); and internalInputRegion.SetIndex( internal_i, this->GetInput(0)->GetRequestedRegion().GetIndex(i) ); to: internalInputRegion.SetIndex( internal_i, 0 ); is the behavior corrected? Thanks, Matt On Fri, Sep 8, 2017 at 11:13 AM, hellman wrote: > I am not sure. In SliceBySliceImageFilter.hxx for ITK 4.12.0, on line 188, it > says: > > // copy the requested region to the internal slice region in > // dimension order > unsigned int internal_i = 0; > for ( unsigned int i = 0; internal_i < InternalImageDimension; ++i, > ++internal_i ) > { > if ( i == this->m_Dimension ) > { > ++i; > } > internalOutputRegion.SetSize( internal_i, requestedSize[i] ); > internalOutputRegion.SetIndex( internal_i, requestedIndex[i] ); > > internalInputRegion.SetSize( internal_i, > this->GetInput(0)->GetRequestedRegion().GetSize(i) ); > internalInputRegion.SetIndex( internal_i, > this->GetInput(0)->GetRequestedRegion().GetIndex(i) ); > > } > > This will copy all indices (except the slicing dimension) of input 0 to > internalInputRegion, which is set as the regions for the internal image > further down. In my case, the 5s get copied here. > > I have also stopped in a debugger in ImageToImageFilter (of my > BinaryFunctorImageFilter) where the check that the physical regions overlap > is performed. At this point, both images have the same region index [5, 5], > but one image has origin (0, 0) and the sliced image has origin (1.5, 1.5). > > > > > -- > Sent from: http://itk-users.7.n7.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 From fredrik.hellman at gmail.com Mon Sep 11 05:39:41 2017 From: fredrik.hellman at gmail.com (hellman) Date: Mon, 11 Sep 2017 02:39:41 -0700 (MST) Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> Message-ID: <1505122781018-0.post@n7.nabble.com> I have been thinking a bit about this and realized this is slightly more complex problem than I first thought. Yes, as far as I can see, your suggested solution would (in my case) make the physical extents of the internal image and the image input projected to the XY 2D plane the same. But the current implementation ((even) with this bugfix) has two problems: 1. The projection of the original 3D origin onto the XY plane does not coincide with the new internal origin (there is nothing that says it should be, but to me it seems natural). 2. If the Direction matrix if the input would not be identity, the physical interpretation is unclear. It would be nice to have a procedure to compute the internal image meta-data that has some interpretation also when the Direction matrix is not identity. There are some conceptual problems the whole procedure of going to a 3D-origin to a 2D-origin: The input image 3D origin is defined in the physical frame of reference (FoR), while the image data is indexed in a different FoR that can be arbitrarily rotated with respect to the physical one, through the direction matrix. The SliceBySliceImageFilter slices in the index FoR and not in the physical FoR. This means that any plane (or line for 2D input, or hyperplane for higher dimensions) in the physical FoR can be the slicing plane. This in turn means it makes no sense to favor certain physical dimensions as is done in the current code. For example, just because we slice _index dimension 3_, does not mean we should (as is done today) compute the origin coordinates of the first pixel in physical coordinates and keep all physical coordinates except the one corresponding to _physical dimension 3_ in the new origin. I fail to see what is the physical interpretation of this. One solution that has a clear physical interpretation is the following. Consider the plane P orthogonal to the slicing dimension (spanned by the all columns of the input Direction matrix except the sliced dimension) intersecting the physical origin. The Direction matrix for the internal image would be Identity. This means we choose the _index FoR_ as slice FoR for expressing points in plane P in the slice. When considering a slice, the Origin of this slice would be projected onto this plane P and it would be expressed in the coordinates of the slice FoR. The Region from the input can simply be copied to the internal image (except for the sliced dimension), since it is just a matter of collapsing the sliced dimension. -- Sent from: http://itk-users.7.n7.nabble.com/ From matt.mccormick at kitware.com Mon Sep 11 11:24:28 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Mon, 11 Sep 2017 11:24:28 -0400 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1505122781018-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> <1505122781018-0.post@n7.nabble.com> Message-ID: Yes, there are many ways handle the direction dimension collapse, and it should be handled with care. If possible, we should follow the behavior in ExtractImageFilter: https://itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html which has multiple options. Thanks, Matt On Mon, Sep 11, 2017 at 5:39 AM, hellman wrote: > I have been thinking a bit about this and realized this is slightly more > complex problem than I first thought. > > Yes, as far as I can see, your suggested solution would (in my case) make > the physical extents of the internal image and the image input projected to > the XY 2D plane the same. > > But the current implementation ((even) with this bugfix) has two problems: > > 1. The projection of the original 3D origin onto the XY plane does not > coincide with the new internal origin (there is nothing that says it should > be, but to me it seems natural). > 2. If the Direction matrix if the input would not be identity, the physical > interpretation is unclear. > > It would be nice to have a procedure to compute the internal image meta-data > that has some interpretation also when the Direction matrix is not identity. > There are some conceptual problems the whole procedure of going to a > 3D-origin to a 2D-origin: > > The input image 3D origin is defined in the physical frame of reference > (FoR), while the image data is indexed in a different FoR that can be > arbitrarily rotated with respect to the physical one, through the direction > matrix. > > The SliceBySliceImageFilter slices in the index FoR and not in the physical > FoR. This means that any plane (or line for 2D input, or hyperplane for > higher dimensions) in the physical FoR can be the slicing plane. This in > turn means it makes no sense to favor certain physical dimensions as is done > in the current code. For example, just because we slice _index dimension 3_, > does not mean we should (as is done today) compute the origin coordinates of > the first pixel in physical coordinates and keep all physical coordinates > except the one corresponding to _physical dimension 3_ in the new origin. I > fail to see what is the physical interpretation of this. > > One solution that has a clear physical interpretation is the following. > Consider the plane P orthogonal to the slicing dimension (spanned by the all > columns of the input Direction matrix except the sliced dimension) > intersecting the physical origin. The Direction matrix for the internal > image would be Identity. This means we choose the _index FoR_ as slice FoR > for expressing points in plane P in the slice. When considering a slice, the > Origin of this slice would be projected onto this plane P and it would be > expressed in the coordinates of the slice FoR. The Region from the input can > simply be copied to the internal image (except for the sliced dimension), > since it is just a matter of collapsing the sliced dimension. > > > > -- > Sent from: http://itk-users.7.n7.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 From blowekamp at mail.nih.gov Mon Sep 11 11:31:50 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 11 Sep 2017 15:31:50 +0000 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1505122781018-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> <1505122781018-0.post@n7.nabble.com> Message-ID: Hello, I few years ago I spent a bit of time with the SliceBySliceImageFilter to get the filter to ?stream?. The way it was implemented was to expand the requested region of the output to the full size of the input?s in the non-slice-by-slice dimensions so that whole slices could be streamed through the filter. From your post, it may be the case that if the input image?s largest possible region starts with a non-zero index, then the computation of the origin per-slice is not proper. Can you please try to the filter with a zero-indexed input image? I am not certain the previous prosed fix will work properly with streaming, and it may change the number of pixels in the regions? However, for your case with an input image and an identity direction cosine matrix but with an non-zero largest possible index, it appears that the origin for the internal images is not correct. The non-zero index is a case that is not often checked by the ITK testing infrastructure, so I am not surprised it has a bug. Generally, it?s best to avoid such complex images with complex filters such as the SliceBySliceImageFilter. I have a proposed fix which may solve the problem for your case: http://review.source.kitware.com/#/c/22601/ I need to add tests and verify this is proper. Perhaps, you can test it to see if it meets your needs and behaves as expected for you? Also for reference here is the Slicer module I implemented which streams the SliceBySliceImageFilter. The streaming and proper geometry are critical for this application, so any changes made to this filter, I?ll need to ensure it still operates correctly. https://github.com/blowekamp/Slicer-IASEM/blob/master/IASEMImportSeries/IASEMImportSeries.cxx Brad On 9/11/17, 5:40 AM, "hellman" wrote: I have been thinking a bit about this and realized this is slightly more complex problem than I first thought. Yes, as far as I can see, your suggested solution would (in my case) make the physical extents of the internal image and the image input projected to the XY 2D plane the same. But the current implementation ((even) with this bugfix) has two problems: 1. The projection of the original 3D origin onto the XY plane does not coincide with the new internal origin (there is nothing that says it should be, but to me it seems natural). 2. If the Direction matrix if the input would not be identity, the physical interpretation is unclear. It would be nice to have a procedure to compute the internal image meta-data that has some interpretation also when the Direction matrix is not identity. There are some conceptual problems the whole procedure of going to a 3D-origin to a 2D-origin: The input image 3D origin is defined in the physical frame of reference (FoR), while the image data is indexed in a different FoR that can be arbitrarily rotated with respect to the physical one, through the direction matrix. The SliceBySliceImageFilter slices in the index FoR and not in the physical FoR. This means that any plane (or line for 2D input, or hyperplane for higher dimensions) in the physical FoR can be the slicing plane. This in turn means it makes no sense to favor certain physical dimensions as is done in the current code. For example, just because we slice _index dimension 3_, does not mean we should (as is done today) compute the origin coordinates of the first pixel in physical coordinates and keep all physical coordinates except the one corresponding to _physical dimension 3_ in the new origin. I fail to see what is the physical interpretation of this. One solution that has a clear physical interpretation is the following. Consider the plane P orthogonal to the slicing dimension (spanned by the all columns of the input Direction matrix except the sliced dimension) intersecting the physical origin. The Direction matrix for the internal image would be Identity. This means we choose the _index FoR_ as slice FoR for expressing points in plane P in the slice. When considering a slice, the Origin of this slice would be projected onto this plane P and it would be expressed in the coordinates of the slice FoR. The Region from the input can simply be copied to the internal image (except for the sliced dimension), since it is just a matter of collapsing the sliced dimension. -- Sent from: http://itk-users.7.n7.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 From francois.budin at kitware.com Mon Sep 11 13:37:47 2017 From: francois.budin at kitware.com (Francois Budin) Date: Mon, 11 Sep 2017 13:37:47 -0400 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: Hello Fabian, You are most likely allocating more memory than what your computer can allocates. If you compute the memory required for your matrix, it will be at least: 8 (long doubles on Visual Studio C++ are the same size as doubles) * 2*100*100*2*100*100 = 3 200 000 000 Bytes This means that you need to have at least that much memory available. If your computer does not have this amount of memory available, you will run into errors. Hope this helps, Francois On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres wrote: > Hi evryone. > > I?m using itk VariableMatrix to do some image processing. But I have some > problems initializing my matrices. > When I use small sizes like this I do not have any problem > > //matrix A > regionSize[0] = 15; > regionSze[1] = 15; > VariableSizeMatrix matA; > matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*regionSize[1]); > matA.Fill(0.0); > > But when I use bigger sizes like: > > regionSize[0] = 100; > regionSze[1] = 100; > > I get an Acces Violation exception > Access violation reading location 0xcdcdcdc1. > > I'm using Visualstudio 2008 and ITK 4.4 > > Does this has something to do with memory allocation? > Is there a way a could verify if I have enough memory to allocate my > matrix? > > Thanks. > > -- > Fabi?n Torres Robles > Maestr?a en Ciencias en Ingenier?a Electr?nica > Ingenier?a en Sistemas Electr?nicos > Tel. 58081280, 0445534661338 > E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From blowekamp at mail.nih.gov Mon Sep 11 13:47:53 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 11 Sep 2017 17:47:53 +0000 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: Oh! I think you are experiencing integer overflow with that size of a matrix. The value Francois (correctly) computed 3,200,000,000 is ~3GB which is greater than numeric_traits::max(), which for 32-bit singed integers is 2,147,483,647. The internal implementation of this class is vnl_matrix, so the integer limitation lies within that library. So you matrix is too big for this library. When I looked at this e-mail earlier I miss computed the size, so I didn?t realized this problem. HTH, Brad From: Francois Budin Date: Monday, September 11, 2017 at 1:38 PM To: Fabian Torres Cc: "insight-users at itk.org" Subject: Re: [ITK-users] Variable Matrix Access Violiotation Hello Fabian, You are most likely allocating more memory than what your computer can allocates. If you compute the memory required for your matrix, it will be at least: 8 (long doubles on Visual Studio C++ are the same size as doubles) * 2*100*100*2*100*100 = 3 200 000 000 Bytes This means that you need to have at least that much memory available. If your computer does not have this amount of memory available, you will run into errors. Hope this helps, Francois On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres > wrote: Hi evryone. I?m using itk VariableMatrix to do some image processing. But I have some problems initializing my matrices. When I use small sizes like this I do not have any problem //matrix A regionSize[0] = 15; regionSze[1] = 15; VariableSizeMatrix matA; matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*regionSize[1]); matA.Fill(0.0); But when I use bigger sizes like: regionSize[0] = 100; regionSze[1] = 100; I get an Acces Violation exception Access violation reading location 0xcdcdcdc1. I'm using Visualstudio 2008 and ITK 4.4 Does this has something to do with memory allocation? Is there a way a could verify if I have enough memory to allocate my matrix? Thanks. -- Fabi?n Torres Robles Maestr?a en Ciencias en Ingenier?a Electr?nica Ingenier?a en Sistemas Electr?nicos Tel. 58081280, 0445534661338 E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.budin at kitware.com Mon Sep 11 13:56:28 2017 From: francois.budin at kitware.com (Francois Budin) Date: Mon, 11 Sep 2017 13:56:28 -0400 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: @Brad: I looked in the source code and the types of the column and row size variables are "unsigned int" which should allow up to 2^32-1 so 4GB, isn't that correct? On Mon, Sep 11, 2017 at 1:47 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] < blowekamp at mail.nih.gov> wrote: > Oh! I think you are experiencing integer overflow with that size of a > matrix. The value Francois (correctly) computed 3,200,000,000 is ~3GB which > is greater than numeric_traits::max(), which for 32-bit singed > integers is 2,147,483,647. The internal implementation of this class is > vnl_matrix, so the integer limitation lies within that library. So you > matrix is too big for this library. > > > > When I looked at this e-mail earlier I miss computed the size, so I didn?t > realized this problem. > > > > HTH, > > Brad > > > > > > *From: *Francois Budin > *Date: *Monday, September 11, 2017 at 1:38 PM > *To: *Fabian Torres > *Cc: *"insight-users at itk.org" > *Subject: *Re: [ITK-users] Variable Matrix Access Violiotation > > > > Hello Fabian, > > You are most likely allocating more memory than what your computer can > allocates. If you compute the memory required for your matrix, it will be > at least: > > 8 (long doubles on Visual Studio C++ are the same size as doubles) * > 2*100*100*2*100*100 = 3 200 000 000 Bytes > > This means that you need to have at least that much memory available. > > If your computer does not have this amount of memory available, you will > run into errors. > > Hope this helps, > > Francois > > > > > > On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres > wrote: > > Hi evryone. > > > > I?m using itk VariableMatrix to do some image processing. But I have some > problems initializing my matrices. > > When I use small sizes like this I do not have any problem > > > > //matrix A > > regionSize[0] = 15; > > regionSze[1] = 15; > > VariableSizeMatrix matA; > > matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*regionSize[1]); > > matA.Fill(0.0); > > > > But when I use bigger sizes like: > > > > regionSize[0] = 100; > > regionSze[1] = 100; > > > > I get an Acces Violation exception > > Access violation reading location 0xcdcdcdc1. > > > > I'm using Visualstudio 2008 and ITK 4.4 > > > > Does this has something to do with memory allocation? > > Is there a way a could verify if I have enough memory to allocate my > matrix? > > > > Thanks. > > > > -- > > Fabi?n Torres Robles > Maestr?a en Ciencias en Ingenier?a Electr?nica > Ingenier?a en Sistemas Electr?nicos > Tel. 58081280, 0445534661338 > E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From blowekamp at mail.nih.gov Mon Sep 11 13:58:41 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 11 Sep 2017 17:58:41 +0000 Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> <1505122781018-0.post@n7.nabble.com> Message-ID: I agree that filter has a nice option set for how to reduce the dimension of direction cosine matrix and update the physical coordinates. However, I would not try to re-implement or copy all those options and their implementations. If a new version of the filter was to be created, I?d recommend just reusing this recommended ExtractImageFilter in a mini-pipeline style composite filter. Brad On 9/11/17, 11:25 AM, "Matt McCormick" wrote: Yes, there are many ways handle the direction dimension collapse, and it should be handled with care. If possible, we should follow the behavior in ExtractImageFilter: https://itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html which has multiple options. Thanks, Matt On Mon, Sep 11, 2017 at 5:39 AM, hellman wrote: > I have been thinking a bit about this and realized this is slightly more > complex problem than I first thought. > > Yes, as far as I can see, your suggested solution would (in my case) make > the physical extents of the internal image and the image input projected to > the XY 2D plane the same. > > But the current implementation ((even) with this bugfix) has two problems: > > 1. The projection of the original 3D origin onto the XY plane does not > coincide with the new internal origin (there is nothing that says it should > be, but to me it seems natural). > 2. If the Direction matrix if the input would not be identity, the physical > interpretation is unclear. > > It would be nice to have a procedure to compute the internal image meta-data > that has some interpretation also when the Direction matrix is not identity. > There are some conceptual problems the whole procedure of going to a > 3D-origin to a 2D-origin: > > The input image 3D origin is defined in the physical frame of reference > (FoR), while the image data is indexed in a different FoR that can be > arbitrarily rotated with respect to the physical one, through the direction > matrix. > > The SliceBySliceImageFilter slices in the index FoR and not in the physical > FoR. This means that any plane (or line for 2D input, or hyperplane for > higher dimensions) in the physical FoR can be the slicing plane. This in > turn means it makes no sense to favor certain physical dimensions as is done > in the current code. For example, just because we slice _index dimension 3_, > does not mean we should (as is done today) compute the origin coordinates of > the first pixel in physical coordinates and keep all physical coordinates > except the one corresponding to _physical dimension 3_ in the new origin. I > fail to see what is the physical interpretation of this. > > One solution that has a clear physical interpretation is the following. > Consider the plane P orthogonal to the slicing dimension (spanned by the all > columns of the input Direction matrix except the sliced dimension) > intersecting the physical origin. The Direction matrix for the internal > image would be Identity. This means we choose the _index FoR_ as slice FoR > for expressing points in plane P in the slice. When considering a slice, the > Origin of this slice would be projected onto this plane P and it would be > expressed in the coordinates of the slice FoR. The Region from the input can > simply be copied to the internal image (except for the sliced dimension), > since it is just a matter of collapsing the sliced dimension. > > > > -- > Sent from: http://itk-users.7.n7.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 _____________________________________ 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 From blowekamp at mail.nih.gov Mon Sep 11 14:08:11 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Mon, 11 Sep 2017 18:08:11 +0000 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: Yes, unsigned int?s max is ~4GB, so it ?could? work. But working with unsigned integers in the 2GB-3GB range is problematic and trick when subtraction and offsets need to be computed. It is a big red flag to me. Another possibility, is that the program was just compiled in 32-bit mode. I don?t think a win32 application can allocate that much memory. Brad From: Francois Budin Date: Monday, September 11, 2017 at 1:57 PM To: "Lowekamp, Bradley (NIH/NLM/LHC) [C]" Cc: Fabian Torres , "insight-users at itk.org" Subject: Re: [ITK-users] Variable Matrix Access Violiotation @Brad: I looked in the source code and the types of the column and row size variables are "unsigned int" which should allow up to 2^32-1 so 4GB, isn't that correct? On Mon, Sep 11, 2017 at 1:47 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] > wrote: Oh! I think you are experiencing integer overflow with that size of a matrix. The value Francois (correctly) computed 3,200,000,000 is ~3GB which is greater than numeric_traits::max(), which for 32-bit singed integers is 2,147,483,647. The internal implementation of this class is vnl_matrix, so the integer limitation lies within that library. So you matrix is too big for this library. When I looked at this e-mail earlier I miss computed the size, so I didn?t realized this problem. HTH, Brad From: Francois Budin > Date: Monday, September 11, 2017 at 1:38 PM To: Fabian Torres > Cc: "insight-users at itk.org" > Subject: Re: [ITK-users] Variable Matrix Access Violiotation Hello Fabian, You are most likely allocating more memory than what your computer can allocates. If you compute the memory required for your matrix, it will be at least: 8 (long doubles on Visual Studio C++ are the same size as doubles) * 2*100*100*2*100*100 = 3 200 000 000 Bytes This means that you need to have at least that much memory available. If your computer does not have this amount of memory available, you will run into errors. Hope this helps, Francois On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres > wrote: Hi evryone. I?m using itk VariableMatrix to do some image processing. But I have some problems initializing my matrices. When I use small sizes like this I do not have any problem //matrix A regionSize[0] = 15; regionSze[1] = 15; VariableSizeMatrix matA; matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*regionSize[1]); matA.Fill(0.0); But when I use bigger sizes like: regionSize[0] = 100; regionSze[1] = 100; I get an Acces Violation exception Access violation reading location 0xcdcdcdc1. I'm using Visualstudio 2008 and ITK 4.4 Does this has something to do with memory allocation? Is there a way a could verify if I have enough memory to allocate my matrix? Thanks. -- Fabi?n Torres Robles Maestr?a en Ciencias en Ingenier?a Electr?nica Ingenier?a en Sistemas Electr?nicos Tel. 58081280, 0445534661338 E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabian.trobles at gmail.com Mon Sep 11 17:30:16 2017 From: fabian.trobles at gmail.com (Fabian Torres) Date: Mon, 11 Sep 2017 16:30:16 -0500 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: Hi. Thanks for your responses; all of them gave me some perspective on the problem. Indeed the size of my matrix is around 3GB and I do have enough memory space to allocate it. So I think the problem lies in the integer overflow and that my program is compiled in 32-bit mode, so my win32 cannot allocate that size of matrix. So what do you recommend? use another kind of structure that it is not an itk matrix and compiling this project in 64bits? Thank you very much. I do appreciate the time you took for this subject. On Mon, Sep 11, 2017 at 1:08 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] < blowekamp at mail.nih.gov> wrote: > Yes, unsigned int?s max is ~4GB, so it ?could? work. But working with > unsigned integers in the 2GB-3GB range is problematic and trick when > subtraction and offsets need to be computed. It is a big red flag to me. > > > > Another possibility, is that the program was just compiled in 32-bit mode. > I don?t think a win32 application can allocate that much memory. > > > > Brad > > > > > > > > *From: *Francois Budin > *Date: *Monday, September 11, 2017 at 1:57 PM > *To: *"Lowekamp, Bradley (NIH/NLM/LHC) [C]" > *Cc: *Fabian Torres , "insight-users at itk.org" < > insight-users at itk.org> > > *Subject: *Re: [ITK-users] Variable Matrix Access Violiotation > > > > @Brad: I looked in the source code and the types of the column and row > size variables are "unsigned int" which should allow up to 2^32-1 so 4GB, > isn't that correct? > > > > On Mon, Sep 11, 2017 at 1:47 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] < > blowekamp at mail.nih.gov> wrote: > > Oh! I think you are experiencing integer overflow with that size of a > matrix. The value Francois (correctly) computed 3,200,000,000 is ~3GB which > is greater than numeric_traits::max(), which for 32-bit singed > integers is 2,147,483,647. The internal implementation of this class is > vnl_matrix, so the integer limitation lies within that library. So you > matrix is too big for this library. > > > > When I looked at this e-mail earlier I miss computed the size, so I didn?t > realized this problem. > > > > HTH, > > Brad > > > > > > *From: *Francois Budin > *Date: *Monday, September 11, 2017 at 1:38 PM > *To: *Fabian Torres > *Cc: *"insight-users at itk.org" > *Subject: *Re: [ITK-users] Variable Matrix Access Violiotation > > > > Hello Fabian, > > You are most likely allocating more memory than what your computer can > allocates. If you compute the memory required for your matrix, it will be > at least: > > 8 (long doubles on Visual Studio C++ are the same size as doubles) * > 2*100*100*2*100*100 = 3 200 000 000 Bytes > > This means that you need to have at least that much memory available. > > If your computer does not have this amount of memory available, you will > run into errors. > > Hope this helps, > > Francois > > > > > > On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres > wrote: > > Hi evryone. > > > > I?m using itk VariableMatrix to do some image processing. But I have some > problems initializing my matrices. > > When I use small sizes like this I do not have any problem > > > > //matrix A > > regionSize[0] = 15; > > regionSze[1] = 15; > > VariableSizeMatrix matA; > > matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*regionSize[1]); > > matA.Fill(0.0); > > > > But when I use bigger sizes like: > > > > regionSize[0] = 100; > > regionSze[1] = 100; > > > > I get an Acces Violation exception > > Access violation reading location 0xcdcdcdc1. > > > > I'm using Visualstudio 2008 and ITK 4.4 > > > > Does this has something to do with memory allocation? > > Is there a way a could verify if I have enough memory to allocate my > matrix? > > > > Thanks. > > > > -- > > Fabi?n Torres Robles > Maestr?a en Ciencias en Ingenier?a Electr?nica > Ingenier?a en Sistemas Electr?nicos > Tel. 58081280, 0445534661338 > E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 > > > > > -- Fabi?n Torres Robles Maestr?a en Ciencias en Ingenier?a Electr?nica Ingenier?a en Sistemas Electr?nicos Tel. 58081280, 0445534661338 E-mail fabian.trobles at gmail.com, dae.wong at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.letouzey at gmail.com Tue Sep 12 05:41:24 2017 From: antoine.letouzey at gmail.com (g2) Date: Tue, 12 Sep 2017 02:41:24 -0700 (MST) Subject: [ITK-users] Rotation of anisotropic 3D image Message-ID: <1505209284609-0.post@n2.nabble.com> Hi all, I am trying to rotate in 3D with a arbitrary rotation matrix a 3D image with non uniform spacing (0.15, 0.15, 0.19). I am currently using itk::AffineTransform because at some point in the future I would like to introduce a translation. My question is about the spacing of the output image. Since my rotation matrix can be anything, I cannot just re-use the spacing of my original image. I actually do not care to much about the output spacing, it can be the same, it can be isotropic, whatever as long as the data makes sense. here is a bit of code of what I've done so far: typedef itk::Image Image3d; Image3d::Pointer itkImage = getImageSomehow(); typedef itk::AffineTransform TransformType; TransformType::Pointer Rt = TransformType::New(); TransformType::ParametersType params(12); for (int i = 0; i < 9; i++){ params[i] = R[i/3][i%3]; // R is the rotation matrix of type double[3][3] } params[9] = 0; params[10] = 0; params[11] = 0; Rt->SetParameters(params); typedef itk::ResampleImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); typedef itk::NearestNeighborInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue(255); filter->SetOutputOrigin(itkImage->GetOrigin()); filter->SetOutputSpacing(itkImage->GetSpacing()); //double outSpacing[3] = { 0.1, 0.1, 0.1 }; //filter->SetOutputSpacing(outSpacing); filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); filter->SetOutputDirection(itkImage->GetDirection()); filter->SetInput(itkImage); filter->SetTransform(Rt); filter->Update(); After this when I save filter->GetOutput() and open it with IKT-Snap I can see my new image properly rotated. But it has the same spacing as the input image, as specified with filter->SetOutputSpacing(itkImage->GetSpacing()); and to me this doesn't make sense. The axes are rotated and so should be the spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). The output image is all black. I'm confused because to me those values are not more erroneous than a plain copy of the input spacing. Questions : I want to rotate a generic 3D image with anisotropic spacing with a generic rotation matrix (i.e. not around a single axis and not with a n*90? angle) so that any physical point P in the original volumes maps to R*P in the final one. How should I proceed ? thanks -- Sent from: http://itk-insight-users.2283740.n2.nabble.com/ From fredrik.hellman at gmail.com Tue Sep 12 06:39:22 2017 From: fredrik.hellman at gmail.com (hellman) Date: Tue, 12 Sep 2017 03:39:22 -0700 (MST) Subject: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> <1505122781018-0.post@n7.nabble.com> Message-ID: <1505212762750-0.post@n7.nabble.com> I tried shifting the origin such that the input image had region index 0 and then it worked. I also applied the patch http://review.source.kitware.com/#/c/22601/ and now it works also with non-zero region index in my case, so my particular problem is solved by this patch. -- Sent from: http://itk-users.7.n7.nabble.com/ From francois.budin at kitware.com Tue Sep 12 08:42:27 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 12 Sep 2017 08:42:27 -0400 Subject: [ITK-users] Variable Matrix Access Violiotation In-Reply-To: References: Message-ID: Hello Fabian, In your case the limitation is really the fact that you compile your project in 32bits. Using another kind of structure will lead to the same issue as long as it is build in 32bits. So my advice is to compile your project (and ITK) in 64 bits. It will work then (it works on my computer). Hope this helps, Fran?ois On Mon, Sep 11, 2017 at 5:30 PM, Fabian Torres wrote: > Hi. > > > > Thanks for your responses; all of them gave me some perspective on the > problem. > > Indeed the size of my matrix is around 3GB and I do have enough memory > space to allocate it. > > > > So I think the problem lies in the integer overflow and that my program is > compiled in 32-bit mode, so my win32 cannot allocate that size of matrix. > > > > So what do you recommend? use another kind of structure that it is not an > itk matrix and compiling this project in 64bits? > > > > Thank you very much. I do appreciate the time you took for this subject. > > On Mon, Sep 11, 2017 at 1:08 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] < > blowekamp at mail.nih.gov> wrote: > >> Yes, unsigned int?s max is ~4GB, so it ?could? work. But working with >> unsigned integers in the 2GB-3GB range is problematic and trick when >> subtraction and offsets need to be computed. It is a big red flag to me. >> >> >> >> Another possibility, is that the program was just compiled in 32-bit >> mode. I don?t think a win32 application can allocate that much memory. >> >> >> >> Brad >> >> >> >> >> >> >> >> *From: *Francois Budin >> *Date: *Monday, September 11, 2017 at 1:57 PM >> *To: *"Lowekamp, Bradley (NIH/NLM/LHC) [C]" >> *Cc: *Fabian Torres , "insight-users at itk.org" < >> insight-users at itk.org> >> >> *Subject: *Re: [ITK-users] Variable Matrix Access Violiotation >> >> >> >> @Brad: I looked in the source code and the types of the column and row >> size variables are "unsigned int" which should allow up to 2^32-1 so 4GB, >> isn't that correct? >> >> >> >> On Mon, Sep 11, 2017 at 1:47 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] < >> blowekamp at mail.nih.gov> wrote: >> >> Oh! I think you are experiencing integer overflow with that size of a >> matrix. The value Francois (correctly) computed 3,200,000,000 is ~3GB which >> is greater than numeric_traits::max(), which for 32-bit singed >> integers is 2,147,483,647. The internal implementation of this class is >> vnl_matrix, so the integer limitation lies within that library. So you >> matrix is too big for this library. >> >> >> >> When I looked at this e-mail earlier I miss computed the size, so I >> didn?t realized this problem. >> >> >> >> HTH, >> >> Brad >> >> >> >> >> >> *From: *Francois Budin >> *Date: *Monday, September 11, 2017 at 1:38 PM >> *To: *Fabian Torres >> *Cc: *"insight-users at itk.org" >> *Subject: *Re: [ITK-users] Variable Matrix Access Violiotation >> >> >> >> Hello Fabian, >> >> You are most likely allocating more memory than what your computer can >> allocates. If you compute the memory required for your matrix, it will be >> at least: >> >> 8 (long doubles on Visual Studio C++ are the same size as doubles) * >> 2*100*100*2*100*100 = 3 200 000 000 Bytes >> >> This means that you need to have at least that much memory available. >> >> If your computer does not have this amount of memory available, you will >> run into errors. >> >> Hope this helps, >> >> Francois >> >> >> >> >> >> On Wed, Aug 30, 2017 at 12:24 PM, Fabian Torres >> wrote: >> >> Hi evryone. >> >> >> >> I?m using itk VariableMatrix to do some image processing. But I have some >> problems initializing my matrices. >> >> When I use small sizes like this I do not have any problem >> >> >> >> //matrix A >> >> regionSize[0] = 15; >> >> regionSze[1] = 15; >> >> VariableSizeMatrix matA; >> >> matA.SetSize(2*regionSize[0]*regionSize[1],2*regionSize[0]*r >> egionSize[1]); >> >> matA.Fill(0.0); >> >> >> >> But when I use bigger sizes like: >> >> >> >> regionSize[0] = 100; >> >> regionSze[1] = 100; >> >> >> >> I get an Acces Violation exception >> >> Access violation reading location 0xcdcdcdc1. >> >> >> >> I'm using Visualstudio 2008 and ITK 4.4 >> >> >> >> Does this has something to do with memory allocation? >> >> Is there a way a could verify if I have enough memory to allocate my >> matrix? >> >> >> >> Thanks. >> >> >> >> -- >> >> Fabi?n Torres Robles >> Maestr?a en Ciencias en Ingenier?a Electr?nica >> Ingenier?a en Sistemas Electr?nicos >> Tel. 58081280, 0445534661338 >> E-mail fabian.trobles at gmail.com, dae.wong at gmail.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 >> >> >> >> >> > > > > -- > Fabi?n Torres Robles > Maestr?a en Ciencias en Ingenier?a Electr?nica > Ingenier?a en Sistemas Electr?nicos > Tel. 58081280, 0445534661338 > E-mail fabian.trobles at gmail.com, dae.wong at gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.budin at kitware.com Tue Sep 12 08:55:03 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 12 Sep 2017 08:55:03 -0400 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: <1505209284609-0.post@n2.nabble.com> References: <1505209284609-0.post@n2.nabble.com> Message-ID: Hello Antoine, What you are doing is correct. What I would do is that I would use the smallest value of the spacing and create an isotropic output image (similar to what you are doing with setting your output spacing to {0.1,0.1,0.1}, but in an automatic manner. The only reason I can think of why you are getting an enterely black output image is maybe because your output image space does not cover your transformed image. If you decrease the spacing, you also need to adjust the image size to make sure that your transformed image will be contained in the output image space. I created a project a long time ago that computes the output image space based on an input image and a transform [1]. Maybe looking at that project will help you. Hope this helps, Francois [1] https://github.com/fbudin69500/ITKTransformTools/blob/master/GetNewSizeAndOrigin.cxx On Tue, Sep 12, 2017 at 5:41 AM, g2 wrote: > Hi all, > > I am trying to rotate in 3D with a arbitrary rotation matrix a 3D image > with > non uniform spacing (0.15, 0.15, 0.19). I am currently using > itk::AffineTransform because at some point in the future I would like to > introduce a translation. My question is about the spacing of the output > image. Since my rotation matrix can be anything, I cannot just re-use the > spacing of my original image. I actually do not care to much about the > output spacing, it can be the same, it can be isotropic, whatever as long > as > the data makes sense. > > here is a bit of code of what I've done so far: > > typedef itk::Image Image3d; > Image3d::Pointer itkImage = getImageSomehow(); > typedef itk::AffineTransform TransformType; > TransformType::Pointer Rt = TransformType::New(); > TransformType::ParametersType params(12); > for (int i = 0; i < 9; i++){ > params[i] = R[i/3][i%3]; // R is the rotation matrix of type > double[3][3] > } > params[9] = 0; > params[10] = 0; > params[11] = 0; > > Rt->SetParameters(params); > > typedef itk::ResampleImageFilter FilterType; > FilterType::Pointer filter = FilterType::New(); > typedef itk::NearestNeighborInterpolateImageFunction > InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > filter->SetInterpolator(interpolator); > filter->SetDefaultPixelValue(255); > filter->SetOutputOrigin(itkImage->GetOrigin()); > filter->SetOutputSpacing(itkImage->GetSpacing()); > //double outSpacing[3] = { 0.1, 0.1, 0.1 }; > //filter->SetOutputSpacing(outSpacing); > filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); > filter->SetOutputDirection(itkImage->GetDirection()); > filter->SetInput(itkImage); > filter->SetTransform(Rt); > filter->Update(); > > > After this when I save filter->GetOutput() and open it with IKT-Snap I can > see my new image properly rotated. But it has the same spacing as the input > image, as specified with filter->SetOutputSpacing(itkImage->GetSpacing()); > and to me this doesn't make sense. The axes are rotated and so should be > the > spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). The > output image is all black. I'm confused because to me those values are not > more erroneous than a plain copy of the input spacing. > > Questions : > I want to rotate a generic 3D image with anisotropic spacing with a generic > rotation matrix (i.e. not around a single axis and not with a n*90? angle) > so that any physical point P in the original volumes maps to R*P in the > final one. How should I proceed ? > > thanks > > > > -- > Sent from: http://itk-insight-users.2283740.n2.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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.letouzey at gmail.com Tue Sep 12 10:43:15 2017 From: antoine.letouzey at gmail.com (Antoine) Date: Tue, 12 Sep 2017 16:43:15 +0200 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> Message-ID: Hi Francois, This was an issue indeed. Varying the isotropic spacing to from {0.1,0.1,0.1} to {0.5, 0.5, 0.5} I can see the corresponding output images "drift" as the spacing increase. That covers the black image. My next issue is to get pixel coordinates of a 3d point P'_pix in physical space after transformation, when all I know about that point is its physical position P_phys before rotation. Mathematically it's quite straightforward in physical space: P'_phys = R*P_phys But then I need to convert this to pixel coordinates. I tried using filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); but the result unsatisfactory, the output coordinates is far from what I read by pointing at the same point in ITK-Snap. The result I get are not off by much but they are not close either. ie (21,891,1027) against (319, 22, 210). compare to the code shown above I've tried setting filter output origin and direction not to the ones of the input image but to their rotated variant. Bellow is some pseudo-code that illustrate this. filter->SetOutputOrigin(R*itkImage->GetOrigin()); filter->SetOutputDirection(R*itkImage->GetDirection()); Ultimately my goal is to crop a region of 1cm around a arbitrary 3D segment. Knowing only the physical position of the segment end points. See my awesome drawing for a 2D example of what I try to achieve. https://i.imgur.com/39l3raP.png Before cropping the image I need to re-orient it so that the segment aligns with one of the image axis, I chose X (1,0,0) but it doesn't matter. I got that part working, as I can see my segment aligned with the chosen axis in the temporary output image. Also I know computing such a rotation is an under-constrained problem and there are an infinity of solutions, but I'm fine with any of those. But now I struggle getting proper "start" and "size" values for this piece of code coming afterward: Image3d::IndexType start; Image3d::SizeType size; //--- // missing code to get start and size right, in pixel space. //--- Image3d::RegionType desiredRegion(start, size); typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; CropFilterType::Pointer cropFilter = CropFilterType::New(); cropFilter->SetExtractionRegion(desiredRegion); cropFilter->SetInput(filter->GetOutput()); cropFilter->SetDirectionCollapseToIdentity(); cropFilter->Update(); Image3d::Pointer cropOut = cropFilter->GetOutput(); when I set by hand pixel values I read from ITK-snap for start and size, this works like a charm. But I struggle to get those values automatiocally. Cheers, A. https://i.imgur.com/39l3raP.png 2017-09-12 14:55 GMT+02:00 Francois Budin : > Hello Antoine, > > What you are doing is correct. What I would do is that I would use the > smallest value of the spacing and create an isotropic output image (similar > to what you are doing with setting your output spacing to {0.1,0.1,0.1}, > but in an automatic manner. > The only reason I can think of why you are getting an enterely black > output image is maybe because your output image space does not cover your > transformed image. If you decrease the spacing, you also need to adjust the > image size to make sure that your transformed image will be contained in > the output image space. > I created a project a long time ago that computes the output image space > based on an input image and a transform [1]. Maybe looking at that project > will help you. > > Hope this helps, > Francois > > [1] https://github.com/fbudin69500/ITKTransformTools/blob/master/ > GetNewSizeAndOrigin.cxx > > On Tue, Sep 12, 2017 at 5:41 AM, g2 wrote: > >> Hi all, >> >> I am trying to rotate in 3D with a arbitrary rotation matrix a 3D image >> with >> non uniform spacing (0.15, 0.15, 0.19). I am currently using >> itk::AffineTransform because at some point in the future I would like to >> introduce a translation. My question is about the spacing of the output >> image. Since my rotation matrix can be anything, I cannot just re-use the >> spacing of my original image. I actually do not care to much about the >> output spacing, it can be the same, it can be isotropic, whatever as long >> as >> the data makes sense. >> >> here is a bit of code of what I've done so far: >> >> typedef itk::Image Image3d; >> Image3d::Pointer itkImage = getImageSomehow(); >> typedef itk::AffineTransform TransformType; >> TransformType::Pointer Rt = TransformType::New(); >> TransformType::ParametersType params(12); >> for (int i = 0; i < 9; i++){ >> params[i] = R[i/3][i%3]; // R is the rotation matrix of type >> double[3][3] >> } >> params[9] = 0; >> params[10] = 0; >> params[11] = 0; >> >> Rt->SetParameters(params); >> >> typedef itk::ResampleImageFilter FilterType; >> FilterType::Pointer filter = FilterType::New(); >> typedef itk::NearestNeighborInterpolateImageFunction >> InterpolatorType; >> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >> filter->SetInterpolator(interpolator); >> filter->SetDefaultPixelValue(255); >> filter->SetOutputOrigin(itkImage->GetOrigin()); >> filter->SetOutputSpacing(itkImage->GetSpacing()); >> //double outSpacing[3] = { 0.1, 0.1, 0.1 }; >> //filter->SetOutputSpacing(outSpacing); >> filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); >> filter->SetOutputDirection(itkImage->GetDirection()); >> filter->SetInput(itkImage); >> filter->SetTransform(Rt); >> filter->Update(); >> >> >> After this when I save filter->GetOutput() and open it with IKT-Snap I can >> see my new image properly rotated. But it has the same spacing as the >> input >> image, as specified with filter->SetOutputSpacing(itkIm >> age->GetSpacing()); >> and to me this doesn't make sense. The axes are rotated and so should be >> the >> spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). The >> output image is all black. I'm confused because to me those values are not >> more erroneous than a plain copy of the input spacing. >> >> Questions : >> I want to rotate a generic 3D image with anisotropic spacing with a >> generic >> rotation matrix (i.e. not around a single axis and not with a n*90? angle) >> so that any physical point P in the original volumes maps to R*P in the >> final one. How should I proceed ? >> >> thanks >> >> >> >> -- >> Sent from: http://itk-insight-users.2283740.n2.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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Tue Sep 12 11:13:02 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Tue, 12 Sep 2017 11:13:02 -0400 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> Message-ID: Hi Antoine, filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); should work, but it can only be called after filter->Update(); If this does not resolve your issue, can you provide a complete example with some data? Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Tue, Sep 12, 2017 at 10:43 AM, Antoine wrote: > Hi Francois, > > This was an issue indeed. Varying the isotropic spacing to from > {0.1,0.1,0.1} to {0.5, 0.5, 0.5} I can see the corresponding output images > "drift" as the spacing increase. That covers the black image. > > > My next issue is to get pixel coordinates of a 3d point P'_pix in physical > space after transformation, when all I know about that point is its > physical position P_phys before rotation. > > Mathematically it's quite straightforward in physical space: > P'_phys = R*P_phys > > But then I need to convert this to pixel coordinates. I tried > using filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); > but the result unsatisfactory, the output coordinates is far from what I > read by pointing at the same point in ITK-Snap. > The result I get are not off by much but they are not close either. ie > (21,891,1027) against (319, 22, 210). > > compare to the code shown above I've tried setting filter output origin > and direction not to the ones of the input image but to their rotated > variant. Bellow is some pseudo-code that illustrate this. > filter->SetOutputOrigin(R*itkImage->GetOrigin()); > filter->SetOutputDirection(R*itkImage->GetDirection()); > > > Ultimately my goal is to crop a region of 1cm around a arbitrary 3D > segment. Knowing only the physical position of the segment end points. See > my awesome drawing for a 2D example of what I try to achieve. > https://i.imgur.com/39l3raP.png > Before cropping the image I need to re-orient it so that the segment > aligns with one of the image axis, I chose X (1,0,0) but it doesn't > matter. I got that part working, as I can see my segment aligned with the > chosen axis in the temporary output image. Also I know computing such a > rotation is an under-constrained problem and there are an infinity of > solutions, but I'm fine with any of those. > > But now I struggle getting proper "start" and "size" values for this piece > of code coming afterward: > > Image3d::IndexType start; > Image3d::SizeType size; > > //--- > // missing code to get start and size right, in pixel space. > //--- > > Image3d::RegionType desiredRegion(start, size); > typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; > CropFilterType::Pointer cropFilter = CropFilterType::New(); > cropFilter->SetExtractionRegion(desiredRegion); > cropFilter->SetInput(filter->GetOutput()); > cropFilter->SetDirectionCollapseToIdentity(); > cropFilter->Update(); > Image3d::Pointer cropOut = cropFilter->GetOutput(); > > > when I set by hand pixel values I read from ITK-snap for start and size, > this works like a charm. But I struggle to get those values automatiocally. > > > Cheers, > > A. > > https://i.imgur.com/39l3raP.png > > > 2017-09-12 14:55 GMT+02:00 Francois Budin : > >> Hello Antoine, >> >> What you are doing is correct. What I would do is that I would use the >> smallest value of the spacing and create an isotropic output image (similar >> to what you are doing with setting your output spacing to {0.1,0.1,0.1}, >> but in an automatic manner. >> The only reason I can think of why you are getting an enterely black >> output image is maybe because your output image space does not cover your >> transformed image. If you decrease the spacing, you also need to adjust the >> image size to make sure that your transformed image will be contained in >> the output image space. >> I created a project a long time ago that computes the output image space >> based on an input image and a transform [1]. Maybe looking at that project >> will help you. >> >> Hope this helps, >> Francois >> >> [1] https://github.com/fbudin69500/ITKTransformTools/blob/ >> master/GetNewSizeAndOrigin.cxx >> >> On Tue, Sep 12, 2017 at 5:41 AM, g2 wrote: >> >>> Hi all, >>> >>> I am trying to rotate in 3D with a arbitrary rotation matrix a 3D image >>> with >>> non uniform spacing (0.15, 0.15, 0.19). I am currently using >>> itk::AffineTransform because at some point in the future I would like to >>> introduce a translation. My question is about the spacing of the output >>> image. Since my rotation matrix can be anything, I cannot just re-use the >>> spacing of my original image. I actually do not care to much about the >>> output spacing, it can be the same, it can be isotropic, whatever as >>> long as >>> the data makes sense. >>> >>> here is a bit of code of what I've done so far: >>> >>> typedef itk::Image Image3d; >>> Image3d::Pointer itkImage = getImageSomehow(); >>> typedef itk::AffineTransform TransformType; >>> TransformType::Pointer Rt = TransformType::New(); >>> TransformType::ParametersType params(12); >>> for (int i = 0; i < 9; i++){ >>> params[i] = R[i/3][i%3]; // R is the rotation matrix of type >>> double[3][3] >>> } >>> params[9] = 0; >>> params[10] = 0; >>> params[11] = 0; >>> >>> Rt->SetParameters(params); >>> >>> typedef itk::ResampleImageFilter FilterType; >>> FilterType::Pointer filter = FilterType::New(); >>> typedef itk::NearestNeighborInterpolateImageFunction >>> InterpolatorType; >>> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >>> filter->SetInterpolator(interpolator); >>> filter->SetDefaultPixelValue(255); >>> filter->SetOutputOrigin(itkImage->GetOrigin()); >>> filter->SetOutputSpacing(itkImage->GetSpacing()); >>> //double outSpacing[3] = { 0.1, 0.1, 0.1 }; >>> //filter->SetOutputSpacing(outSpacing); >>> filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); >>> filter->SetOutputDirection(itkImage->GetDirection()); >>> filter->SetInput(itkImage); >>> filter->SetTransform(Rt); >>> filter->Update(); >>> >>> >>> After this when I save filter->GetOutput() and open it with IKT-Snap I >>> can >>> see my new image properly rotated. But it has the same spacing as the >>> input >>> image, as specified with filter->SetOutputSpacing(itkIm >>> age->GetSpacing()); >>> and to me this doesn't make sense. The axes are rotated and so should be >>> the >>> spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). >>> The >>> output image is all black. I'm confused because to me those values are >>> not >>> more erroneous than a plain copy of the input spacing. >>> >>> Questions : >>> I want to rotate a generic 3D image with anisotropic spacing with a >>> generic >>> rotation matrix (i.e. not around a single axis and not with a n*90? >>> angle) >>> so that any physical point P in the original volumes maps to R*P in the >>> final one. How should I proceed ? >>> >>> thanks >>> >>> >>> >>> -- >>> Sent from: http://itk-insight-users.2283740.n2.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 >>> >> >> > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.letouzey at gmail.com Tue Sep 12 11:33:46 2017 From: antoine.letouzey at gmail.com (Antoine) Date: Tue, 12 Sep 2017 17:33:46 +0200 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> Message-ID: Hi D?enan, I do call filter->Update() before filter->GetOutput()-> TransformPhysicalPointToIndex(Pp, Pp_pix). I'll try to get you a meaningful volume data along with a standalone piece of code by tomorrow. (company code + anonymous medical data = cannot share as is). And I guess it's going to help me get things straight and clean. thanks for your interest. A. 2017-09-12 17:13 GMT+02:00 D?enan Zuki? : > Hi Antoine, > > filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); should > work, but it can only be called after filter->Update(); > > If this does not resolve your issue, can you provide a complete example > with some data? > > Regards, > D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) > > On Tue, Sep 12, 2017 at 10:43 AM, Antoine > wrote: > >> Hi Francois, >> >> This was an issue indeed. Varying the isotropic spacing to from >> {0.1,0.1,0.1} to {0.5, 0.5, 0.5} I can see the corresponding output images >> "drift" as the spacing increase. That covers the black image. >> >> >> My next issue is to get pixel coordinates of a 3d point P'_pix in >> physical space after transformation, when all I know about that point is >> its physical position P_phys before rotation. >> >> Mathematically it's quite straightforward in physical space: >> P'_phys = R*P_phys >> >> But then I need to convert this to pixel coordinates. I tried >> using filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); >> but the result unsatisfactory, the output coordinates is far from what I >> read by pointing at the same point in ITK-Snap. >> The result I get are not off by much but they are not close either. ie >> (21,891,1027) against (319, 22, 210). >> >> compare to the code shown above I've tried setting filter output origin >> and direction not to the ones of the input image but to their rotated >> variant. Bellow is some pseudo-code that illustrate this. >> filter->SetOutputOrigin(R*itkImage->GetOrigin()); >> filter->SetOutputDirection(R*itkImage->GetDirection()); >> >> >> Ultimately my goal is to crop a region of 1cm around a arbitrary 3D >> segment. Knowing only the physical position of the segment end points. See >> my awesome drawing for a 2D example of what I try to achieve. >> https://i.imgur.com/39l3raP.png >> Before cropping the image I need to re-orient it so that the segment >> aligns with one of the image axis, I chose X (1,0,0) but it doesn't >> matter. I got that part working, as I can see my segment aligned with the >> chosen axis in the temporary output image. Also I know computing such a >> rotation is an under-constrained problem and there are an infinity of >> solutions, but I'm fine with any of those. >> >> But now I struggle getting proper "start" and "size" values for this >> piece of code coming afterward: >> >> Image3d::IndexType start; >> Image3d::SizeType size; >> >> //--- >> // missing code to get start and size right, in pixel space. >> //--- >> >> Image3d::RegionType desiredRegion(start, size); >> typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; >> CropFilterType::Pointer cropFilter = CropFilterType::New(); >> cropFilter->SetExtractionRegion(desiredRegion); >> cropFilter->SetInput(filter->GetOutput()); >> cropFilter->SetDirectionCollapseToIdentity(); >> cropFilter->Update(); >> Image3d::Pointer cropOut = cropFilter->GetOutput(); >> >> >> when I set by hand pixel values I read from ITK-snap for start and size, >> this works like a charm. But I struggle to get those values automatiocally. >> >> >> Cheers, >> >> A. >> >> https://i.imgur.com/39l3raP.png >> >> >> 2017-09-12 14:55 GMT+02:00 Francois Budin : >> >>> Hello Antoine, >>> >>> What you are doing is correct. What I would do is that I would use the >>> smallest value of the spacing and create an isotropic output image (similar >>> to what you are doing with setting your output spacing to {0.1,0.1,0.1}, >>> but in an automatic manner. >>> The only reason I can think of why you are getting an enterely black >>> output image is maybe because your output image space does not cover your >>> transformed image. If you decrease the spacing, you also need to adjust the >>> image size to make sure that your transformed image will be contained in >>> the output image space. >>> I created a project a long time ago that computes the output image space >>> based on an input image and a transform [1]. Maybe looking at that project >>> will help you. >>> >>> Hope this helps, >>> Francois >>> >>> [1] https://github.com/fbudin69500/ITKTransformTools/blob/master >>> /GetNewSizeAndOrigin.cxx >>> >>> On Tue, Sep 12, 2017 at 5:41 AM, g2 wrote: >>> >>>> Hi all, >>>> >>>> I am trying to rotate in 3D with a arbitrary rotation matrix a 3D image >>>> with >>>> non uniform spacing (0.15, 0.15, 0.19). I am currently using >>>> itk::AffineTransform because at some point in the future I would like to >>>> introduce a translation. My question is about the spacing of the output >>>> image. Since my rotation matrix can be anything, I cannot just re-use >>>> the >>>> spacing of my original image. I actually do not care to much about the >>>> output spacing, it can be the same, it can be isotropic, whatever as >>>> long as >>>> the data makes sense. >>>> >>>> here is a bit of code of what I've done so far: >>>> >>>> typedef itk::Image Image3d; >>>> Image3d::Pointer itkImage = getImageSomehow(); >>>> typedef itk::AffineTransform TransformType; >>>> TransformType::Pointer Rt = TransformType::New(); >>>> TransformType::ParametersType params(12); >>>> for (int i = 0; i < 9; i++){ >>>> params[i] = R[i/3][i%3]; // R is the rotation matrix of type >>>> double[3][3] >>>> } >>>> params[9] = 0; >>>> params[10] = 0; >>>> params[11] = 0; >>>> >>>> Rt->SetParameters(params); >>>> >>>> typedef itk::ResampleImageFilter FilterType; >>>> FilterType::Pointer filter = FilterType::New(); >>>> typedef itk::NearestNeighborInterpolateImageFunction >>>> InterpolatorType; >>>> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >>>> filter->SetInterpolator(interpolator); >>>> filter->SetDefaultPixelValue(255); >>>> filter->SetOutputOrigin(itkImage->GetOrigin()); >>>> filter->SetOutputSpacing(itkImage->GetSpacing()); >>>> //double outSpacing[3] = { 0.1, 0.1, 0.1 }; >>>> //filter->SetOutputSpacing(outSpacing); >>>> filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); >>>> filter->SetOutputDirection(itkImage->GetDirection()); >>>> filter->SetInput(itkImage); >>>> filter->SetTransform(Rt); >>>> filter->Update(); >>>> >>>> >>>> After this when I save filter->GetOutput() and open it with IKT-Snap I >>>> can >>>> see my new image properly rotated. But it has the same spacing as the >>>> input >>>> image, as specified with filter->SetOutputSpacing(itkIm >>>> age->GetSpacing()); >>>> and to me this doesn't make sense. The axes are rotated and so should >>>> be the >>>> spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). >>>> The >>>> output image is all black. I'm confused because to me those values are >>>> not >>>> more erroneous than a plain copy of the input spacing. >>>> >>>> Questions : >>>> I want to rotate a generic 3D image with anisotropic spacing with a >>>> generic >>>> rotation matrix (i.e. not around a single axis and not with a n*90? >>>> angle) >>>> so that any physical point P in the original volumes maps to R*P in the >>>> final one. How should I proceed ? >>>> >>>> thanks >>>> >>>> >>>> >>>> -- >>>> Sent from: http://itk-insight-users.2283740.n2.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 >>>> >>> >>> >> >> _____________________________________ >> 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.budin at kitware.com Tue Sep 12 14:11:40 2017 From: francois.budin at kitware.com (Francois Budin) Date: Tue, 12 Sep 2017 14:11:40 -0400 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> Message-ID: Hello Antoine, I think you are missing a step in your computation: 1) You need to trnasform your point before rotation to find its position after transformation. You can directly use the affine transform for that: affineTransform->TransformPoint(my_point) 2) Compute the index of the transformed point: filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); I think you forgot to compute 1) Hope this helps, Francois On Tue, Sep 12, 2017 at 11:33 AM, Antoine wrote: > Hi D?enan, > I do call filter->Update() before filter->GetOutput()->Tr > ansformPhysicalPointToIndex(Pp, Pp_pix). > > I'll try to get you a meaningful volume data along with a standalone piece > of code by tomorrow. (company code + anonymous medical data = cannot share > as is). And I guess it's going to help me get things straight and clean. > > thanks for your interest. > > A. > > > > 2017-09-12 17:13 GMT+02:00 D?enan Zuki? : > >> Hi Antoine, >> >> filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); should >> work, but it can only be called after filter->Update(); >> >> If this does not resolve your issue, can you provide a complete example >> with some data? >> >> Regards, >> D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) >> >> On Tue, Sep 12, 2017 at 10:43 AM, Antoine >> wrote: >> >>> Hi Francois, >>> >>> This was an issue indeed. Varying the isotropic spacing to from >>> {0.1,0.1,0.1} to {0.5, 0.5, 0.5} I can see the corresponding output images >>> "drift" as the spacing increase. That covers the black image. >>> >>> >>> My next issue is to get pixel coordinates of a 3d point P'_pix in >>> physical space after transformation, when all I know about that point is >>> its physical position P_phys before rotation. >>> >>> Mathematically it's quite straightforward in physical space: >>> P'_phys = R*P_phys >>> >>> But then I need to convert this to pixel coordinates. I tried >>> using filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); >>> but the result unsatisfactory, the output coordinates is far from what >>> I read by pointing at the same point in ITK-Snap. >>> The result I get are not off by much but they are not close either. ie >>> (21,891,1027) against (319, 22, 210). >>> >>> compare to the code shown above I've tried setting filter output origin >>> and direction not to the ones of the input image but to their rotated >>> variant. Bellow is some pseudo-code that illustrate this. >>> filter->SetOutputOrigin(R*itkImage->GetOrigin()); >>> filter->SetOutputDirection(R*itkImage->GetDirection()); >>> >>> >>> Ultimately my goal is to crop a region of 1cm around a arbitrary 3D >>> segment. Knowing only the physical position of the segment end points. See >>> my awesome drawing for a 2D example of what I try to achieve. >>> https://i.imgur.com/39l3raP.png >>> Before cropping the image I need to re-orient it so that the segment >>> aligns with one of the image axis, I chose X (1,0,0) but it doesn't >>> matter. I got that part working, as I can see my segment aligned with the >>> chosen axis in the temporary output image. Also I know computing such a >>> rotation is an under-constrained problem and there are an infinity of >>> solutions, but I'm fine with any of those. >>> >>> But now I struggle getting proper "start" and "size" values for this >>> piece of code coming afterward: >>> >>> Image3d::IndexType start; >>> Image3d::SizeType size; >>> >>> //--- >>> // missing code to get start and size right, in pixel space. >>> //--- >>> >>> Image3d::RegionType desiredRegion(start, size); >>> typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; >>> CropFilterType::Pointer cropFilter = CropFilterType::New(); >>> cropFilter->SetExtractionRegion(desiredRegion); >>> cropFilter->SetInput(filter->GetOutput()); >>> cropFilter->SetDirectionCollapseToIdentity(); >>> cropFilter->Update(); >>> Image3d::Pointer cropOut = cropFilter->GetOutput(); >>> >>> >>> when I set by hand pixel values I read from ITK-snap for start and size, >>> this works like a charm. But I struggle to get those values automatiocally. >>> >>> >>> Cheers, >>> >>> A. >>> >>> https://i.imgur.com/39l3raP.png >>> >>> >>> 2017-09-12 14:55 GMT+02:00 Francois Budin : >>> >>>> Hello Antoine, >>>> >>>> What you are doing is correct. What I would do is that I would use the >>>> smallest value of the spacing and create an isotropic output image (similar >>>> to what you are doing with setting your output spacing to {0.1,0.1,0.1}, >>>> but in an automatic manner. >>>> The only reason I can think of why you are getting an enterely black >>>> output image is maybe because your output image space does not cover your >>>> transformed image. If you decrease the spacing, you also need to adjust the >>>> image size to make sure that your transformed image will be contained in >>>> the output image space. >>>> I created a project a long time ago that computes the output image >>>> space based on an input image and a transform [1]. Maybe looking at that >>>> project will help you. >>>> >>>> Hope this helps, >>>> Francois >>>> >>>> [1] https://github.com/fbudin69500/ITKTransformTools/blob/master >>>> /GetNewSizeAndOrigin.cxx >>>> >>>> On Tue, Sep 12, 2017 at 5:41 AM, g2 wrote: >>>> >>>>> Hi all, >>>>> >>>>> I am trying to rotate in 3D with a arbitrary rotation matrix a 3D >>>>> image with >>>>> non uniform spacing (0.15, 0.15, 0.19). I am currently using >>>>> itk::AffineTransform because at some point in the future I would like >>>>> to >>>>> introduce a translation. My question is about the spacing of the output >>>>> image. Since my rotation matrix can be anything, I cannot just re-use >>>>> the >>>>> spacing of my original image. I actually do not care to much about the >>>>> output spacing, it can be the same, it can be isotropic, whatever as >>>>> long as >>>>> the data makes sense. >>>>> >>>>> here is a bit of code of what I've done so far: >>>>> >>>>> typedef itk::Image Image3d; >>>>> Image3d::Pointer itkImage = getImageSomehow(); >>>>> typedef itk::AffineTransform TransformType; >>>>> TransformType::Pointer Rt = TransformType::New(); >>>>> TransformType::ParametersType params(12); >>>>> for (int i = 0; i < 9; i++){ >>>>> params[i] = R[i/3][i%3]; // R is the rotation matrix of type >>>>> double[3][3] >>>>> } >>>>> params[9] = 0; >>>>> params[10] = 0; >>>>> params[11] = 0; >>>>> >>>>> Rt->SetParameters(params); >>>>> >>>>> typedef itk::ResampleImageFilter FilterType; >>>>> FilterType::Pointer filter = FilterType::New(); >>>>> typedef itk::NearestNeighborInterpolateImageFunction >>>>> InterpolatorType; >>>>> InterpolatorType::Pointer interpolator = InterpolatorType::New(); >>>>> filter->SetInterpolator(interpolator); >>>>> filter->SetDefaultPixelValue(255); >>>>> filter->SetOutputOrigin(itkImage->GetOrigin()); >>>>> filter->SetOutputSpacing(itkImage->GetSpacing()); >>>>> //double outSpacing[3] = { 0.1, 0.1, 0.1 }; >>>>> //filter->SetOutputSpacing(outSpacing); >>>>> filter->SetSize(itkImage->GetLargestPossibleRegion().GetSize()); >>>>> filter->SetOutputDirection(itkImage->GetDirection()); >>>>> filter->SetInput(itkImage); >>>>> filter->SetTransform(Rt); >>>>> filter->Update(); >>>>> >>>>> >>>>> After this when I save filter->GetOutput() and open it with IKT-Snap I >>>>> can >>>>> see my new image properly rotated. But it has the same spacing as the >>>>> input >>>>> image, as specified with filter->SetOutputSpacing(itkIm >>>>> age->GetSpacing()); >>>>> and to me this doesn't make sense. The axes are rotated and so should >>>>> be the >>>>> spacing. When I try to put some other values, such as (0.1, 0.1, 0.1). >>>>> The >>>>> output image is all black. I'm confused because to me those values are >>>>> not >>>>> more erroneous than a plain copy of the input spacing. >>>>> >>>>> Questions : >>>>> I want to rotate a generic 3D image with anisotropic spacing with a >>>>> generic >>>>> rotation matrix (i.e. not around a single axis and not with a n*90? >>>>> angle) >>>>> so that any physical point P in the original volumes maps to R*P in the >>>>> final one. How should I proceed ? >>>>> >>>>> thanks >>>>> >>>>> >>>>> >>>>> -- >>>>> Sent from: http://itk-insight-users.2283740.n2.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 >>>>> >>>> >>>> >>> >>> _____________________________________ >>> 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 >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From blowekamp at mail.nih.gov Tue Sep 12 15:09:23 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Tue, 12 Sep 2017 19:09:23 +0000 Subject: [ITK-users] [ITK] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices? In-Reply-To: <1505212762750-0.post@n7.nabble.com> References: <1504877491197-0.post@n7.nabble.com> <1504881527156-0.post@n7.nabble.com> <1504883604903-0.post@n7.nabble.com> <1505122781018-0.post@n7.nabble.com> <1505212762750-0.post@n7.nabble.com> Message-ID: Thank you for testing the patch, and confirming the non-zero index was the cause. The fix has been merged into ITK master. Brad On 9/12/17, 6:40 AM, "hellman" wrote: I tried shifting the origin such that the input image had region index 0 and then it worked. I also applied the patch http://review.source.kitware.com/#/c/22601/ and now it works also with non-zero region index in my case, so my particular problem is solved by this patch. -- Sent from: http://itk-users.7.n7.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 _______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community From k.dunikowski at pixel.com.pl Wed Sep 13 06:45:48 2017 From: k.dunikowski at pixel.com.pl (Kosma Dunikowski) Date: Wed, 13 Sep 2017 12:45:48 +0200 Subject: [ITK-users] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64) Message-ID: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> Hi, I'm having a problem with swig-generated Java wrappings on both Windows and Linux. I'm getting different method signatures all over the place, e.g: Windows: public void add(long x) { SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); } Linux: public void add(int x) { SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); } Windows: public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) { return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, VectorUInt32.getCPtr(idx), idx); } Linux: public long getPixelAsUInt64(VectorUInt32 idx) { return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, VectorUInt32.getCPtr(idx), idx); } (full diff @ https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing) As you can see there are some differences in data sizes. So far I've tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork mentioned at https://github.com/swig/swig/pull/649 with similar results. I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the latest releases. As for the compilers, I used multiple versions of gcc on Linux and mingw-w64 and Visual Studio on Windows. I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching wrappings but also immediate segfaults after I tried using it. If anyone knows how to tackle this problem, I would greatly appreciate it, since I'm unable to maintain separate Java codebases for different platforms. Best regards, Kosma Dunikowski From antoine.letouzey at gmail.com Wed Sep 13 07:16:44 2017 From: antoine.letouzey at gmail.com (g2) Date: Wed, 13 Sep 2017 04:16:44 -0700 (MST) Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> Message-ID: <1505301404377-0.post@n7.nabble.com> Hello Francois, D?enan, Francois Budin-3 wrote > I think you are missing a step in your computation: > 1) You need to trnasform your point before rotation to find its position > after transformation. You can directly use the affine transform for that: > affineTransform->TransformPoint(my_point) > 2) Compute the index of the transformed point: > filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); > > I think you forgot to compute 1) I did not use the TransformPoint function but I did transform the points using my own matrix multiplication method before using transformPhysicalPointToIndex. And it gives the same results. While cleaning up the code I discovered that the input 3D point I was getting were actually not in proper physical space, they did not take image origin into account, only pixel position * spacing. I'll try to see the implication of that in my code and I'll come back to you. Cheers, A. -- Sent from: http://itk-users.7.n7.nabble.com/ From blowekamp at mail.nih.gov Wed Sep 13 13:14:11 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Wed, 13 Sep 2017 17:14:11 +0000 Subject: [ITK-users] [ITK] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64) In-Reply-To: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> References: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> Message-ID: Hello, That you for posting the issue. Can you please create an issue for this problem in SimpleITK?s Github issue tracker: https://github.com/SimpleITK/SimpleITK/issues I recall looking into this problem some time ago and not being happy with this inconsistent interface for Java that SWIG generated. It should be consistent. There is not much to how we specify the interface for Java, so this is really SWIG will need to be fixed to get our interface proper. Unfortunately, the mixture of type long and BinInteger is complicated since the long type cannot be implicitly converted to a BigInteger. In our generated code for testing we added a class to help with this conversion. Depending on your usage this may be a useful approach. Thanks, Brad On 9/13/17, 6:46 AM, "Kosma Dunikowski" wrote: Hi, I'm having a problem with swig-generated Java wrappings on both Windows and Linux. I'm getting different method signatures all over the place, e.g: Windows: public void add(long x) { SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); } Linux: public void add(int x) { SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); } Windows: public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) { return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, VectorUInt32.getCPtr(idx), idx); } Linux: public long getPixelAsUInt64(VectorUInt32 idx) { return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, VectorUInt32.getCPtr(idx), idx); } (full diff @ https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing) As you can see there are some differences in data sizes. So far I've tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork mentioned at https://github.com/swig/swig/pull/649 with similar results. I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the latest releases. As for the compilers, I used multiple versions of gcc on Linux and mingw-w64 and Visual Studio on Windows. I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching wrappings but also immediate segfaults after I tried using it. If anyone knows how to tackle this problem, I would greatly appreciate it, since I'm unable to maintain separate Java codebases for different platforms. Best regards, Kosma Dunikowski _____________________________________ 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 _______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community From andx_roo at live.com Wed Sep 13 21:46:57 2017 From: andx_roo at live.com (Andaharoo) Date: Wed, 13 Sep 2017 18:46:57 -0700 (MST) Subject: [ITK-users] Problems Using GPU Filters In-Reply-To: References: <1498789176254-7590036.post@n2.nabble.com> <1501002308962-7590057.post@n2.nabble.com> <1501611311517-7590114.post@n2.nabble.com> <1501626181039-7590122.post@n2.nabble.com> Message-ID: <1505353617689-0.post@n2.nabble.com> I pulled the latest branch on github and this issue is still present on all my systems. Here is a clear example of code that does not work. typedef itk::GPUImage GPUImage; typedef itk::Image Image; // Read image with VTK vtkSmartPointer reader = vtkSmartPointer::New(); reader->SetFileName("test.png"); reader->Update(); // Convert VTK to ITK typedef itk::VTKImageToImageFilter VtkToItkFilter; VtkToItkFilter::Pointer vtkToItkFilter = VtkToItkFilter::New(); vtkToItkFilter->SetInput(cast->GetOutput()); vtkToItkFilter->Update(); // GPU Binary Thresholding typedef itk::GPUBinaryThresholdImageFilter GPUBinaryThresholdFilterType; GPUBinaryThresholdFilterType::Pointer binaryThresholdFilter = GPUBinaryThresholdFilterType::New(); binaryThresholdFilter->SetInput(vtkToItkFilter->GetOutput()); binaryThresholdFilter->SetLowerThreshold(150.0); binaryThresholdFilter->SetUpperThreshold(250.0); binaryThresholdFilter->SetOutsideValue(0); binaryThresholdFilter->SetInsideValue(355.0); binaryThresholdFilter->Update(); GPU Gradient Anisotropic is the only gpu filter that works in this example. Probably because it's the only in place gpu filter. I've tried replacing "" with "" as well. With the scenario I get read access violation as GPUDataManager is null. Expect when using gpu gradient anisotropic. With and on the conversion filter, the conversion filter fails to generate data. And as stated in earlier messages, if I first use gpu gradient anisotropic (only gpu filter that works after vtktoitk) I can then successfully apply gpu binary thresholding. I'd look further into the issue but I'm not really sure where gpu images even get allocated so it would be hard for me to debug. Perhaps I can write my own gpu filters using gradient anisotropic as reference. -- Sent from: http://itk-insight-users.2283740.n2.nabble.com/ From swetha.bsharma at gmail.com Thu Sep 14 06:41:24 2017 From: swetha.bsharma at gmail.com (Swetha Sharma) Date: Thu, 14 Sep 2017 16:11:24 +0530 Subject: [ITK-users] Calculate transformation matrix for two vectors Message-ID: Dear All, I would like to calculate a transformation matrix between two vectors using Itk. Right now I am manually calculating the translation parameter between the vector and the angle between the two vectors. Is there any other easy way to find the transformation matrix given the vectors? If not, Is there a function to calculate the rotation matrix given the angle and the axis of rotation is arbitary axis. -swetha -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Thu Sep 14 09:21:57 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 14 Sep 2017 09:21:57 -0400 Subject: [ITK-users] Calculate transformation matrix for two vectors In-Reply-To: References: Message-ID: Hi Swetha, how are your vectors represented? 3 numbers or a pair of points? There is an angle-axis rotation function, Rotate3D . Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Thu, Sep 14, 2017 at 6:41 AM, Swetha Sharma wrote: > Dear All, > > > I would like to calculate a transformation matrix between two vectors > using Itk. Right now I am manually calculating the translation parameter > between the vector and the angle between the two vectors. Is there any > other easy way to find the transformation matrix given the vectors? If not, > Is there a function to calculate the rotation matrix given the angle and > the axis of rotation is arbitary axis. > > -swetha > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From k.dunikowski at pixel.com.pl Thu Sep 14 11:14:57 2017 From: k.dunikowski at pixel.com.pl (Kosma Dunikowski) Date: Thu, 14 Sep 2017 17:14:57 +0200 Subject: [ITK-users] [ITK] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64) In-Reply-To: References: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> Message-ID: <57971db4-da79-4691-df47-d8cf9fa05aa5@pixel.com.pl> Hi again, Thanks for the response. In the end I got to work properly with the forked swig I mentioned (https://github.com/johnwason/swig/tree/java64), after adding #if defined(SWIGWORDSIZE64) %apply unsigned int { size_t }; %apply const unsigned int & { const size_t & }; #endif as recommended by the patch's author. I asked the swig maintainers to consider pulling these changes in. Kosma On 13.09.2017 19:14, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > Hello, > > That you for posting the issue. > > Can you please create an issue for this problem in SimpleITK?s Github issue tracker: > https://github.com/SimpleITK/SimpleITK/issues > > I recall looking into this problem some time ago and not being happy with this inconsistent interface for Java that SWIG generated. It should be consistent. There is not much to how we specify the interface for Java, so this is really SWIG will need to be fixed to get our interface proper. > > Unfortunately, the mixture of type long and BinInteger is complicated since the long type cannot be implicitly converted to a BigInteger. In our generated code for testing we added a class to help with this conversion. Depending on your usage this may be a useful approach. > > Thanks, > Brad > > On 9/13/17, 6:46 AM, "Kosma Dunikowski" wrote: > > Hi, > > I'm having a problem with swig-generated Java wrappings on both Windows > and Linux. I'm getting different method signatures all over the place, e.g: > > Windows: > public void add(long x) { > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > } > > Linux: > public void add(int x) { > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > } > > Windows: > public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) { > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > VectorUInt32.getCPtr(idx), idx); > } > > Linux: > public long getPixelAsUInt64(VectorUInt32 idx) { > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > VectorUInt32.getCPtr(idx), idx); > } > > (full diff @ > https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing) > > As you can see there are some differences in data sizes. So far I've > tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork > mentioned at https://github.com/swig/swig/pull/649 with similar results. > I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the > latest releases. As for the compilers, I used multiple versions of gcc > on Linux and mingw-w64 and Visual Studio on Windows. > > I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled > if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching > wrappings but also immediate segfaults after I tried using it. > > If anyone knows how to tackle this problem, I would greatly appreciate > it, since I'm unable to maintain separate Java codebases for different > platforms. > > Best regards, > > Kosma Dunikowski > > _____________________________________ > 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 > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > From blowekamp at mail.nih.gov Thu Sep 14 11:19:04 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Thu, 14 Sep 2017 15:19:04 +0000 Subject: [ITK-users] [ITK] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64) In-Reply-To: <57971db4-da79-4691-df47-d8cf9fa05aa5@pixel.com.pl> References: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> <57971db4-da79-4691-df47-d8cf9fa05aa5@pixel.com.pl> Message-ID: <9F625F52-E383-4BBC-9A78-732FF800433A@mail.nih.gov> Can you please create an issue on SimpleITK github issue tracker? Where did you add that SWIG code too? Thanks, Brad On 9/14/17, 11:16 AM, "Kosma Dunikowski" wrote: Hi again, Thanks for the response. In the end I got to work properly with the forked swig I mentioned (https://github.com/johnwason/swig/tree/java64), after adding #if defined(SWIGWORDSIZE64) %apply unsigned int { size_t }; %apply const unsigned int & { const size_t & }; #endif as recommended by the patch's author. I asked the swig maintainers to consider pulling these changes in. Kosma On 13.09.2017 19:14, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > Hello, > > That you for posting the issue. > > Can you please create an issue for this problem in SimpleITK?s Github issue tracker: > https://github.com/SimpleITK/SimpleITK/issues > > I recall looking into this problem some time ago and not being happy with this inconsistent interface for Java that SWIG generated. It should be consistent. There is not much to how we specify the interface for Java, so this is really SWIG will need to be fixed to get our interface proper. > > Unfortunately, the mixture of type long and BinInteger is complicated since the long type cannot be implicitly converted to a BigInteger. In our generated code for testing we added a class to help with this conversion. Depending on your usage this may be a useful approach. > > Thanks, > Brad > > On 9/13/17, 6:46 AM, "Kosma Dunikowski" wrote: > > Hi, > > I'm having a problem with swig-generated Java wrappings on both Windows > and Linux. I'm getting different method signatures all over the place, e.g: > > Windows: > public void add(long x) { > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > } > > Linux: > public void add(int x) { > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > } > > Windows: > public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) { > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > VectorUInt32.getCPtr(idx), idx); > } > > Linux: > public long getPixelAsUInt64(VectorUInt32 idx) { > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > VectorUInt32.getCPtr(idx), idx); > } > > (full diff @ > https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing) > > As you can see there are some differences in data sizes. So far I've > tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork > mentioned at https://github.com/swig/swig/pull/649 with similar results. > I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the > latest releases. As for the compilers, I used multiple versions of gcc > on Linux and mingw-w64 and Visual Studio on Windows. > > I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled > if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching > wrappings but also immediate segfaults after I tried using it. > > If anyone knows how to tackle this problem, I would greatly appreciate > it, since I'm unable to maintain separate Java codebases for different > platforms. > > Best regards, > > Kosma Dunikowski > > _____________________________________ > 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 > _______________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > From k.dunikowski at pixel.com.pl Thu Sep 14 11:39:24 2017 From: k.dunikowski at pixel.com.pl (Kosma Dunikowski) Date: Thu, 14 Sep 2017 17:39:24 +0200 Subject: [ITK-users] [ITK] Generating compatible Java wrappings of SimpleITK between Windows and Linux (x86-64) In-Reply-To: <9F625F52-E383-4BBC-9A78-732FF800433A@mail.nih.gov> References: <2c2ee563-f6e9-07f1-8fab-8d3ab72cd15e@pixel.com.pl> <57971db4-da79-4691-df47-d8cf9fa05aa5@pixel.com.pl> <9F625F52-E383-4BBC-9A78-732FF800433A@mail.nih.gov> Message-ID: <688f84a0-8ce8-167e-4e63-8d9c41392f57@pixel.com.pl> I added it to Wrapping/Java/Java.i GitHub issue: https://github.com/SimpleITK/SimpleITK/issues/295 On 14.09.2017 17:19, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > Can you please create an issue on SimpleITK github issue tracker? > > Where did you add that SWIG code too? > > Thanks, > Brad > > On 9/14/17, 11:16 AM, "Kosma Dunikowski" wrote: > > Hi again, > > Thanks for the response. In the end I got to work properly with the > forked swig I mentioned (https://github.com/johnwason/swig/tree/java64), > after adding > > #if defined(SWIGWORDSIZE64) > %apply unsigned int { size_t }; > %apply const unsigned int & { const size_t & }; > #endif > > as recommended by the patch's author. I asked the swig maintainers to > consider pulling these changes in. > > Kosma > > > On 13.09.2017 19:14, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > > Hello, > > > > That you for posting the issue. > > > > Can you please create an issue for this problem in SimpleITK?s Github issue tracker: > > https://github.com/SimpleITK/SimpleITK/issues > > > > I recall looking into this problem some time ago and not being happy with this inconsistent interface for Java that SWIG generated. It should be consistent. There is not much to how we specify the interface for Java, so this is really SWIG will need to be fixed to get our interface proper. > > > > Unfortunately, the mixture of type long and BinInteger is complicated since the long type cannot be implicitly converted to a BigInteger. In our generated code for testing we added a class to help with this conversion. Depending on your usage this may be a useful approach. > > > > Thanks, > > Brad > > > > On 9/13/17, 6:46 AM, "Kosma Dunikowski" wrote: > > > > Hi, > > > > I'm having a problem with swig-generated Java wrappings on both Windows > > and Linux. I'm getting different method signatures all over the place, e.g: > > > > Windows: > > public void add(long x) { > > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > > } > > > > Linux: > > public void add(int x) { > > SimpleITKJNI.VectorInt64_add(swigCPtr, this, x); > > } > > > > Windows: > > public java.math.BigInteger getPixelAsUInt64(VectorUInt32 idx) { > > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > > VectorUInt32.getCPtr(idx), idx); > > } > > > > Linux: > > public long getPixelAsUInt64(VectorUInt32 idx) { > > return SimpleITKJNI.Image_getPixelAsUInt64(swigCPtr, this, > > VectorUInt32.getCPtr(idx), idx); > > } > > > > (full diff @ > > https://drive.google.com/a/pixel.com.pl/file/d/0Bzm8rPONV4SJOTA4R0tHTXFPWms/view?usp=sharing) > > > > As you can see there are some differences in data sizes. So far I've > > tried building it with swig 3.0.8, 3.0.9, 3.0.12 and a patched fork > > mentioned at https://github.com/swig/swig/pull/649 with similar results. > > I'm using ITK v4.10.0 and SimpleITK v0.10.0 but I've also tried the > > latest releases. As for the compilers, I used multiple versions of gcc > > on Linux and mingw-w64 and Visual Studio on Windows. > > > > I've tried manually undefining SWIGWORDSIZE64 on Linux (which is enabled > > if SITK_ULONG_SAME_AS_UINT64 test passes), which resulted in matching > > wrappings but also immediate segfaults after I tried using it. > > > > If anyone knows how to tackle this problem, I would greatly appreciate > > it, since I'm unable to maintain separate Java codebases for different > > platforms. > > > > Best regards, > > > > Kosma Dunikowski > > > > _____________________________________ > > 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 > > _______________________________________________ > > Community mailing list > > Community at itk.org > > http://public.kitware.com/mailman/listinfo/community > > > > > > > From matt.mccormick at kitware.com Thu Sep 14 15:15:14 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Thu, 14 Sep 2017 15:15:14 -0400 Subject: [ITK-users] [ANN] ITK 4.12.2 has been released! Message-ID: On behalf of the Insight Segmentation and Registration Toolkit (ITK) Community, we are happy to announce the release of ITK 4.12.2! ITK is an open-source, cross-platform library for multidimensional image analysis. Release files can be downloaded from http://itk.org/ITK/resources/software.html. This is a patch release that fixes critical issues, regressions, documentation, and compiler support. This release includes better compatibility when building an application that includes additional NIFTI libraries and also fixes for GPGPU build support. Contributions from the 3D Slicer community improve packaging on macOS. The release also includes an update to the ITK Software Guide that adds the coding style guide among other updates and additions. The next feature release, 4.13.0, is scheduled for mid-December. Enjoy ITK! ITK changes from v4.12.1 to v4.12.2: Edwin Bennink (1): BUG: Fixed cylinder bbox, fixed and enhanced IsInside func Floris Berendsen (1): COMP: add symbol name mangling for niftilib in ITK Jean-Christophe Fillion-Robin (2): COMP: Update MINC to set MACOSX_RPATH property based on CMAKE_MACOSX_RPATH COMP: Update KWsys to set MACOSX_RPATH property based on CMAKE_MACOSX_RPATH Matthew McCormick (6): BUG: Correct GPUMeanImageFilter Superclass BUG: Remove debug code from GPUMeanImageFilter BUG: Do not use static_cast, SmartPointer in GPUImage::GetGPUDataManager BUG: Remove debug code in itkGPUImage.hxx COMP: Fix AnisotropicDiffusionLBR example build ENH: Bump CMakeLists.txt version to 4.12.2 Niels Dekker (1): COMP: Fixed leak into user code ITK Software Guide changes: Jon Haitz Legarreta Gorro?o (8): DOC: Add and reference Coding Style appendix. DOC: Fix typo in Registration chapter files headers. STYLE: Replace tabs with white spaces. DOC: Fix typos in the SW guide LaTeX files. ENH: Add the link to the SW Guide PDF compilation version. DOC: Add missing wrap types to Wrapping section. STYLE: Rework the folder structure and rename files. ENH: Remove \ifitkFullVersion artifact switch. Matt McCormick (2): DOC: Add instructions on how to install the stable Python packages ENH: Bump ITK ExternalProject version to 4.12.2 From matt.mccormick at kitware.com Thu Sep 14 15:32:17 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Thu, 14 Sep 2017 15:32:17 -0400 Subject: [ITK-users] Problems Using GPU Filters In-Reply-To: <1505353617689-0.post@n2.nabble.com> References: <1498789176254-7590036.post@n2.nabble.com> <1501002308962-7590057.post@n2.nabble.com> <1501611311517-7590114.post@n2.nabble.com> <1501626181039-7590122.post@n2.nabble.com> <1505353617689-0.post@n2.nabble.com> Message-ID: Thank you for example code and description. To improve performance and reduce memory usage, ITK re-uses memory when possible. For example, many filters have an option to run in place on their inputs. The VTK bridge and GPU filters are special cases that may be conflicting here. The GPU data manager moves ITK memory from the CPU to GPU when required. However, the VTK bridge tries to prevent copying the memory allocated by VTK. There are a few approaches that can be taken. First, consider using itk::ImageFileReader instead of vtkPNGReader then VTKImageToImageFilter. This has the added advantage that it will automatically also support many other file formats. Second, place an ITK filter, like CastImageFilter, after the VTK bridge filter and before the GPU filter. However, may sure to call .InPlaceOff(). If you are considering writing your own GPU filters, you may also be interested in this module [1]. This is a work in progress, but it will allow writing filters that use ArrayFire underneath the hood. ArrayFire is easier to program with than OpenCL, and it is optimized for many GPGPU architectures. [1] https://github.com/InsightSoftwareConsortium/ITKArrayFire On Wed, Sep 13, 2017 at 9:46 PM, Andaharoo wrote: > I pulled the latest branch on github and this issue is still present on all > my systems. Here is a clear example of code that does not work. > > typedef itk::GPUImage GPUImage; > typedef itk::Image Image; > > // Read image with VTK > vtkSmartPointer reader = vtkSmartPointer::New(); > reader->SetFileName("test.png"); > reader->Update(); > > // Convert VTK to ITK > typedef itk::VTKImageToImageFilter VtkToItkFilter; > VtkToItkFilter::Pointer vtkToItkFilter = VtkToItkFilter::New(); > vtkToItkFilter->SetInput(cast->GetOutput()); > vtkToItkFilter->Update(); > > // GPU Binary Thresholding > typedef itk::GPUBinaryThresholdImageFilter > GPUBinaryThresholdFilterType; > GPUBinaryThresholdFilterType::Pointer binaryThresholdFilter = > GPUBinaryThresholdFilterType::New(); > binaryThresholdFilter->SetInput(vtkToItkFilter->GetOutput()); > binaryThresholdFilter->SetLowerThreshold(150.0); > binaryThresholdFilter->SetUpperThreshold(250.0); > binaryThresholdFilter->SetOutsideValue(0); > binaryThresholdFilter->SetInsideValue(355.0); > binaryThresholdFilter->Update(); > > GPU Gradient Anisotropic is the only gpu filter that works in this example. > Probably because it's the only in place gpu filter. I've tried replacing > "" with "" as well. > > With the scenario I get read access violation as > GPUDataManager is null. Expect when using gpu gradient anisotropic. > > With and on the conversion filter, the > conversion filter fails to generate data. > > And as stated in earlier messages, if I first use gpu gradient anisotropic > (only gpu filter that works after vtktoitk) I can then successfully apply > gpu binary thresholding. > I'd look further into the issue but I'm not really sure where gpu images > even get allocated so it would be hard for me to debug. Perhaps I can write > my own gpu filters using gradient anisotropic as reference. > > > > -- > Sent from: http://itk-insight-users.2283740.n2.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 From zhuangming.shen at sphic.org.cn Thu Sep 14 20:46:57 2017 From: zhuangming.shen at sphic.org.cn (=?gb2312?B?yfLXr8P3?=) Date: Fri, 15 Sep 2017 00:46:57 +0000 Subject: [ITK-users] Suggestion for itk::BoundingBox Message-ID: <1505436450589.98090@sphic.org.cn> Hi all, Bounding box is a very useful functionality for me. I suggest whether itk::BoundingBox can provide an API which will directly output a binary image. For the binary image, pixels/voxels inside the bounding box are represented as 1, other pixels/voxels outside the bounding box are represented as 0. Regards, Zhuangming Shen -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.letouzey at gmail.com Fri Sep 15 07:14:43 2017 From: antoine.letouzey at gmail.com (Antoine) Date: Fri, 15 Sep 2017 13:14:43 +0200 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: <1505301404377-0.post@n7.nabble.com> References: <1505209284609-0.post@n2.nabble.com> <1505301404377-0.post@n7.nabble.com> Message-ID: OK I got it to work by changing my approach. As I wasn't able to get the rotation and translation working in a single pass, I divided my algorithm in two steps : - a translation so that my initial point is in the center of the image. - a rotation around the center of the image with the given rotation matrix As a pre-processing I also reset the origin of my input image to be (0,0,0), this values is then restored afterward, but it simplified a lot of things for me. This solved also the issue of guessing the size of my output image when the feature I'm interested in is far from the center. By applying a translation first I know that it's going to stay centred after the rotation and I do not need to worry about my area of interest ending up out of bounds. After these two steps I can crop from the center of the image and along the X axis (see drawing from two posts above). Obviously two re-sampling filters instead of one is bad practice. But in my case it's done only once so it's not an issue. here is a final bit of code doing exactly that : // input data : typedef itk::Image Image3d; Image3d::PointType P1 = somePoint(); Image3d::Pointer itkImage = someImage(); double R[3][3] = someRotationMatrix(); auto inSize = itkImage->GetLargestPossibleRegion().GetSize(); Image3d::PointType origin = itkImage->GetOrigin(); origin.Fill(0); itkImage->SetOrigin(origin); //--- translate image typedef itk::TranslationTransform TranslationTransformType; TranslationTransformType::Pointer transform_t = TranslationTransformType::New(); TranslationTransformType::OutputVectorType translation; Image3d::PointType offset; offset.Fill(0); Image3d::IndexType centerPix; for (int i = 0; i < 3; i++) centerPix[i] = inSize[i] / 2; Image3d::PointType centerPhysical; itkImage->TransformIndexToPhysicalPoint(centerPix, centerPhysical); offset = P1 - centerPhysical; translation[0] = offset[0]; translation[1] = offset[1]; translation[2] = offset[2]; transform_t->Translate(translation); typedef itk::ResampleImageFilter ResampleImageFilterType; ResampleImageFilterType::Pointer resampleFilter_t = ResampleImageFilterType::New(); resampleFilter_t->SetTransform(transform_t.GetPointer()); resampleFilter_t->SetInput(itkImage); double outSpacing[3] = { 0.3, 0.3, 0.3 }; resampleFilter_t->SetOutputSpacing(outSpacing); for (int i = 0; i < 3; i++) inSize[i] *= itkImage->GetSpacing()[i] / outSpacing[i]; resampleFilter_t->SetSize(inSize); resampleFilter_t->SetDefaultPixelValue(255); resampleFilter_t->Update(); Image3d::Pointer translatedImg = resampleFilter_t->GetOutput(); //--- rotate translated image typedef itk::FixedCenterOfRotationAffineTransform TransformType; TransformType::Pointer Rt = TransformType::New(); TransformType::ParametersType params(12); params.Fill(0); for (int i = 0; i < 9; i++) params[i] = R[i/3][i%3]; // R[i%3][i/3] == R.tranpsose , switch % and / to alternate between R and R.t Rt->SetParameters(params); Image3d::PointType rotcenter; for (int i = 0; i < 3; i++) centerPix[i] = inSize[i] / 2.; translatedImg->TransformIndexToPhysicalPoint(centerPix, rotcenter); Rt->SetCenter(rotcenter); typedef itk::ResampleImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); typedef itk::NearestNeighborInterpolateImageFunction InterpolatorType; InterpolatorType::Pointer interpolator = InterpolatorType::New(); filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue(255); filter->SetOutputOrigin(origin); filter->SetOutputSpacing(outSpacing); filter->SetSize(inSize); filter->SetInput(translatedImg); filter->SetTransform(Rt); filter->Update(); Image3d::Pointer rotatedImg = filter->GetOutput(); //--- crop Image3d::IndexType start; Image3d::SizeType size; start.Fill(0); size.Fill(10); start = centerPix; start[1] -= 10 / rotatedImg->GetSpacing()[1]; // 1cm bellow in Y start[2] -= 10 / rotatedImg->GetSpacing()[2]; // 1cm bellow in Z size[0] = axis.length() / rotatedImg->GetSpacing()[0]; // axis lenght in X size[1] = 20 / rotatedImg->GetSpacing()[1]; // 2cm in Y size[2] = 20 / rotatedImg->GetSpacing()[2]; // 2cm in Z Image3d::RegionType desiredRegion(start, size); typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; CropFilterType::Pointer cropFilter = CropFilterType::New(); cropFilter->SetExtractionRegion(desiredRegion); cropFilter->SetInput(rotatedImg); cropFilter->SetDirectionCollapseToIdentity(); cropFilter->Update(); Image3d::Pointer cropOut = cropFilter->GetOutput(); cropOut->SetRegions(cropOut->GetLargestPossibleRegion().GetSize()); Thanks again for the help, A. 2017-09-13 13:16 GMT+02:00 g2 : > Hello Francois, D?enan, > > > Francois Budin-3 wrote > > I think you are missing a step in your computation: > > 1) You need to trnasform your point before rotation to find its position > > after transformation. You can directly use the affine transform for that: > > affineTransform->TransformPoint(my_point) > > 2) Compute the index of the transformed point: > > filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); > > > > I think you forgot to compute 1) > > I did not use the TransformPoint function but I did transform the points > using my own matrix multiplication method before using > transformPhysicalPointToIndex. And it gives the same results. > > > > While cleaning up the code I discovered that the input 3D point I was > getting were actually not in proper physical space, they did not take image > origin into account, only pixel position * spacing. I'll try to see the > implication of that in my code and I'll come back to you. > > Cheers, > A. > > > > > -- > Sent from: http://itk-users.7.n7.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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.budin at kitware.com Fri Sep 15 09:06:01 2017 From: francois.budin at kitware.com (Francois Budin) Date: Fri, 15 Sep 2017 09:06:01 -0400 Subject: [ITK-users] Rotation of anisotropic 3D image In-Reply-To: References: <1505209284609-0.post@n2.nabble.com> <1505301404377-0.post@n7.nabble.com> Message-ID: Thanks for sharing your final code! On Fri, Sep 15, 2017 at 7:14 AM, Antoine wrote: > OK I got it to work by changing my approach. > As I wasn't able to get the rotation and translation working in a single > pass, I divided my algorithm in two steps : > - a translation so that my initial point is in the center of the image. > - a rotation around the center of the image with the given rotation matrix > > As a pre-processing I also reset the origin of my input image to be > (0,0,0), this values is then restored afterward, but it simplified a lot of > things for me. > This solved also the issue of guessing the size of my output image when > the feature I'm interested in is far from the center. By applying a > translation first I know that it's going to stay centred after the rotation > and I do not need to worry about my area of interest ending up out of > bounds. After these two steps I can crop from the center of the image and > along the X axis (see drawing from two posts above). > Obviously two re-sampling filters instead of one is bad practice. But in > my case it's done only once so it's not an issue. > > here is a final bit of code doing exactly that : > > > // input data : > typedef itk::Image Image3d; > Image3d::PointType P1 = somePoint(); > Image3d::Pointer itkImage = someImage(); > double R[3][3] = someRotationMatrix(); > auto inSize = itkImage->GetLargestPossibleRegion().GetSize(); > Image3d::PointType origin = itkImage->GetOrigin(); > origin.Fill(0); > itkImage->SetOrigin(origin); > > //--- translate image > typedef itk::TranslationTransform TranslationTransformType; > TranslationTransformType::Pointer transform_t = > TranslationTransformType::New(); > TranslationTransformType::OutputVectorType translation; > > Image3d::PointType offset; > offset.Fill(0); > Image3d::IndexType centerPix; > for (int i = 0; i < 3; i++) centerPix[i] = inSize[i] / 2; > Image3d::PointType centerPhysical; > itkImage->TransformIndexToPhysicalPoint(centerPix, centerPhysical); > offset = P1 - centerPhysical; > translation[0] = offset[0]; > translation[1] = offset[1]; > translation[2] = offset[2]; > transform_t->Translate(translation); > > typedef itk::ResampleImageFilter > ResampleImageFilterType; > ResampleImageFilterType::Pointer resampleFilter_t = > ResampleImageFilterType::New(); > resampleFilter_t->SetTransform(transform_t.GetPointer()); > resampleFilter_t->SetInput(itkImage); > double outSpacing[3] = { 0.3, 0.3, 0.3 }; > resampleFilter_t->SetOutputSpacing(outSpacing); > for (int i = 0; i < 3; i++) inSize[i] *= itkImage->GetSpacing()[i] / > outSpacing[i]; > resampleFilter_t->SetSize(inSize); > resampleFilter_t->SetDefaultPixelValue(255); > resampleFilter_t->Update(); > Image3d::Pointer translatedImg = resampleFilter_t->GetOutput(); > > > > //--- rotate translated image > typedef itk::FixedCenterOfRotationAffineTransform > TransformType; > TransformType::Pointer Rt = TransformType::New(); > TransformType::ParametersType params(12); > params.Fill(0); > for (int i = 0; i < 9; i++) params[i] = R[i/3][i%3]; // R[i%3][i/3] == > R.tranpsose , switch % and / to alternate between R and R.t > > Rt->SetParameters(params); > Image3d::PointType rotcenter; > for (int i = 0; i < 3; i++) centerPix[i] = inSize[i] / 2.; > translatedImg->TransformIndexToPhysicalPoint(centerPix, rotcenter); > Rt->SetCenter(rotcenter); > > typedef itk::ResampleImageFilter FilterType; > FilterType::Pointer filter = FilterType::New(); > typedef itk::NearestNeighborInterpolateImageFunction > InterpolatorType; > InterpolatorType::Pointer interpolator = InterpolatorType::New(); > filter->SetInterpolator(interpolator); > filter->SetDefaultPixelValue(255); > filter->SetOutputOrigin(origin); > filter->SetOutputSpacing(outSpacing); > filter->SetSize(inSize); > filter->SetInput(translatedImg); > filter->SetTransform(Rt); > filter->Update(); > > Image3d::Pointer rotatedImg = filter->GetOutput(); > > //--- crop > Image3d::IndexType start; > Image3d::SizeType size; > > start.Fill(0); > size.Fill(10); > > start = centerPix; > start[1] -= 10 / rotatedImg->GetSpacing()[1]; // 1cm bellow in Y > start[2] -= 10 / rotatedImg->GetSpacing()[2]; // 1cm bellow in Z > size[0] = axis.length() / rotatedImg->GetSpacing()[0]; // axis lenght in X > size[1] = 20 / rotatedImg->GetSpacing()[1]; // 2cm in Y > size[2] = 20 / rotatedImg->GetSpacing()[2]; // 2cm in Z > > Image3d::RegionType desiredRegion(start, size); > typedef itk::ExtractImageFilter< Image3d, Image3d > CropFilterType; > CropFilterType::Pointer cropFilter = CropFilterType::New(); > cropFilter->SetExtractionRegion(desiredRegion); > cropFilter->SetInput(rotatedImg); > cropFilter->SetDirectionCollapseToIdentity(); > cropFilter->Update(); > Image3d::Pointer cropOut = cropFilter->GetOutput(); > cropOut->SetRegions(cropOut->GetLargestPossibleRegion().GetSize()); > > > Thanks again for the help, > A. > > > 2017-09-13 13:16 GMT+02:00 g2 : > >> Hello Francois, D?enan, >> >> >> Francois Budin-3 wrote >> > I think you are missing a step in your computation: >> > 1) You need to trnasform your point before rotation to find its position >> > after transformation. You can directly use the affine transform for >> that: >> > affineTransform->TransformPoint(my_point) >> > 2) Compute the index of the transformed point: >> > filter->GetOutput()->TransformPhysicalPointToIndex(Pp, Pp_pix); >> > >> > I think you forgot to compute 1) >> >> I did not use the TransformPoint function but I did transform the points >> using my own matrix multiplication method before using >> transformPhysicalPointToIndex. And it gives the same results. >> >> >> >> While cleaning up the code I discovered that the input 3D point I was >> getting were actually not in proper physical space, they did not take >> image >> origin into account, only pixel position * spacing. I'll try to see the >> implication of that in my code and I'll come back to you. >> >> Cheers, >> A. >> >> >> >> >> -- >> Sent from: http://itk-users.7.n7.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 >> > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.budin at kitware.com Fri Sep 15 09:10:47 2017 From: francois.budin at kitware.com (Francois Budin) Date: Fri, 15 Sep 2017 09:10:47 -0400 Subject: [ITK-users] Suggestion for itk::BoundingBox In-Reply-To: <1505436450589.98090@sphic.org.cn> References: <1505436450589.98090@sphic.org.cn> Message-ID: Hello Zhuangming Shen, Thanks for suggesting new functionalities. Could you add that suggestion on JIRA [1], the bug tracking system ITK uses. Thanks, Francois [1] https://issues.itk.org/jira/secure/Dashboard.jspa On Thu, Sep 14, 2017 at 8:46 PM, ??? wrote: > Hi all, > > > Bounding box is a very useful functionality for me. I suggest whether > itk::BoundingBox can provide an API which will directly output a binary > image. For the binary image, pixels/voxels inside the bounding box are > represented as 1, other pixels/voxels outside the bounding box are > represented as 0. > > > > Regards, > > > Zhuangming Shen > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Fri Sep 15 09:50:43 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 15 Sep 2017 09:50:43 -0400 Subject: [ITK-users] Suggestion for itk::BoundingBox In-Reply-To: References: <1505436450589.98090@sphic.org.cn> Message-ID: Hi Zhuangming Shen, itk::Region already has IsInside method. A method which returns an image with all 1s inside the region, and 0s outside is a big functionality overlap with IsInside method, and probably too specific to be worth maintaining it in the long term. You can add it as a feature request, but I doubt anyone will implement that: those competent enough to implement it will not see a big need for it, and those who see the need for it are probably not competent enough to implement it :) It would be a good exercise if you tried to implement it yourself. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Fri, Sep 15, 2017 at 9:10 AM, Francois Budin wrote: > Hello Zhuangming Shen, > > Thanks for suggesting new functionalities. Could you add that suggestion > on JIRA [1], the bug tracking system ITK uses. > > Thanks, > Francois > [1] https://issues.itk.org/jira/secure/Dashboard.jspa > > On Thu, Sep 14, 2017 at 8:46 PM, ??? wrote: > >> Hi all, >> >> >> Bounding box is a very useful functionality for me. I suggest whether >> itk::BoundingBox can provide an API which will directly output a binary >> image. For the binary image, pixels/voxels inside the bounding box are >> represented as 1, other pixels/voxels outside the bounding box are >> represented as 0. >> >> >> >> Regards, >> >> >> Zhuangming Shen >> >> _____________________________________ >> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zhuangming.shen at sphic.org.cn Fri Sep 15 09:56:24 2017 From: zhuangming.shen at sphic.org.cn (=?utf-8?B?5rKI5bqE5piO?=) Date: Fri, 15 Sep 2017 13:56:24 +0000 Subject: [ITK-users] Suggestion for itk::BoundingBox In-Reply-To: References: <1505436450589.98090@sphic.org.cn> , Message-ID: <1505483808150.21368@sphic.org.cn> Hi Francois and D?enan, Thanks for your advises. I have created a feature request. https://issues.itk.org/jira/browse/ITK-3567? Regards, Zhuangming Shen ________________________________ From: D?enan Zuki? Sent: Friday, September 15, 2017 9:50 PM To: Francois Budin Cc: ???; insight-users at itk.org Subject: Re: [ITK-users] Suggestion for itk::BoundingBox Hi Zhuangming Shen, itk::Region already has IsInside method. A method which returns an image with all 1s inside the region, and 0s outside is a big functionality overlap with IsInside method, and probably too specific to be worth maintaining it in the long term. You can add it as a feature request, but I doubt anyone will implement that: those competent enough to implement it will not see a big need for it, and those who see the need for it are probably not competent enough to implement it :) It would be a good exercise if you tried to implement it yourself. Regards, D?enan Zuki?, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.) On Fri, Sep 15, 2017 at 9:10 AM, Francois Budin > wrote: Hello Zhuangming Shen, Thanks for suggesting new functionalities. Could you add that suggestion on JIRA [1], the bug tracking system ITK uses. Thanks, Francois [1] https://issues.itk.org/jira/secure/Dashboard.jspa On Thu, Sep 14, 2017 at 8:46 PM, ??? > wrote: Hi all, Bounding box is a very useful functionality for me. I suggest whether itk::BoundingBox can provide an API which will directly output a binary image. For the binary image, pixels/voxels inside the bounding box are represented as 1, other pixels/voxels outside the bounding box are represented as 0. Regards, Zhuangming Shen _____________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From niels-xtk at xs4all.nl Fri Sep 15 10:54:13 2017 From: niels-xtk at xs4all.nl (Niels Dekker) Date: Fri, 15 Sep 2017 16:54:13 +0200 Subject: [ITK-users] [ITK] [ANN] ITK 4.12.2 has been released! In-Reply-To: References: Message-ID: <1a4b0fa6dd288fc7f2b6188d6aabc7b2@xs4all.nl> Thank you very much, Matt! Two very small nitpicks: https://itk.org/ITK/resources/software.html still says "The current release is version 4.12.1". And the last commit at https://github.com/Kitware/ITK/tree/v4.12.2 mistakenly says: "ENH: Bump CMakeLists.txt version to 4.12.1" But it doesn't matter, as the tag itself is correctly tagging v4.12.2. And I'm very happy to see that the NIFTI fixes that I asked for are in there :-) Kind regards, Niels On 2017-09-14 21:15, Matt McCormick wrote: > On behalf of the Insight Segmentation and Registration Toolkit (ITK) > Community, we are happy to announce the release of ITK 4.12.2! > > ITK is an open-source, cross-platform library for multidimensional > image analysis. > > Release files can be downloaded from > > http://itk.org/ITK/resources/software.html. > > This is a patch release that fixes critical issues, regressions, > documentation, and compiler support. This release includes better > compatibility when building an application that includes additional > NIFTI libraries and also fixes for GPGPU build support. Contributions > from the 3D Slicer community improve packaging on macOS. > > The release also includes an update to the ITK Software Guide that > adds the coding style guide among other updates and additions. > > The next feature release, 4.13.0, is scheduled for mid-December. > > Enjoy ITK! > > > ITK changes from v4.12.1 to v4.12.2: > > Edwin Bennink (1): > BUG: Fixed cylinder bbox, fixed and enhanced IsInside func > > Floris Berendsen (1): > COMP: add symbol name mangling for niftilib in ITK > > Jean-Christophe Fillion-Robin (2): > COMP: Update MINC to set MACOSX_RPATH property based on > CMAKE_MACOSX_RPATH > COMP: Update KWsys to set MACOSX_RPATH property based on > CMAKE_MACOSX_RPATH > > Matthew McCormick (6): > BUG: Correct GPUMeanImageFilter Superclass > BUG: Remove debug code from GPUMeanImageFilter > BUG: Do not use static_cast, SmartPointer in > GPUImage::GetGPUDataManager > BUG: Remove debug code in itkGPUImage.hxx > COMP: Fix AnisotropicDiffusionLBR example build > ENH: Bump CMakeLists.txt version to 4.12.2 > > Niels Dekker (1): > COMP: Fixed leak into user code > > > ITK Software Guide changes: > > Jon Haitz Legarreta Gorro?o (8): > DOC: Add and reference Coding Style appendix. > DOC: Fix typo in Registration chapter files headers. > STYLE: Replace tabs with white spaces. > DOC: Fix typos in the SW guide LaTeX files. > ENH: Add the link to the SW Guide PDF compilation version. > DOC: Add missing wrap types to Wrapping section. > STYLE: Rework the folder structure and rename files. > ENH: Remove \ifitkFullVersion artifact switch. > > Matt McCormick (2): > DOC: Add instructions on how to install the stable Python > packages > ENH: Bump ITK ExternalProject version to 4.12.2 -- Niels Dekker Scientific programmer LKEB, Leiden University Medical Center, Netherlands From matt.mccormick at kitware.com Fri Sep 15 11:00:20 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Fri, 15 Sep 2017 11:00:20 -0400 Subject: [ITK-users] [ITK-dev] [ITK] [ANN] ITK 4.12.2 has been released! In-Reply-To: <1a4b0fa6dd288fc7f2b6188d6aabc7b2@xs4all.nl> References: <1a4b0fa6dd288fc7f2b6188d6aabc7b2@xs4all.nl> Message-ID: On Fri, Sep 15, 2017 at 10:54 AM, Niels Dekker wrote: > Thank you very much, Matt! > > Two very small nitpicks: > > https://itk.org/ITK/resources/software.html still says "The current release > is version 4.12.1". Thanks for the note. We'll correct that. > And the last commit at https://github.com/Kitware/ITK/tree/v4.12.2 > mistakenly says: "ENH: Bump CMakeLists.txt version to 4.12.1" But it doesn't > matter, as the tag itself is correctly tagging v4.12.2. Yes, the commit message is wrong, but the tag is correct. I also moved the previous v4.12.1 tag so it points to the correct commit. > And I'm very happy to see that the NIFTI fixes that I asked for are in there > :-) Thanks again for the contribution, and sorry we did not get it in the first time around. From asertyuio at yahoo.fr Mon Sep 18 19:41:53 2017 From: asertyuio at yahoo.fr (asertyuio) Date: Tue, 19 Sep 2017 01:41:53 +0200 Subject: [ITK-users] multiresolution v4 and label images Message-ID: <0a6b928f-40e4-1a99-db4f-2bfdbae5caa4@yahoo.fr> Hi everyone, I have some BW images to register.? I was using the Amoeba optimizer, and the match cardinality metric, but I would like to add multiresolution, and I would prefer using the v4 registration. I'm not fully sure, but my impression is that I cannot do it through the v4 registration, because the metric/optimizer are not implemented in the v4 registration. Is there any metric/optimizer combination in the v4 framework recommended for BW images ? Thanks in advance, Yann From matt.mccormick at kitware.com Tue Sep 19 10:21:20 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Tue, 19 Sep 2017 10:21:20 -0400 Subject: [ITK-users] multiresolution v4 and label images In-Reply-To: <0a6b928f-40e4-1a99-db4f-2bfdbae5caa4@yahoo.fr> References: <0a6b928f-40e4-1a99-db4f-2bfdbae5caa4@yahoo.fr> Message-ID: Hi Yann, A MeanSquaresImageToImageMetricv4 could be applied. The images could be passed through a distance map filter to get better results. Hope this helps, Matt On Mon, Sep 18, 2017 at 7:41 PM, asertyuio via Insight-users wrote: > Hi everyone, > > I have some BW images to register. I was using the Amoeba optimizer, > and the match cardinality metric, but I would like to add > multiresolution, and I would prefer using the v4 registration. I'm not > fully sure, but my impression is that I cannot do it through the v4 > registration, because the metric/optimizer are not implemented in the v4 > registration. Is there any metric/optimizer combination in the v4 > framework recommended for BW images ? > > Thanks in advance, > > Yann > > _____________________________________ > 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 From thanosxania at gmail.com Wed Sep 20 10:20:57 2017 From: thanosxania at gmail.com (thanos) Date: Wed, 20 Sep 2017 07:20:57 -0700 (MST) Subject: [ITK-users] New Submission: ND morphological contour interpolation In-Reply-To: <20160822071136.020FE3D620D3@insight-journal.org> References: <20160822071136.020FE3D620D3@insight-journal.org> Message-ID: <1505917257724-0.post@n2.nabble.com> Hello, Is there maybe an example for the morphological contour interpolation? I am working on Matlab for the segmentation of some 3D data and since I am currently segmenting semi-automatically slice by slice, it would be great if I could use this class.. I also have a quite silly question.. I am aware about the "test" folder and data but I don't really understand what is used for... I had a look on the Software Guide on the chapter "How to create a module" but I still don't get it.. Thank you very much. Best regards, Thanos -- Sent from: http://itk-insight-users.2283740.n2.nabble.com/ From lasso at queensu.ca Wed Sep 20 12:25:05 2017 From: lasso at queensu.ca (Andras Lasso) Date: Wed, 20 Sep 2017 16:25:05 +0000 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: <1505917257724-0.post@n2.nabble.com> References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: If you want to see what the morphological contour interpolation filter can do, then download nightly version of 3D Slicer (www.slicer.org) and try "Fill between slices" effect. Some information about the tool is available at http://slicer.readthedocs.io/en/latest/user_guide/module_segmenteditor.html, but if you are stuck at any point then you can ask help at https://discourse.slicer.org - all questions are answered, typically within a few hours. Andras -----Original Message----- From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos Sent: Wednesday, September 20, 2017 10:21 AM To: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Hello, Is there maybe an example for the morphological contour interpolation? I am working on Matlab for the segmentation of some 3D data and since I am currently segmenting semi-automatically slice by slice, it would be great if I could use this class.. I also have a quite silly question.. I am aware about the "test" folder and data but I don't really understand what is used for... I had a look on the Software Guide on the chapter "How to create a module" but I still don't get it.. Thank you very much. Best regards, Thanos -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com%2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 _____________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw%2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 Kitware offers ITK Training Courses, for more information visit: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 Please keep messages on-topic and check the ITK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=%2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Finsight-users&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B%2FXsCBpxdS4S9ocZhBI%3D&reserved=0 _______________________________________________ Community mailing list Community at itk.org https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcommunity&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T9JKATsOVjjbos%3D&reserved=0 From thanosxania at gmail.com Thu Sep 21 08:21:39 2017 From: thanosxania at gmail.com (thanos thanos) Date: Thu, 21 Sep 2017 14:21:39 +0200 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: Hello Andras, Thank you very much for your answer. I already tried Slicer and the Segment Editor and it works fine. I was wondering if I can make an executable that I could use for my data (for example an .nrrd segmented volume with some slices missing). Best regards, Thanos On Wed, Sep 20, 2017 at 6:25 PM, Andras Lasso wrote: > If you want to see what the morphological contour interpolation filter can > do, then download nightly version of 3D Slicer (www.slicer.org) and try > "Fill between slices" effect. Some information about the tool is available > at http://slicer.readthedocs.io/en/latest/user_guide/module_ > segmenteditor.html, but if you are stuck at any point then you can ask > help at https://discourse.slicer.org - all questions are answered, > typically within a few hours. > > Andras > > -----Original Message----- > From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos > Sent: Wednesday, September 20, 2017 10:21 AM > To: insight-users at itk.org > Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > Hello, > > Is there maybe an example for the morphological contour interpolation? > I am working on Matlab for the segmentation of some 3D data and since I am > currently segmenting semi-automatically slice by slice, it would be great > if I could use this class.. > I also have a quite silly question.. I am aware about the "test" folder > and data but I don't really understand what is used for... I had a look on > the Software Guide on the chapter "How to create a module" but I still > don't get it.. > > Thank you very much. > > Best regards, > Thanos > > > > -- > Sent from: https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com% > 2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 > _____________________________________ > Powered by https://na01.safelinks.protection.outlook.com/?url= > www.kitware.com&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw% > 2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 > > Visit other Kitware open-source projects at > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource. > html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 > > Kitware offers ITK Training Courses, for more information visit: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php& > data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > 9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 > > Please keep messages on-topic and check the ITK FAQ at: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01% > 7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=% > 2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 > > Follow this link to subscribe/unsubscribe: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Finsight-users&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B% > 2FXsCBpxdS4S9ocZhBI%3D&reserved=0 > _______________________________________________ > Community mailing list > Community at itk.org > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Fcommunity&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T > 9JKATsOVjjbos%3D&reserved=0 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Thu Sep 21 09:27:02 2017 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 21 Sep 2017 13:27:02 +0000 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: It should be easy to write an executable like that. It can be either a standalone executable, or ? if you want to use other effects or you don?t want to set up a build environment on multiple platforms and create distribution mechanism (software download page and/or app store) ? then you can do it using 3D Slicer and a small Python script. See for example how to apply a Segment Editor effect in a script here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script How the rest of your pipeline is implemented (image loading, visualization, contouring, etc)? Andras From: thanos thanos [mailto:thanosxania at gmail.com] Sent: Thursday, September 21, 2017 8:22 AM To: Andras Lasso Cc: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Hello Andras, Thank you very much for your answer. I already tried Slicer and the Segment Editor and it works fine. I was wondering if I can make an executable that I could use for my data (for example an .nrrd segmented volume with some slices missing). Best regards, Thanos On Wed, Sep 20, 2017 at 6:25 PM, Andras Lasso > wrote: If you want to see what the morphological contour interpolation filter can do, then download nightly version of 3D Slicer (www.slicer.org) and try "Fill between slices" effect. Some information about the tool is available at http://slicer.readthedocs.io/en/latest/user_guide/module_segmenteditor.html, but if you are stuck at any point then you can ask help at https://discourse.slicer.org - all questions are answered, typically within a few hours. Andras -----Original Message----- From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos Sent: Wednesday, September 20, 2017 10:21 AM To: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Hello, Is there maybe an example for the morphological contour interpolation? I am working on Matlab for the segmentation of some 3D data and since I am currently segmenting semi-automatically slice by slice, it would be great if I could use this class.. I also have a quite silly question.. I am aware about the "test" folder and data but I don't really understand what is used for... I had a look on the Software Guide on the chapter "How to create a module" but I still don't get it.. Thank you very much. Best regards, Thanos -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com%2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 _____________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw%2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 Kitware offers ITK Training Courses, for more information visit: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 Please keep messages on-topic and check the ITK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=%2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Finsight-users&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B%2FXsCBpxdS4S9ocZhBI%3D&reserved=0 _______________________________________________ Community mailing list Community at itk.org https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcommunity&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T9JKATsOVjjbos%3D&reserved=0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From thanosxania at gmail.com Thu Sep 21 09:58:21 2017 From: thanosxania at gmail.com (thanos thanos) Date: Thu, 21 Sep 2017 15:58:21 +0200 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: Thank you for your reply! I have some binary data which I load in Matlab and I reshape them to obtain my 3D image. I perform 2D semi-automatic segmentation (based on active contours and b-splines) where I obtain both the curve as a set of points as well as binary images which I then multiple with my original image. I then use isosurfaces to get the 3D model. What I want is to avoid performing the semi-automatic segmentation on each slice so I thought of creating a binary 3D model with missing slices and then do the interpolation. I will study now the "grow from seeds effect" and working with scripts on Slicer since I haven't done this before.. Best, Thanos On Thu, Sep 21, 2017 at 3:27 PM, Andras Lasso wrote: > It should be easy to write an executable like that. It can be either a > standalone executable, or ? if you want to use other effects or you don?t > want to set up a build environment on multiple platforms and create > distribution mechanism (software download page and/or app store) ? then you > can do it using 3D Slicer and a small Python script. See for example how to > apply a Segment Editor effect in a script here: > https://www.slicer.org/wiki/Documentation/Nightly/ > ScriptRepository#How_to_run_segment_editor_effects_from_a_script > > > > How the rest of your pipeline is implemented (image loading, > visualization, contouring, etc)? > > > > Andras > > > > *From:* thanos thanos [mailto:thanosxania at gmail.com] > *Sent:* Thursday, September 21, 2017 8:22 AM > *To:* Andras Lasso > *Cc:* insight-users at itk.org > > *Subject:* Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > > > Hello Andras, > > > > Thank you very much for your answer. I already tried Slicer and the > Segment Editor and it works fine. I was wondering if I can make an > executable that I could use for my data (for example an .nrrd segmented > volume with some slices missing). > > > > Best regards, > > Thanos > > > > On Wed, Sep 20, 2017 at 6:25 PM, Andras Lasso wrote: > > If you want to see what the morphological contour interpolation filter can > do, then download nightly version of 3D Slicer (www.slicer.org > ) > and try "Fill between slices" effect. Some information about the tool is > available at http://slicer.readthedocs.io/en/latest/user_guide/module_ > segmenteditor.html > , > but if you are stuck at any point then you can ask help at > https://discourse.slicer.org > > - all questions are answered, typically within a few hours. > > Andras > > -----Original Message----- > From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos > Sent: Wednesday, September 20, 2017 10:21 AM > To: insight-users at itk.org > Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > Hello, > > Is there maybe an example for the morphological contour interpolation? > I am working on Matlab for the segmentation of some 3D data and since I am > currently segmenting semi-automatically slice by slice, it would be great > if I could use this class.. > I also have a quite silly question.. I am aware about the "test" folder > and data but I don't really understand what is used for... I had a look on > the Software Guide on the chapter "How to create a module" but I still > don't get it.. > > Thank you very much. > > Best regards, > Thanos > > > > -- > Sent from: https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com% > 2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 > _____________________________________ > Powered by https://na01.safelinks.protection.outlook.com/?url= > www.kitware.com&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw% > 2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 > > Visit other Kitware open-source projects at > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource. > html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 > > Kitware offers ITK Training Courses, for more information visit: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php& > data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > 9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 > > Please keep messages on-topic and check the ITK FAQ at: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01% > 7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=% > 2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 > > Follow this link to subscribe/unsubscribe: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Finsight-users&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B% > 2FXsCBpxdS4S9ocZhBI%3D&reserved=0 > _______________________________________________ > Community mailing list > Community at itk.org > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Fcommunity&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T > 9JKATsOVjjbos%3D&reserved=0 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lasso at queensu.ca Thu Sep 21 10:15:53 2017 From: lasso at queensu.ca (Andras Lasso) Date: Thu, 21 Sep 2017 14:15:53 +0000 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: Matlab is (was) a nice platform from algorithm prototyping, but implementing user interface in Matlab even for basic tasks, such as DICOM image import, reslicing, surface, volume visualization, etc. is a lot of work. I would recommend using 3D Slicer as user interface and running algorithms that you have implemented in Matlab using Slicer?s MatlabBridge (https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge). With growing popularity of Python and increasing number and quality of Python packages, Matlab is getting more and more irrelevant. I would recommend switching to Python as soon as you can. For example, you could easily put together algorithm prototypes that use ITK, as most (all?) ITK is already available in Python. Andras From: thanos thanos [mailto:thanosxania at gmail.com] Sent: Thursday, September 21, 2017 9:58 AM To: Andras Lasso Cc: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Thank you for your reply! I have some binary data which I load in Matlab and I reshape them to obtain my 3D image. I perform 2D semi-automatic segmentation (based on active contours and b-splines) where I obtain both the curve as a set of points as well as binary images which I then multiple with my original image. I then use isosurfaces to get the 3D model. What I want is to avoid performing the semi-automatic segmentation on each slice so I thought of creating a binary 3D model with missing slices and then do the interpolation. I will study now the "grow from seeds effect" and working with scripts on Slicer since I haven't done this before.. Best, Thanos On Thu, Sep 21, 2017 at 3:27 PM, Andras Lasso > wrote: It should be easy to write an executable like that. It can be either a standalone executable, or ? if you want to use other effects or you don?t want to set up a build environment on multiple platforms and create distribution mechanism (software download page and/or app store) ? then you can do it using 3D Slicer and a small Python script. See for example how to apply a Segment Editor effect in a script here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script How the rest of your pipeline is implemented (image loading, visualization, contouring, etc)? Andras From: thanos thanos [mailto:thanosxania at gmail.com] Sent: Thursday, September 21, 2017 8:22 AM To: Andras Lasso > Cc: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Hello Andras, Thank you very much for your answer. I already tried Slicer and the Segment Editor and it works fine. I was wondering if I can make an executable that I could use for my data (for example an .nrrd segmented volume with some slices missing). Best regards, Thanos On Wed, Sep 20, 2017 at 6:25 PM, Andras Lasso > wrote: If you want to see what the morphological contour interpolation filter can do, then download nightly version of 3D Slicer (www.slicer.org) and try "Fill between slices" effect. Some information about the tool is available at http://slicer.readthedocs.io/en/latest/user_guide/module_segmenteditor.html, but if you are stuck at any point then you can ask help at https://discourse.slicer.org - all questions are answered, typically within a few hours. Andras -----Original Message----- From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos Sent: Wednesday, September 20, 2017 10:21 AM To: insight-users at itk.org Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour interpolation Hello, Is there maybe an example for the morphological contour interpolation? I am working on Matlab for the segmentation of some 3D data and since I am currently segmenting semi-automatically slice by slice, it would be great if I could use this class.. I also have a quite silly question.. I am aware about the "test" folder and data but I don't really understand what is used for... I had a look on the Software Guide on the chapter "How to create a module" but I still don't get it.. Thank you very much. Best regards, Thanos -- Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com%2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 _____________________________________ Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw%2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 Kitware offers ITK Training Courses, for more information visit: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 Please keep messages on-topic and check the ITK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=%2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 Follow this link to subscribe/unsubscribe: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Finsight-users&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B%2FXsCBpxdS4S9ocZhBI%3D&reserved=0 _______________________________________________ Community mailing list Community at itk.org https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fcommunity&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T9JKATsOVjjbos%3D&reserved=0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Thu Sep 21 15:25:50 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 21 Sep 2017 15:25:50 -0400 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: Hi Thanos, here is a short and easy-to-understand example. The input is an image with some slices segmented, the output is an image with the missing slices interpolated. If smoothing radius is provided, it is used. I will test this a bit more and integrate into the repository, per Matt's suggestion. Regards, D?enan On Thu, Sep 21, 2017 at 10:15 AM, Andras Lasso wrote: > Matlab is (was) a nice platform from algorithm prototyping, but > implementing user interface in Matlab even for basic tasks, such as DICOM > image import, reslicing, surface, volume visualization, etc. is a lot of > work. I would recommend using 3D Slicer as user interface and running > algorithms that you have implemented in Matlab using Slicer?s MatlabBridge ( > https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MatlabBridge > ). > > > > With growing popularity of Python and increasing number and quality of > Python packages, Matlab is getting more and more irrelevant. I would > recommend switching to Python as soon as you can. For example, you could > easily put together algorithm prototypes that use ITK, as most (all?) ITK > is already available in Python. > > > > Andras > > > > *From:* thanos thanos [mailto:thanosxania at gmail.com] > *Sent:* Thursday, September 21, 2017 9:58 AM > > *To:* Andras Lasso > *Cc:* insight-users at itk.org > *Subject:* Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > > > Thank you for your reply! > I have some binary data which I load in Matlab and I reshape them to > obtain my 3D image. I perform 2D semi-automatic segmentation (based on > active contours and b-splines) where I obtain both the curve as a set of > points as well as binary images which I then multiple with my original > image. I then use isosurfaces to get the 3D model. > > What I want is to avoid performing the semi-automatic segmentation on each > slice so I thought of creating a binary 3D model with missing slices and > then do the interpolation. I will study now the "grow from seeds effect" > and working with scripts on Slicer since I haven't done this before.. > > > > Best, > > Thanos > > > > On Thu, Sep 21, 2017 at 3:27 PM, Andras Lasso wrote: > > It should be easy to write an executable like that. It can be either a > standalone executable, or ? if you want to use other effects or you don?t > want to set up a build environment on multiple platforms and create > distribution mechanism (software download page and/or app store) ? then you > can do it using 3D Slicer and a small Python script. See for example how to > apply a Segment Editor effect in a script here: > https://www.slicer.org/wiki/Documentation/Nightly/ > ScriptRepository#How_to_run_segment_editor_effects_from_a_script > > > > > How the rest of your pipeline is implemented (image loading, > visualization, contouring, etc)? > > > > Andras > > > > *From:* thanos thanos [mailto:thanosxania at gmail.com] > *Sent:* Thursday, September 21, 2017 8:22 AM > *To:* Andras Lasso > *Cc:* insight-users at itk.org > > > *Subject:* Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > > > Hello Andras, > > > > Thank you very much for your answer. I already tried Slicer and the > Segment Editor and it works fine. I was wondering if I can make an > executable that I could use for my data (for example an .nrrd segmented > volume with some slices missing). > > > > Best regards, > > Thanos > > > > On Wed, Sep 20, 2017 at 6:25 PM, Andras Lasso wrote: > > If you want to see what the morphological contour interpolation filter can > do, then download nightly version of 3D Slicer (www.slicer.org > ) > and try "Fill between slices" effect. Some information about the tool is > available at http://slicer.readthedocs.io/en/latest/user_guide/module_ > segmenteditor.html > , > but if you are stuck at any point then you can ask help at > https://discourse.slicer.org > > - all questions are answered, typically within a few hours. > > Andras > > -----Original Message----- > From: Community [mailto:community-bounces at itk.org] On Behalf Of thanos > Sent: Wednesday, September 20, 2017 10:21 AM > To: insight-users at itk.org > Subject: Re: [ITK] [ITK-users] New Submission: ND morphological contour > interpolation > > Hello, > > Is there maybe an example for the morphological contour interpolation? > I am working on Matlab for the segmentation of some 3D data and since I am > currently segmenting semi-automatically slice by slice, it would be great > if I could use this class.. > I also have a quite silly question.. I am aware about the "test" folder > and data but I don't really understand what is used for... I had a look on > the Software Guide on the chapter "How to create a module" but I still > don't get it.. > > Thank you very much. > > Best regards, > Thanos > > > > -- > Sent from: https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fitk-insight-users.2283740.n2.nabble.com% > 2F&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > w8KKHVVNr%2BQU7gU2kx9hlrlI4oQKpSRemCZunUiPHiY%3D&reserved=0 > _____________________________________ > Powered by https://na01.safelinks.protection.outlook.com/?url= > www.kitware.com&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=3GRadntJJVw% > 2BXFixpMl00ZrbMdG89XZ5Ud8E5itiYNs%3D&reserved=0 > > Visit other Kitware open-source projects at > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource. > html&data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > VYlnDSe2Fw31wAWDnhgvnVutXCQrlmSTFy81h5JlYqo%3D&reserved=0 > > Kitware offers ITK Training Courses, for more information visit: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.kitware.com%2Fproducts%2Fprotraining.php& > data=02%7C01%7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata= > 9MblUPjPUyQGNWN%2BVHwqIcF%2Fn2%2BGoYPzJogE8VV%2FCEc%3D&reserved=0 > > Please keep messages on-topic and check the ITK FAQ at: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.itk.org%2FWiki%2FITK_FAQ&data=02%7C01% > 7Classo%40queensu.ca%7C66ffdacfdc7549999e2e08d50032d77e% > 7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636415140716713211&sdata=% > 2BGQeoDNmK1PyueIexmz%2F1%2F4%2BWHDgiWYUGGGaePJMMzo%3D&reserved=0 > > Follow this link to subscribe/unsubscribe: > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Finsight-users&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=jBHTnHY%2BFgrahTGkQ0SBY363B% > 2FXsCBpxdS4S9ocZhBI%3D&reserved=0 > _______________________________________________ > Community mailing list > Community at itk.org > https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo% > 2Fcommunity&data=02%7C01%7Classo%40queensu.ca% > 7C66ffdacfdc7549999e2e08d50032d77e%7Cd61ecb3b38b142d582c4efb2838b > 925c%7C1%7C0%7C636415140716713211&sdata=knp5fEl0ec9s8nSlN2pYITU41RJp3T > 9JKATsOVjjbos%3D&reserved=0 > > > > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: tester.cpp Type: text/x-c++src Size: 1756 bytes Desc: not available URL: From matt.mccormick at kitware.com Thu Sep 21 17:37:44 2017 From: matt.mccormick at kitware.com (Matt McCormick) Date: Thu, 21 Sep 2017 17:37:44 -0400 Subject: [ITK-users] Discourse Message-ID: Hi folks, Following requests from the community, Kitware has graciously hosted a Discourse instance for the community to try as a communication platform. Created by the people behind Stack Overflow, Discourse is a next generation, open source discussion platform that functions as a mailing list, discussion forum, and long-form chat room. Discourse is a simple, modern, and fun platform that facilitates civilized discussions. It has been adopted with great success by open source projects like 3D Slicer and the Julia Language. Please give it a try: https://discourse.itk.org/ There is a Getting Started Guide: https://discourse.itk.org/t/getting-started-with-discourse/22 And a Guide to Using Discourse as Mailing List: https://discourse.itk.org/t/using-discourse-as-a-mailing-list/32 From thanosxania at gmail.com Fri Sep 22 06:00:50 2017 From: thanosxania at gmail.com (thanos thanos) Date: Fri, 22 Sep 2017 12:00:50 +0200 Subject: [ITK-users] [ITK] New Submission: ND morphological contour interpolation In-Reply-To: References: <20160822071136.020FE3D620D3@insight-journal.org> <1505917257724-0.post@n2.nabble.com> Message-ID: Hello D?enan, Thank you very much! I tried it already for a couple of my images and it seems to work as I was hoping! Best regards, Thanos -------------- next part -------------- An HTML attachment was scrubbed... URL: From arw.tyx-ouy_mz at suou.waseda.jp Fri Sep 22 22:22:54 2017 From: arw.tyx-ouy_mz at suou.waseda.jp (arwtyxouymz) Date: Fri, 22 Sep 2017 19:22:54 -0700 (MST) Subject: [ITK-users] ITK Build Problem Message-ID: <1506133374230-0.post@n7.nabble.com> Hi, I have a problem building ITK. I try to configure, this error message occur. ``` CMake Warning (dev) at /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5ModuleLocation.cmake:4 (set): Policy CMP0053 is not set: Simplify variable reference and escape sequence evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the cmake_policy command to set the policy and suppress this warning. For input: '${_qt5_install_prefix}/Qt5 at module@/Qt5 at module@Config.cmake' the old evaluation rules produce: '/usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5Config.cmake' but the new evaluation rules produce: '/usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5 at module@/Qt5 at module@Config.cmake' Using the old result for compatibility since the policy is not set. Call Stack (most recent call first): /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5Config.cmake:25 (include) /usr/local/lib/cmake/vtk-8.0/Modules/vtkGUISupportQtOpenGL.cmake:14 (find_package) /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:45 (include) /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:15 (vtk_module_load) /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:132 (_vtk_module_config_recurse) /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake:135 (vtk_module_config) Modules/Bridge/VtkGlue/itk-module-init.cmake:9 (find_package) CMake/ITKModuleEnablement.cmake:316 (include) CMakeLists.txt:337 (include) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5ModuleLocation.cmake:4 (set): Policy CMP0053 is not set: Simplify variable reference and escape sequence evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the cmake_policy command to set the policy and suppress this warning. For input: '${_qt5_install_prefix}/Qt5 at module@/Qt5 at module@Config.cmake' ``` My OS is Mac OS X 10.12.6 and QT version is 5.9.1 Why does this problem occur and how should i recover this problem? Please help me! -- Sent from: http://itk-users.7.n7.nabble.com/ From francois.budin at kitware.com Mon Sep 25 09:36:31 2017 From: francois.budin at kitware.com (Francois Budin) Date: Mon, 25 Sep 2017 09:36:31 -0400 Subject: [ITK-users] ITK Build Problem In-Reply-To: <1506133374230-0.post@n7.nabble.com> References: <1506133374230-0.post@n7.nabble.com> Message-ID: Hello, Thank you for reporting this. It is just a warning message. ITK configuration and compilation should run correctly despite this message. You are seeing this message because you are building Module_ITKVtkGlue, and VTK was built with Qt.It seems that it is actually Qt that is producing this message. If you do not need VTK support in ITK, you can disable Module_ITKVtkGlue . Otherwise it should still work even with the warning message. Hope this helps, Francois On Fri, Sep 22, 2017 at 10:22 PM, arwtyxouymz wrote: > Hi, > > I have a problem building ITK. > I try to configure, this error message occur. > > ``` > CMake Warning (dev) at > /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5ModuleLocation.cmake:4 (set): > Policy CMP0053 is not set: Simplify variable reference and escape > sequence > evaluation. Run "cmake --help-policy CMP0053" for policy details. Use > the > cmake_policy command to set the policy and suppress this warning. > > For input: > > '${_qt5_install_prefix}/Qt5 at module@/Qt5 at module@Config.cmake' > > the old evaluation rules produce: > > '/usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5Config.cmake' > > but the new evaluation rules produce: > > > '/usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5 at module@/Qt5 at module@Config.cmake' > > Using the old result for compatibility since the policy is not set. > Call Stack (most recent call first): > /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5Config.cmake:25 (include) > /usr/local/lib/cmake/vtk-8.0/Modules/vtkGUISupportQtOpenGL.cmake:14 > (find_package) > /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:45 (include) > /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:15 (vtk_module_load) > /usr/local/lib/cmake/vtk-8.0/vtkModuleAPI.cmake:132 > (_vtk_module_config_recurse) > /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake:135 (vtk_module_config) > Modules/Bridge/VtkGlue/itk-module-init.cmake:9 (find_package) > CMake/ITKModuleEnablement.cmake:316 (include) > CMakeLists.txt:337 (include) > This warning is for project developers. Use -Wno-dev to suppress it. > > > CMake Warning (dev) at > /usr/local/Cellar/qt/5.9.1/lib/cmake/Qt5/Qt5ModuleLocation.cmake:4 (set): > Policy CMP0053 is not set: Simplify variable reference and escape > sequence > evaluation. Run "cmake --help-policy CMP0053" for policy details. Use > the > cmake_policy command to set the policy and suppress this warning. > > For input: > > '${_qt5_install_prefix}/Qt5 at module@/Qt5 at module@Config.cmake' > ``` > > My OS is Mac OS X 10.12.6 and QT version is 5.9.1 > Why does this problem occur and how should i recover this problem? > > Please help me! > > > > > -- > Sent from: http://itk-users.7.n7.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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lebreton.a at gmail.com Thu Sep 28 03:18:40 2017 From: lebreton.a at gmail.com (Aurelie Le breton) Date: Thu, 28 Sep 2017 09:18:40 +0200 Subject: [ITK-users] problem with RelabelComponentImageFilter Message-ID: Hello, I'm using ITK, and since a few days SimpleITK, and I've got a problem with the RelabelComponentImageFilter. I haven't found the way to change the minimum objects size, here is my code (SimpleITK via Java) : BigInteger islet_size = BigInteger.valueOf(round(height/5)); // = 102 RelabelComponentImageFilter relabelFilter = new RelabelComponentImageFilter(); relabelFilter.setMinimumObjectSize(islet_size); BigInteger taille = relabelFilter.getMinimumObjectSize(); System.out.println(taille); relabelImage[i] = relabelFilter.execute(connectedComponentOutput[i]/*, islet_size*/); The size displayed in the terminal is : class org.itk.simple.SimpleITKJNI and the output image is filled full black. I don't understand the problem. Thanks in advance for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Thu Sep 28 09:33:25 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 28 Sep 2017 09:33:25 -0400 Subject: [ITK-users] problem with RelabelComponentImageFilter In-Reply-To: References: Message-ID: Hi Aurelie, if you don't call .setMinimumObjectSize(), do you still get an all-black image? If not, does any of the objects consist of more than 102 pixels? Regards, D?enan On Thu, Sep 28, 2017 at 3:18 AM, Aurelie Le breton wrote: > Hello, > > I'm using ITK, and since a few days SimpleITK, and I've got a problem with > the RelabelComponentImageFilter. > I haven't found the way to change the minimum objects size, here is my > code (SimpleITK via Java) : > > BigInteger islet_size = BigInteger.valueOf(round(height/5)); // = 102 > RelabelComponentImageFilter relabelFilter = new RelabelComponentImageFilter(); > relabelFilter.setMinimumObjectSize(islet_size); > BigInteger taille = relabelFilter.getMinimumObjectSize(); > System.out.println(taille); > relabelImage[i] = relabelFilter.execute(connectedComponentOutput[i]/*, islet_size*/); > > The size displayed in the terminal is : class org.itk.simple.SimpleITKJNI > > and the output image is filled full black. > > I don't understand the problem. > > Thanks in advance for your help. > > > _____________________________________ > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Thu Sep 28 09:35:52 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 28 Sep 2017 09:35:52 -0400 Subject: [ITK-users] problem with RelabelComponentImageFilter In-Reply-To: References: Message-ID: Also, after you call execute, can you call relabelFilter.GetOriginalNumberOfObjects() and see if this returns non-zero number? On Thu, Sep 28, 2017 at 9:33 AM, D?enan Zuki? wrote: > Hi Aurelie, > > if you don't call .setMinimumObjectSize(), do you still get an all-black > image? If not, does any of the objects consist of more than 102 pixels? > > Regards, > D?enan > > On Thu, Sep 28, 2017 at 3:18 AM, Aurelie Le breton > wrote: > >> Hello, >> >> I'm using ITK, and since a few days SimpleITK, and I've got a problem >> with the RelabelComponentImageFilter. >> I haven't found the way to change the minimum objects size, here is my >> code (SimpleITK via Java) : >> >> BigInteger islet_size = BigInteger.valueOf(round(height/5)); // = 102 >> RelabelComponentImageFilter relabelFilter = new RelabelComponentImageFilter(); >> relabelFilter.setMinimumObjectSize(islet_size); >> BigInteger taille = relabelFilter.getMinimumObjectSize(); >> System.out.println(taille); >> relabelImage[i] = relabelFilter.execute(connectedComponentOutput[i]/*, islet_size*/); >> >> The size displayed in the terminal is : class org.itk.simple.SimpleITKJNI >> >> and the output image is filled full black. >> >> I don't understand the problem. >> >> Thanks in advance for your help. >> >> >> _____________________________________ >> 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 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lebreton.a at gmail.com Thu Sep 28 10:39:44 2017 From: lebreton.a at gmail.com (lilipj) Date: Thu, 28 Sep 2017 07:39:44 -0700 (MST) Subject: [ITK-users] problem with RelabelComponentImageFilter In-Reply-To: References: Message-ID: <1506609584285-0.post@n7.nabble.com> If i don't call setMinimumObjectSize(), all labels are kept, even labels that contains more than 102 pixels or those that are very small. That's what i don't understand !! I can't call GetOriginalNumberOfObjects with SimpleITK, the function doesn't exists.... -- Sent from: http://itk-users.7.n7.nabble.com/ From blowekamp at mail.nih.gov Thu Sep 28 10:49:47 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Thu, 28 Sep 2017 14:49:47 +0000 Subject: [ITK-users] [ITK] problem with RelabelComponentImageFilter In-Reply-To: <1506609584285-0.post@n7.nabble.com> References: <1506609584285-0.post@n7.nabble.com> Message-ID: <0545FEBF-C29C-4204-9897-FC6D5BE272DB@mail.nih.gov> Hello, You initial report said ?the output image is filled with black?. It is unclear how you are viewing the image. Perhaps it is just 0?s and 1?s, and you can not see such faint values on the display. I?d suggest running the LabelStatisticsImageFilter on the results to print the number of labels in the output and their sized. You could also run this on the input too, to get the expected results. You could also set ` relabelFilter.debugOn()`, this will print the ITK filter?s state before it?s executed, so that you can verify the parameters are correctly set. The missing GetOriginalNumberOfObjects in SimpleITK is an oversight. Could you please create a feature request on the Github issue tracker[1]. [1] https://github.com/SimpleITK/SimpleITK/issues On 9/28/17, 10:40 AM, "lilipj" wrote: If i don't call setMinimumObjectSize(), all labels are kept, even labels that contains more than 102 pixels or those that are very small. That's what i don't understand !! I can't call GetOriginalNumberOfObjects with SimpleITK, the function doesn't exists.... -- Sent from: http://itk-users.7.n7.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 _______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community From lebreton.a at gmail.com Thu Sep 28 11:32:30 2017 From: lebreton.a at gmail.com (lilipj) Date: Thu, 28 Sep 2017 08:32:30 -0700 (MST) Subject: [ITK-users] [ITK] problem with RelabelComponentImageFilter In-Reply-To: <0545FEBF-C29C-4204-9897-FC6D5BE272DB@mail.nih.gov> References: <1506609584285-0.post@n7.nabble.com> <0545FEBF-C29C-4204-9897-FC6D5BE272DB@mail.nih.gov> Message-ID: <1506612750788-0.post@n7.nabble.com> I've added a MinimumMaximumImageFilter, and it confirms that min = 0.0 and max = 0.0 and when i run a LabelStatisticsImageFilter, it seems to return 0 label stat.hasLabel(0) = 1.0 stat.hasLabel(1) = 0.0 if i don't set the minimum size, it returns 207 objects... I will try to set the debug mode, thanks. -- Sent from: http://itk-users.7.n7.nabble.com/ From Anchit.Dhar at mathworks.com Fri Sep 29 16:50:18 2017 From: Anchit.Dhar at mathworks.com (Anchit Dhar) Date: Fri, 29 Sep 2017 20:50:18 +0000 Subject: [ITK-users] ITK 4.12 build issues with cmake 2.8.12 Message-ID: <20A76CF9-5FE0-482D-AF95-42B8F66182AB@mathworks.com> Hello, I am trying to build ITK 4.12 with cmake 2.8.12 on a linux machine with GCC 6.3. My build fails at the configuration sets with the error snippets added below. I was wondering if there are any known/open build issues with this combination on cmake and ITK? Does anyone have any pointers on resolving these configuration issues? Thanks in advance. Regards, Anchit. Error Snippet Performing C SOURCE FILE Test C_HAS_WARNING-Wno-long-double failed with the following output: Change Dir: /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp Run Build Command:"/internal/2106168/glnxa64/gmake/bin/gmake" "cmTC_91c4b/fast" gmake[2]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' /internal/2106168/glnxa64/gmake/bin/gmake -f CMakeFiles/cmTC_91c4b.dir/build.make CMakeFiles/cmTC_91c4b.dir/build gmake[3]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_91c4b.dir/src.c.o /internal/2501977/glnxa64/gcc-6.3.0/bin/gcc -O2 -pipe -pthread -fPIC -DC_HAS_WARNING-Wno-long-double -Wno-long-double -o CMakeFiles/cmTC_91c4b.dir/src.c.o -c /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp/src.c :0:14: warning: ISO C99 requires whitespace after the macro name cc1: warning: unrecognized command line option ?-Wno-long-double? Linking C executable cmTC_91c4b /home/adhar/3p-tmw/3p/private/unknown/glnxa64/cmake-bin/glnx86/cmake -E cmake_link_script CMakeFiles/cmTC_91c4b.dir/link.txt --verbose=1 /internal/2501977/glnxa64/gcc-6.3.0/bin/gcc -O2 -pipe -pthread -fPIC -DC_HAS_WARNING-Wno-long-double -pthread -Wl,--hash-style=both -L/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib -Wl,-rpath-link,/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib CMakeFiles/cmTC_91c4b.dir/src.c.o -o cmTC_91c4b -rdynamic gmake[3]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' gmake[2]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' Source file was: int main(void) { return 0; } Performing C++ SOURCE FILE Test CXX_HAS_WARNING-Wno-long-double failed with the following output: Change Dir: /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp Run Build Command:"/internal/2106168/glnxa64/gmake/bin/gmake" "cmTC_82695/fast" gmake[2]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' /internal/2106168/glnxa64/gmake/bin/gmake -f CMakeFiles/cmTC_82695.dir/build.make CMakeFiles/cmTC_82695.dir/build gmake[3]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_82695.dir/src.cxx.o /internal/2501977/glnxa64/gcc-6.3.0/bin/g++ -O2 -pipe -pthread -fPIC -std=c++11 -DCXX_HAS_WARNING-Wno-long-double -Wno-long-double -o CMakeFiles/cmTC_82695.dir/src.cxx.o -c /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp/src.cxx :0:16: warning: ISO C++11 requires whitespace after the macro name cc1plus: warning: unrecognized command line option ?-Wno-long-double? Linking CXX executable cmTC_82695 /home/adhar/3p-tmw/3p/private/unknown/glnxa64/cmake-bin/glnx86/cmake -E cmake_link_script CMakeFiles/cmTC_82695.dir/link.txt --verbose=1 /internal/2501977/glnxa64/gcc-6.3.0/bin/g++ -O2 -pipe -pthread -fPIC -std=c++11 -DCXX_HAS_WARNING-Wno-long-double -pthread -Wl,--hash-style=both -L/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib -Wl,-rpath-link,/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib CMakeFiles/cmTC_82695.dir/src.cxx.o -o cmTC_82695 -rdynamic gmake[3]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' gmake[2]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' Source file was: int main() { return 0;} Performing C++ SOURCE FILE Test have_gold failed with the following output: Change Dir: /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp Run Build Command:"/internal/2106168/glnxa64/gmake/bin/gmake" "cmTC_93f61/fast" gmake[2]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' /internal/2106168/glnxa64/gmake/bin/gmake -f CMakeFiles/cmTC_93f61.dir/build.make CMakeFiles/cmTC_93f61.dir/build gmake[3]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_93f61.dir/src.cxx.o /internal/2501977/glnxa64/gcc-6.3.0/bin/g++ -O2 -pipe -pthread -fPIC -std=c++11 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -Dhave_gold -fuse-ld=gold -o CMakeFiles/cmTC_93f61.dir/src.cxx.o -c /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp/src.cxx Linking CXX executable cmTC_93f61 /home/adhar/3p-tmw/3p/private/unknown/glnxa64/cmake-bin/glnx86/cmake -E cmake_link_script CMakeFiles/cmTC_93f61.dir/link.txt --verbose=1 /internal/2501977/glnxa64/gcc-6.3.0/bin/g++ -O2 -pipe -pthread -fPIC -std=c++11 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -Dhave_gold -fuse-ld=gold -pthread -Wl,--hash-style=both -L/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib -Wl,-rpath-link,/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/lib CMakeFiles/cmTC_93f61.dir/src.cxx.o -o cmTC_93f61 -rdynamic /internal/2501977/glnxa64/gcc-6.3.0/bin/ld.gold: -plugin: unknown option /internal/2501977/glnxa64/gcc-6.3.0/bin/ld.gold: use the --help option for usage information collect2: error: ld returned 1 exit status gmake[3]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' gmake[3]: *** [CMakeFiles/cmTC_93f61.dir/build.make:98: cmTC_93f61] Error 1 gmake[2]: *** [Makefile:126: cmTC_93f61/fast] Error 2 gmake[2]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/CMakeFiles/CMakeTmp' . . . . . . . /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx:24:1: error: ?__int64? does not name a type __int64 f(__int64 n) ^~~~~~~ /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx: In function ?int main()?: /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx:30:3: error: ?__int64? was not declared in this scope __int64 n = 0; ^~~~~~~ /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx:31:29: error: ?n? was not declared in this scope return static_cast(f(n)); ^ /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx:31:30: error: ?f? was not declared in this scope return static_cast(f(n)); ^ gmake[3]: *** [CMakeFiles/cmTC_797a6.dir/build.make:66: CMakeFiles/cmTC_797a6.dir/kwsysPlatformTestsCXX.cxx.o] Error 1 . . . . . . . Checking whether CXX compiler has _atoi64 failed to compile with the following output: Change Dir: /home/adhar/3p-tmw/3p/derived/glnxa64/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/CMakeTmp Run Build Command:"/internal/2106168/glnxa64/gmake/bin/gmake" "cmTC_82d35/fast" gmake[2]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/CMakeTmp' /internal/2106168/glnxa64/gmake/bin/gmake -f CMakeFiles/cmTC_82d35.dir/build.make CMakeFiles/cmTC_82d35.dir/build gmake[3]: Entering directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_82d35.dir/kwsysPlatformTestsCXX.cxx.o /internal/2501977/glnxa64/gcc-6.3.0/bin/g++ -DTEST_KWSYS_CXX_HAS__ATOI64 -O2 -pipe -pthread -fPIC -std=c++11 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -w -fPIE -o CMakeFiles/cmTC_82d35.dir/kwsysPlatformTestsCXX.cxx.o -c /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx: In function ?int main()?: /home/adhar/3p-tmw/3p/sources/ITK/Modules/ThirdParty/KWSys/src/KWSys/kwsysPlatformTestsCXX.cxx:252:38: error: ?_atoi64? was not declared in this scope return static_cast(_atoi64(str)); ^ gmake[3]: *** [CMakeFiles/cmTC_82d35.dir/build.make:66: CMakeFiles/cmTC_82d35.dir/kwsysPlatformTestsCXX.cxx.o] Error 1 gmake[3]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/CMakeTmp' gmake[2]: *** [Makefile:126: cmTC_82d35/fast] Error 2 gmake[2]: Leaving directory '/home/adhar/3p-tmw/3p/derived/glnxa64/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeFiles/CMakeTmp' -------------- next part -------------- An HTML attachment was scrubbed... URL: