- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I Observed some Times problems calling subroutines with pointers to a type as argument. See the simplified source code above.
The point is, that I have a valid pointer PatItem, before I call the subroutine DataBase_Pat_FindCorrespondingImage
Inside the subroutine, PatItem becomes invalid, and the program crashes.
If I put DataBase_Pat_FindCorrespondingImage into a module, than everithing is fine.
Has anybody an Idea what could be the problem ??
Subroutine DataBase_Pat_FindCorrespondingImage(PatItem,StuItem,SerItem) !Image3D_Dim,pixel_spacing, StuItem,SerItem)
use VSIM_MESSAGE
implicit none
! input variables
type(dbPatItem),pointer,intent(in):: PatItem ! Patient to look for an image
integer(2) Image3D_dim(3) ! image dimensions (x,y,z)
REAL(8) pixel_spacing(3) ! x,y,z
! output variables
integer(2) iErr ! Error flag
type(dbStuItem),pointer,intent(out):: StuItem ! Pointer to the study with the right serie
type(dbSerItem),pointer,intent(out):: SerItem ! Poiinter to the serie containing the found image
! PatItem has strange values
nullify(StuItem) ! crash
nullify(SerItem)
...
end subroutine
Subroutine Test(dbase,pat_id,stu_Uid,ser_Uid)
type(dbPatList) dbase ! database containing information where to find the block-images
character*(*) pat_id ! patient id
character*(*) stu_Uid ! study unique identifier
character*(*) ser_Uid ! serie unique identifier
type(dbPatItem),pointer:: PatItem ! Patient to look for an image
call dbPatList_FindItem (dbase%pat_list, pat_id, foundPat,PatItem) ! check if Patient is already in database
! PatItem is associated and contains valid values
call DataBase_Pat_FindCorrespondingImage(iErr, PatItem,VSIM_Image%Image3D_Dim,VSIM_Image%pixel_spacing, StuItem,SerItem)
end Test
The point is, that I have a valid pointer PatItem, before I call the subroutine DataBase_Pat_FindCorrespondingImage
Inside the subroutine, PatItem becomes invalid, and the program crashes.
If I put DataBase_Pat_FindCorrespondingImage into a module, than everithing is fine.
Has anybody an Idea what could be the problem ??
Subroutine DataBase_Pat_FindCorrespondingImage(PatItem,StuItem,SerItem) !Image3D_Dim,pixel_spacing, StuItem,SerItem)
use VSIM_MESSAGE
implicit none
! input variables
type(dbPatItem),pointer,intent(in):: PatItem ! Patient to look for an image
integer(2) Image3D_dim(3) ! image dimensions (x,y,z)
REAL(8) pixel_spacing(3) ! x,y,z
! output variables
integer(2) iErr ! Error flag
type(dbStuItem),pointer,intent(out):: StuItem ! Pointer to the study with the right serie
type(dbSerItem),pointer,intent(out):: SerItem ! Poiinter to the serie containing the found image
! PatItem has strange values
nullify(StuItem) ! crash
nullify(SerItem)
...
end subroutine
Subroutine Test(dbase,pat_id,stu_Uid,ser_Uid)
type(dbPatList) dbase ! database containing information where to find the block-images
character*(*) pat_id ! patient id
character*(*) stu_Uid ! study unique identifier
character*(*) ser_Uid ! serie unique identifier
type(dbPatItem),pointer:: PatItem ! Patient to look for an image
call dbPatList_FindItem (dbase%pat_list, pat_id, foundPat,PatItem) ! check if Patient is already in database
! PatItem is associated and contains valid values
call DataBase_Pat_FindCorrespondingImage(iErr, PatItem,VSIM_Image%Image3D_Dim,VSIM_Image%pixel_spacing, StuItem,SerItem)
end Test
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If a procedure has a dummy argument that is a pointer then an explicit interface must be available in the calling scope.
When you put DataBase_Pat_FindCorrespondingImage into a module that explicit interface is automatically created for you and made availble in any scope that USE's the module.
If you don't want to have that procedure in a module then you will need to manually create the corresponding INTERFACE block.
When you put DataBase_Pat_FindCorrespondingImage into a module that explicit interface is automatically created for you and made availble in any scope that USE's the module.
If you don't want to have that procedure in a module then you will need to manually create the corresponding INTERFACE block.
![](/skins/images/2E08A100FB92911314A240D1EAFB2828/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page